Forgejo runner runs with `capacity: 1` (one job at a time across every
repo it serves — mammon, infoxtractor, etc.). Without a concurrency
block, rapid-fire pushes to the same PR branch all queue behind any
task already running, burning the runner for 30+ min on stale commits.
`concurrency: { group: ci-$ref, cancel-in-progress: true }` tells
Forgejo to cancel any still-queued or still-running CI on this ref as
soon as a newer commit shows up. Applies to both push and
pull_request events.
(Previous PR bodies noted a "trigger bug" where I saw no CI response
on a push — that was actually just the capacity=1 queue with no visible
signal; the CI always fired, just minutes later. Runner capacity bump
lives in infrastructure, not this repo.)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
44 lines
1.1 KiB
YAML
44 lines
1.1 KiB
YAML
name: tests
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
# Cancel any running CI for the same PR or branch when a new commit
|
|
# lands. The shared runner has capacity=1, so stacking obsolete runs
|
|
# just pushes useful ones to the back of the queue.
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: docker
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
env:
|
|
POSTGRES_USER: test
|
|
POSTGRES_PASSWORD: test
|
|
POSTGRES_DB: ix_test
|
|
|
|
env:
|
|
IX_POSTGRES_URL: postgresql+asyncpg://test:test@postgres:5432/ix_test
|
|
IX_TEST_MODE: fake
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install system deps for python-magic / PyMuPDF
|
|
run: |
|
|
apt-get update -qq
|
|
apt-get install -y -qq --no-install-recommends libmagic1 libgl1 libglib2.0-0
|
|
|
|
- name: Install uv
|
|
run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
|
|
- name: Lint
|
|
run: ~/.local/bin/uv run --extra dev ruff check src tests
|
|
|
|
- name: Unit + integration tests
|
|
run: ~/.local/bin/uv run --extra dev pytest tests/unit tests/integration -v
|