Files
app/.gitea/workflows/test-backend.yml
T

70 lines
2.5 KiB
YAML

name: Test Backend
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
# A new push supersedes the run still queued for the commit before it. Without
# this each commit leaves its own run in the queue and a runner that was offline
# for a while works through a backlog of results nobody will read.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-backend:
runs-on: ubuntu-latest
# The floor `requires-python` declares and the newest release, so neither
# end of the supported range goes untested.
strategy:
fail-fast: false
matrix:
python-version: ["3.12", "3.14"]
# The Redis queue and stream tests run against a real server. Same major
# version as the shipped image in docker/compose.yml.
services:
redis:
image: redis:8.2-alpine
env:
# uv would otherwise take a managed interpreter it already has over the
# one set up below.
UV_PYTHON: ${{ matrix.python-version }}
# The job runs in a container next to the service, which answers to its
# name on the default port.
FLUKSIO_TEST_REDIS_HOST: redis
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
cache-dependency-glob: |
pyproject.toml
backend/pyproject.toml
uv.lock
# The extras too, as `make test-backend` does: the mail, MQTT and Influx
# tests import what only the `server` extra installs.
- run: uv sync --all-extras
# Nothing else to start: the suite names its own SQLite file in a temp
# directory (backend/tests/__init__.py), the mail paths are patched, and
# the flow engine falls back to in-memory state without a Redis host.
# Only the tests gated on FLUKSIO_TEST_REDIS_HOST use the service.
- name: Run tests with coverage
run: uv run bash scripts/test.sh "Coverage for ${{ github.sha }}"
working-directory: backend
- name: Check the wheels build
# Cheap, and it catches a data file that stopped being packaged —
# alembic's revisions and the email templates ride along by directory.
run: |
uv build --all-packages --out-dir dist
uv run --no-project --with dist/fluksio_worker-*.whl fluksio-worker --help