Files
stack/.gitea/workflows/ci.yml
kert 16d657a8e0
Some checks failed
Deploy / docs (push) Has been skipped
CI / lint (push) Successful in 34s
Deploy / notebooks (push) Has been skipped
Deploy / zotero (push) Has been skipped
Deploy / api (push) Successful in 48s
Deploy / mc (push) Has been skipped
Infra CI / notebooks (push) Failing after 20s
Infra CI / zotero (push) Successful in 12s
Infra CI / docs (push) Successful in 12s
Infra CI / api (push) Successful in 18s
Infra CI / mc (push) Successful in 12s
Package Supply Chain / pkg-supply-chain (push) Failing after 49s
Deploy / report (push) Successful in 18s
CI / test (push) Failing after 11m9s
perf(ci): add -n auto to CI pytest + fix coverage combining (#388)
The earlier xdist attempt was reverted in 847713d because pytest-cov
combined results unreliably under -n auto. Root cause: missing
[tool.coverage.run] parallel=true in pyproject.toml. Without it,
each worker overwrites .coverage atomically and the report drops
data from all but one worker.

Fix:
- pyproject.toml: add [tool.coverage.run] with parallel=true,
  source=["src"], concurrency=["multiprocessing","thread"]. Verified
  locally: 56-test xdist run produces a clean combined coverage
  report at 99% (vs flaky/missing data before).
- dev/scripts/backends/gitea.py + github.py: add -n auto to the
  emitted pytest command. Also persist the deploy.yml report-step
  failure gate (was applied to the file in 5f826f6 but the emitter
  itself didn't have it, so regen would strip it).
- .gitea/workflows/ci.yml: regenerated to pick up -n auto.

The 32-core runner should now run CI pytest in roughly 1/Nth the
prior time (where N is bounded by serialization on slow tests).

Phase 1 of #388 (pre-commit hook xdist) shipped in 49f004a.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 19:19:56 -04:00

67 lines
1.9 KiB
YAML

# DO NOT EDIT — generated by gen_config.py from stack.toml
# Re-generate: uv run python dev/scripts/gen_config.py
name: CI
on:
push:
branches: ["**"]
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: https://github.com/actions/checkout@v4
- name: Set up uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
env:
UV_INSTALL_DIR: /usr/local/bin
- name: Install dependencies
run: uv sync --dev
- name: Ruff check
run: uv run ruff check src/ tests/ --output-format=concise
- name: Ruff format
run: uv run ruff format --check src/ tests/
- name: Validate generated config
run: uv run python dev/scripts/gen_config.py --check
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: https://github.com/actions/checkout@v4
- name: Set up uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
env:
UV_INSTALL_DIR: /usr/local/bin
- name: Install dependencies
run: uv sync --dev
- name: Pytest
# -n auto parallelizes across runner cores. Coverage combining
# is configured via [tool.coverage.run] parallel=true in
# pyproject.toml — without that the per-worker .coverage.* files
# don't merge reliably (see #388 for the prior revert).
run: uv run pytest tests/ -x --cov=src --cov-report=term-missing --cov-fail-under=99 -q -n auto
- name: File failure issue
if: failure()
env:
GITEA_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
run: |
uv sync --no-dev --quiet 2>/dev/null || true
uv run python -m api.diag.ci \
--workflow "CI" --job "test" \
--run "${{ github.run_number }}" \
--sha "${{ github.sha }}" \
--ref "${{ github.ref }}" || true