From e33d6d98da3efba23384a6a395d532e2129da4f6 Mon Sep 17 00:00:00 2001 From: Joan Code <172996447+joan-code6@users.noreply.github.com> Date: Sat, 17 Oct 2026 20:50:34 +0200 Subject: [PATCH] Run backend regression tests on pull requests and main --- .github/workflows/tests.yml | 38 +++++++++++++++++++++++++++++++++++++ README.md | 9 +++++++++ requirements-test.txt | 3 +++ 3 files changed, 50 insertions(+) create mode 100644 .github/workflows/tests.yml create mode 100644 requirements-test.txt diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..58b38fab --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,38 @@ +name: Backend tests + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: backend-tests-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + tests: + runs-on: ubuntu-latest + timeout-minutes: 10 + strategy: + fail-fast: false + matrix: + python: ['3.11', '3.13'] + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + with: + persist-credentials: false + - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 + with: + python-version: ${{ matrix.python }} + cache: pip + cache-dependency-path: | + requirements.txt + requirements-test.txt + - name: Install test dependencies + run: python -m pip install -r requirements-test.txt + - name: Run offline regression suite + run: python -m pytest tests -q diff --git a/README.md b/README.md index 57d009b1..d6e18a15 100644 --- a/README.md +++ b/README.md @@ -302,3 +302,12 @@ surface and method documentation. ## License This project is released under the [MIT License](LICENSE). + +## Automated regression checks + +Install `requirements-test.txt` in a virtual environment, then run +`python -m pytest tests -q` from the repository root. This runs the mocked +regression suite without SPH credentials; the optional live timetable fixture +test is skipped unless explicitly configured. GitHub Actions runs the suite on +Python 3.11 and 3.13 for pull requests and pushes to main, caches pip downloads, +and cancels superseded runs. This workflow does not deploy the backend. diff --git a/requirements-test.txt b/requirements-test.txt new file mode 100644 index 00000000..7d05f480 --- /dev/null +++ b/requirements-test.txt @@ -0,0 +1,3 @@ +-r requirements.txt +pytest>=7.0.0 +httpx>=0.27.0