name: Backend Benchmark Tests # Offline benchmark script suites (`backend/tests/test_bench_*.py`) carry the # `benchmark` marker. Core backend shards exclude them so benchmark harness # tests do not inflate unrelated PRs; this workflow runs them whenever benchmark # scripts, benchmark tests, or shared test infrastructure change. # # `test_benchmark_ci.py` keeps the marker registration, Makefile targets, and # trigger paths in sync. on: pull_request: types: [opened, synchronize, reopened, ready_for_review] paths: - 'backend/scripts/benchmark/**' - 'backend/tests/conftest.py' - 'backend/tests/support/**' - 'backend/tests/test_bench_*.py' - 'backend/tests/test_benchmark_ci.py' - 'backend/pyproject.toml' - 'backend/uv.lock' - 'backend/Makefile' - '.github/workflows/backend-benchmark-tests.yml' push: branches: [main, "*-dev"] paths: - 'backend/scripts/benchmark/**' - 'backend/tests/conftest.py' - 'backend/tests/support/**' - 'backend/tests/test_bench_*.py' - 'backend/tests/test_benchmark_ci.py' - 'backend/pyproject.toml' - 'backend/uv.lock' - 'backend/Makefile' - '.github/workflows/backend-benchmark-tests.yml' permissions: contents: read concurrency: group: backend-benchmark-tests-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: backend-benchmark-tests: if: github.event_name != 'pull_request' || github.event.pull_request.draft == false runs-on: ubuntu-latest timeout-minutes: 10 services: postgres: image: postgres:17 env: POSTGRES_USER: deerflow POSTGRES_PASSWORD: deerflow POSTGRES_DB: deerflow_test ports: - 5432:5432 options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 env: TEST_POSTGRES_URI: postgresql://deerflow:deerflow@localhost:5432/deerflow_test?sslmode=disable steps: - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: python-version: '3.12' - uses: astral-sh/setup-uv@v7 with: # Must match backend/Dockerfile's UV_IMAGE tag; pinned by backend/tests/test_ci_uv_version_pin.py version: "0.11.1" - name: Install backend dependencies working-directory: backend run: uv sync --group dev --extra postgres - name: Run offline benchmark script tests working-directory: backend run: make test-benchmark