velofy/.forgejo/workflows/ci.yml
Alexander Hess 042256eb99
All checks were successful
CI / Tests (Python 3.13) (push) Successful in 1m17s
Switch to Python 3.13
The dependencies stay in the same series as on Python 3.8
where those support 3.13.

Only the unavoidable upgrades are taken:
 - `matplotlib` to v3.9
 - `numpy` to v2.1
 - `pandas` to v2.2
 - `scipy` (via statsmodels)

Required code changes:
- `numpy` v2.1 prints its scalars as `np.float64(...)`,
  which `psycopg2` then writes into the SQL
  => Adjust `Forecast.from_dataframe()` to convert the
     rounded values into plain `float`s
- Python 3.12 no longer accepts `float`s in `random.randint()`
  => The test factories now pass the seconds as `int`s

CI and `nox` use a `u`v-managed Python, which ships the C headers
needed to build `psycopg2` and `rpy2`.

`flake8` v4 does not run on Python 3.12+
and is upgraded in a future commit.
2026-11-25 11:30:33 +01:00

65 lines
1.6 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
# 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
steps:
- uses: actions/checkout@v4
- name: Install system packages (psycopg2 and R)
run: |
apt-get update
apt-get install --no-install-recommends \
libpq-dev \
r-base-dev \
r-cran-forecast \
r-cran-zoo \
-y
- name: Install development tool chain (Python, uv, poetry)
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
"$HOME/.local/bin/uv" python install 3.13
"$HOME/.local/bin/uv" tool install --python 3.13 'poetry>=2'
- name: Install the project
run: |
uv venv --python 3.13 --seed .venv
poetry sync --no-interaction
# `TESTING=true` comes from `setup.cfg`
- name: Run the test suite
run: poetry run pytest -q