69 lines
1.8 KiB
YAML
69 lines
1.8 KiB
YAML
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:
|
|
test:
|
|
name: Tests (Python 3.13)
|
|
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
|
|
# 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
|
|
|
|
# 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:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install system packages (R)
|
|
run: |
|
|
apt-get update
|
|
apt-get install --no-install-recommends \
|
|
r-base-dev \
|
|
r-cran-forecast \
|
|
r-cran-zoo \
|
|
-y
|
|
|
|
- name: Install development tool chain (Python, uv)
|
|
run: |
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
|
"$HOME/.local/bin/uv" python install 3.13
|
|
|
|
- name: Install the project
|
|
run: |
|
|
uv sync --locked
|
|
|
|
# `TESTING=true` comes from `pyproject.toml`
|
|
- name: Run the test suite
|
|
run: uv run pytest -q
|