Run the CI checks in parallel jobs
The test sessions run as a matrix, each with its own database. This also adds the "test-with" sessions to CI; so, the setup installs all `SUPPORTED_PYTHONS` via `uv`, as `nox` would otherwise pick the system Python 3.13, which lacks the headers to build `rpy2`.
This commit is contained in:
parent
49276bb9cf
commit
e1cdac4cfa
2 changed files with 47 additions and 20 deletions
|
|
@ -17,13 +17,14 @@ runs:
|
||||||
r-cran-zoo \
|
r-cran-zoo \
|
||||||
-y
|
-y
|
||||||
|
|
||||||
# Same `uv` version as pinned in pyproject.toml
|
# All `SUPPORTED_PYTHONS` from the "classifiers" in pyproject.toml
|
||||||
- name: Install `uv` and `python3.14`
|
# => `nox` would otherwise pick the system's Python without headers
|
||||||
|
- name: Install `uv` and all supported Python versions
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
curl -LsSf https://astral.sh/uv/0.13.10/install.sh | sh
|
curl -LsSf https://astral.sh/uv/0.13.10/install.sh | sh
|
||||||
echo "$HOME/.local/bin" >> "$FORGEJO_PATH"
|
echo "$HOME/.local/bin" >> "$FORGEJO_PATH"
|
||||||
"$HOME/.local/bin/uv" python install 3.14
|
"$HOME/.local/bin/uv" python install $(grep -oP 'Programming Language :: Python :: \K3\.\d+' pyproject.toml)
|
||||||
|
|
||||||
- name: Install `velofy` and its dependencies
|
- name: Install `velofy` and its dependencies
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,25 @@ defaults:
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
|
||||||
|
# Same variables as in `.env` on `nehemiah`, the main development machine
|
||||||
|
env:
|
||||||
|
DATABASE_URI: postgresql://user:password@postgres:5432/db
|
||||||
|
GOOGLE_MAPS_API_KEY: AIzaDummyKeyForTests # Fake key to mock the Google API
|
||||||
|
R_LIBS: /usr/lib/R/site-library
|
||||||
|
UV_PYTHON_PREFERENCE: only-managed # Only uv's Python has the headers to build `rpy2`
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
checks:
|
|
||||||
name: Checks
|
lint:
|
||||||
|
name: Lint
|
||||||
runs-on: debian-13
|
runs-on: debian-13
|
||||||
|
|
||||||
# Stop hanging jobs (e.g., a test waiting for a database lock)
|
# Stop hanging jobs (e.g., a test waiting for a database lock)
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
|
|
||||||
# Throwaway database, reachable from the job as host `postgres`
|
# Throwaway database, reachable from the job as host `postgres`
|
||||||
services:
|
services: &database
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:17
|
image: postgres:17
|
||||||
env:
|
env:
|
||||||
|
|
@ -35,14 +44,6 @@ jobs:
|
||||||
--health-timeout 5s
|
--health-timeout 5s
|
||||||
--health-retries 15
|
--health-retries 15
|
||||||
|
|
||||||
# Same variables as in `.env` on `nehemiah`, the main development machine
|
|
||||||
env:
|
|
||||||
DATABASE_URI: postgresql://user:password@postgres:5432/db
|
|
||||||
GOOGLE_MAPS_API_KEY: AIzaDummyKeyForTests # Fake key to mock the Google API
|
|
||||||
R_LIBS: /usr/lib/R/site-library
|
|
||||||
UV_PYTHON_PREFERENCE: only-managed # Only uv's Python has the headers to build `rpy2`
|
|
||||||
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
|
|
@ -61,16 +62,41 @@ jobs:
|
||||||
- name: Lint the source files
|
- name: Lint the source files
|
||||||
run: uv run nox -s lint
|
run: uv run nox -s lint
|
||||||
|
|
||||||
- name: Run the test suite
|
|
||||||
run: uv run nox -s test
|
|
||||||
|
|
||||||
- name: Test the code snippets in the docstrings with `xdoctest`
|
- name: Test the code snippets in the docstrings with `xdoctest`
|
||||||
run: uv run nox -s test-docstrings
|
run: uv run nox -s test-docstrings
|
||||||
|
|
||||||
- name: Check the type annotations at runtime with `typeguard`
|
|
||||||
run: uv run nox -s test-types
|
|
||||||
|
|
||||||
- name: Run the `pre-commit` hooks not covered by `nox`
|
- name: Run the `pre-commit` hooks not covered by `nox`
|
||||||
run: uv run pre-commit run --all-files --show-diff-on-failure
|
run: uv run pre-commit run --all-files --show-diff-on-failure
|
||||||
env:
|
env:
|
||||||
SKIP: local-format,local-lint,local-test,local-test-docstrings,local-test-types,no-commit-to-branch
|
SKIP: local-format,local-lint,local-test,local-test-docstrings,local-test-types,no-commit-to-branch
|
||||||
|
|
||||||
|
|
||||||
|
tests:
|
||||||
|
name: Tests (${{ matrix.session }})
|
||||||
|
runs-on: debian-13
|
||||||
|
|
||||||
|
# Stop hanging jobs (e.g., a test waiting for a database lock)
|
||||||
|
timeout-minutes: 20
|
||||||
|
|
||||||
|
# Run the sessions in parallel, each with its own database
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
session:
|
||||||
|
- test
|
||||||
|
- test-types
|
||||||
|
# One job per non-main Python version listed in the "classifiers"
|
||||||
|
# in pyproject.toml => Keep in sync manually
|
||||||
|
- test-with-3.13
|
||||||
|
- test-with-3.15
|
||||||
|
|
||||||
|
# Same database as in the "lint" job
|
||||||
|
services: *database
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- uses: ./.forgejo/actions/setup
|
||||||
|
|
||||||
|
- name: Run the `nox` session
|
||||||
|
run: uv run nox -s ${{ matrix.session }}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue