From a644d2cec6df2c3e7212edcc659269d3f4ae84a7 Mon Sep 17 00:00:00 2001 From: "tom.bonfert" Date: Thu, 30 Jul 2026 15:33:12 +0200 Subject: [PATCH] ci: shard acceptance tests by component with Makefile TEST_PATH override and Codecov flag carryforward --- .github/codecov.yml | 14 ++++++++++++++ .github/workflows/acceptance.yml | 13 +++++++++---- Makefile | 6 +++++- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/.github/codecov.yml b/.github/codecov.yml index 8ee4790c..639322ad 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -16,6 +16,20 @@ coverage: target: auto threshold: 0.5% +# The test suite is sharded by component across parallel CI jobs; each shard uploads +# coverage under its own flag. carryforward keeps a flag's last coverage on commits +# where only the other shard ran. The project/patch statuses above operate on the merged total. +flag_management: + default_rules: + carryforward: true +flags: + query_engine: + paths: + - src/impulse_query_engine/ + reporting: + paths: + - src/impulse_reporting/ + comment: # this is a top-level key layout: "diff, flags, files" behavior: default diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index 16a3e4cc..96819e29 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -56,7 +56,7 @@ jobs: run: make lint test: - name: Testing + name: Testing (${{ matrix.component }}) runs-on: group: databrickslabs-protected-runner-group labels: linux-ubuntu-latest @@ -64,8 +64,13 @@ jobs: permissions: id-token: write strategy: + fail-fast: false matrix: - python-version: [ '3.12' ] + include: + - component: query_engine + path: tests/impulse_query_engine + - component: reporting + path: tests/impulse_reporting steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -90,10 +95,10 @@ jobs: run: make dev - name: Run unit tests with coverage - run: make test + run: make test TEST_PATH=${{ matrix.path }} - name: Upload coverage to Codecov - if: matrix.python-version == '3.12' uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 with: use_oidc: true + flags: ${{ matrix.component }} diff --git a/Makefile b/Makefile index 12be2605..3d13e279 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,10 @@ export UV_BUILD_CONSTRAINT := .build-constraints.txt UV_RUN := uv run --exact --all-extras +# Path(s) passed to pytest. Defaults to the whole suite; CI overrides this to run a +# single component's tests in parallel, e.g. `make test TEST_PATH=tests/impulse_query_engine`. +TEST_PATH ?= tests/ + clean: rm -fr .venv htmlcov .pytest_cache .ruff_cache .coverage coverage.xml test-results.xml find . -name '__pycache__' -print0 | xargs -0 rm -fr @@ -28,7 +32,7 @@ fmt: $(UV_RUN) ruff check src/ tests/ --fix test: - $(UV_RUN) pytest tests/ --cov=src --cov-branch --cov-report=xml + $(UV_RUN) pytest $(TEST_PATH) --cov=src --cov-branch --cov-report=xml coverage: $(UV_RUN) pytest tests/ --cov=src --cov-branch --cov-report=html