b2f498cac5
Split the self-hosted KVM runner setup out of this branch so main's CI doesn't require a runner that isn't registered yet. The `coverage` job runs on ubuntu-latest again and reports combined coverage informationally — the hard diff-coverage gate (which needs the firecracker integration suite, hence /dev/kvm + the provisioned pool) is deferred and moves to a separate PR. The unit-coverage tests added alongside the gate stay. See PRD 0069 / #348; the runner + gate re-land on the ci-runner branch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WBMWTEtQdJ4W5UrWuLHCck
101 lines
3.1 KiB
YAML
101 lines
3.1 KiB
YAML
# Run the project's test suite on every PR push and on push to main.
|
|
#
|
|
# The suite uses stdlib `unittest` discovery — no external Python
|
|
# dependencies are required to execute it. Tests are split by directory:
|
|
#
|
|
# tests/unit/ — pure unit tests; always run
|
|
# tests/integration/ — need a reachable Docker daemon; skip cleanly
|
|
# (via tests/_docker.py:skip_unless_docker) when
|
|
# Docker isn't available on the runner
|
|
# tests/canaries/ — upstream regression canaries; run on a separate
|
|
# schedule (see canaries.yml), not here
|
|
#
|
|
# This workflow assumes the Gitea Actions runner exposes the host Docker
|
|
# socket to the job container so `docker` commands inside the job can
|
|
# reach the daemon. If that's not yet configured on the runner the
|
|
# integration tests will skip rather than fail.
|
|
|
|
name: test
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- '**.py'
|
|
pull_request:
|
|
paths:
|
|
- '**.py'
|
|
|
|
jobs:
|
|
unit:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install dev requirements
|
|
run: python3 -m pip install -r requirements-dev.txt
|
|
|
|
- name: Run unit tests
|
|
run: python3 -m coverage run -m unittest discover -t . -s tests/unit -v
|
|
|
|
- name: Report unit coverage
|
|
run: python3 -m coverage report -m
|
|
|
|
integration:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Show environment
|
|
run: |
|
|
python3 --version
|
|
if command -v docker >/dev/null 2>&1; then
|
|
docker version || true
|
|
else
|
|
echo "docker not on PATH — integration tests will skip"
|
|
fi
|
|
|
|
- name: Run integration tests
|
|
run: python3 -m unittest discover -t . -s tests/integration -v
|
|
|
|
# Combined unit+integration coverage report (informational). See
|
|
# docs/decisions/0004-coverage-policy.md.
|
|
#
|
|
# The hard diff-coverage gate (changed lines >= 90%) is DEFERRED: the
|
|
# Firecracker backend's VM/SSH orchestration is covered by the integration
|
|
# suite, which needs /dev/kvm + the provisioned TAP/nft pool — a
|
|
# container-based runner skips it and those lines read uncovered, so the
|
|
# gate can't pass here. Re-enabling it on a self-hosted KVM runner is
|
|
# tracked separately (see PRD 0069 / #348 and the ci-runner branch).
|
|
coverage:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install dev requirements
|
|
run: python3 -m pip install -r requirements-dev.txt
|
|
|
|
- name: Combined coverage report (unit + integration)
|
|
run: PYTHON=python3 bash scripts/coverage.sh critical
|