2026-11-23 16:27:04 +01:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Run on every push and on pull requests
|
|
|
|
|
on:
|
|
|
|
|
push:
|
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Use `bash` instead of the container's default `sh`
|
|
|
|
|
defaults:
|
|
|
|
|
run:
|
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jobs:
|
2026-11-27 13:27:28 +01:00
|
|
|
checks:
|
|
|
|
|
name: Checks (Python 3.13)
|
2026-11-23 16:27:04 +01:00
|
|
|
runs-on: debian-13
|
|
|
|
|
|
|
|
|
|
# Throwaway database, reachable from the job as host `postgres`
|
|
|
|
|
services:
|
|
|
|
|
postgres:
|
|
|
|
|
image: postgres:17
|
|
|
|
|
env:
|
|
|
|
|
POSTGRES_USER: user
|
|
|
|
|
POSTGRES_PASSWORD: password
|
|
|
|
|
POSTGRES_DB: db
|
2026-11-27 13:26:43 +01:00
|
|
|
# Start the steps only once the database accepts connections
|
|
|
|
|
options: >-
|
|
|
|
|
--health-cmd "pg_isready --username=user --dbname=db"
|
|
|
|
|
--health-interval 2s
|
|
|
|
|
--health-timeout 5s
|
|
|
|
|
--health-retries 15
|
2026-11-23 16:27:04 +01:00
|
|
|
|
|
|
|
|
# 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
|
2026-11-27 13:26:51 +01:00
|
|
|
UV_PYTHON_PREFERENCE: only-managed # Only uv's Python has the headers to build `rpy2`
|
2026-11-23 16:27:04 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
2026-11-27 13:32:27 +01:00
|
|
|
- uses: actions/checkout@v6
|
2026-11-23 16:27:04 +01:00
|
|
|
|
2026-11-27 13:27:12 +01:00
|
|
|
- name: Install R via system packages
|
2026-11-23 16:27:04 +01:00
|
|
|
run: |
|
|
|
|
|
apt-get update
|
|
|
|
|
apt-get install --no-install-recommends \
|
|
|
|
|
r-base-dev \
|
|
|
|
|
r-cran-forecast \
|
|
|
|
|
r-cran-zoo \
|
|
|
|
|
-y
|
|
|
|
|
|
2026-11-27 13:38:31 +01:00
|
|
|
# Same `uv` version as pinned in pyproject.toml
|
2026-11-27 13:27:12 +01:00
|
|
|
- name: Install `uv` and `python3.13`
|
2026-11-23 16:27:04 +01:00
|
|
|
run: |
|
2026-11-27 13:38:31 +01:00
|
|
|
curl -LsSf https://astral.sh/uv/0.13.10/install.sh | sh
|
2026-11-23 16:27:04 +01:00
|
|
|
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
2026-11-25 11:29:50 +01:00
|
|
|
"$HOME/.local/bin/uv" python install 3.13
|
2026-11-23 16:27:04 +01:00
|
|
|
|
2026-11-27 13:27:12 +01:00
|
|
|
- name: Install `velofy` and its dependencies
|
|
|
|
|
run: uv sync --locked
|
2026-11-23 16:27:04 +01:00
|
|
|
|
2026-11-27 13:27:28 +01:00
|
|
|
- name: Ensure `nox -s format` changes nothing
|
|
|
|
|
run: uv run nox -s format && git diff --exit-code
|
|
|
|
|
|
|
|
|
|
- name: Lint the source files
|
|
|
|
|
run: uv run nox -s lint
|
|
|
|
|
|
2026-11-23 16:27:04 +01:00
|
|
|
- name: Run the test suite
|
2026-11-27 13:27:28 +01:00
|
|
|
run: uv run nox -s test
|
|
|
|
|
|
|
|
|
|
- name: Run the doctests
|
|
|
|
|
run: uv run nox -s doctest
|