# Gateway unit tests and lint. Split from ci.yaml so this job can use native # on.pull_request.paths filtering and skip PRs that do not touch the gateway. # The job name is `python`; because it is path-filtered it is an on-demand check, # not a required branch-protection check (see docs/gitflow.md). name: CI (python) on: pull_request: paths: - examples/dsh-agents-as-a-service/gateway/** - .github/workflows/ci-python.yaml workflow_dispatch: permissions: contents: read concurrency: group: ci-python-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: python: name: python runs-on: ubuntu-latest timeout-minutes: 20 defaults: run: working-directory: examples/dsh-agents-as-a-service/gateway steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Set up Python uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: "3.12" cache: pip cache-dependency-path: | examples/dsh-agents-as-a-service/gateway/requirements.txt examples/dsh-agents-as-a-service/gateway/requirements-dev.txt - name: Install dependencies run: | set -euo pipefail python -m pip install --upgrade pip # Both files are fully hash-pinned (uv pip compile --generate-hashes); # pip refuses to install anything not listed with a matching hash. pip install --require-hashes -r requirements.txt -r requirements-dev.txt - name: Lint run: | set -euo pipefail python -m ruff check . python -m ruff format --check . - name: Unit tests with coverage run: >- python -m pytest -q --cov=. --cov-report=xml:coverage.xml --cov-report=term --junitxml=junit.xml - name: Coverage summary run: | set -euo pipefail { echo "### Gateway test coverage" python -m coverage report } >> "$GITHUB_STEP_SUMMARY" - name: Upload test artefacts if: always() uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: gateway-test-results path: | examples/dsh-agents-as-a-service/gateway/junit.xml examples/dsh-agents-as-a-service/gateway/coverage.xml if-no-files-found: warn retention-days: 7