99 lines
2.7 KiB
YAML
99 lines
2.7 KiB
YAML
# CI: lint + typecheck + unit tests on every branch / PR.
|
|
#
|
|
# Self-contained on purpose: python:3.14-trixie has git built in, so no
|
|
# node/actions-checkout dependency; uv comes from PyPI (both reachable from
|
|
# the runner network). Mirrors the Makefile lint/test-unit targets.
|
|
|
|
name: ci
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
branches: [master]
|
|
|
|
concurrency:
|
|
group: ci-${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint & typecheck
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup uv
|
|
uses: astral-sh/setup-uv@v8.3.2
|
|
with:
|
|
enable-cache: true
|
|
cache-dependency-glob: uv.lock
|
|
|
|
- name: Install Python
|
|
run: uv python install
|
|
|
|
- name: Sync dev dependencies
|
|
run: uv sync --group dev --frozen
|
|
|
|
- name: Ruff check
|
|
run: uv run ruff check src tests
|
|
|
|
- name: Ruff format check
|
|
run: uv run ruff format --check src tests
|
|
|
|
- name: Ty type check
|
|
run: uv run ty check src
|
|
|
|
test-unit:
|
|
name: Unit tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup uv
|
|
uses: astral-sh/setup-uv@v8.3.2
|
|
with:
|
|
enable-cache: true
|
|
cache-dependency-glob: uv.lock
|
|
|
|
- name: Install Python
|
|
run: uv python install
|
|
|
|
- name: Sync dev dependencies
|
|
run: uv sync --group dev --frozen
|
|
|
|
- name: Run unit tests with coverage
|
|
run: uv run pytest --cov=src/contract_check --cov-branch --cov-report=term-missing --cov-fail-under=50 -m "not integration" tests/unit
|
|
|
|
# Integration tests.
|
|
# test-integration:
|
|
# name: Integration tests
|
|
# runs-on: ubuntu-latest
|
|
# steps:
|
|
# - uses: actions/checkout@v4
|
|
|
|
# - name: Setup uv
|
|
# uses: astral-sh/setup-uv@v8.3.2
|
|
# with:
|
|
# enable-cache: true
|
|
# cache-dependency-glob: uv.lock
|
|
|
|
# - name: Install Python
|
|
# run: uv python install
|
|
|
|
# - name: Sync dev dependencies
|
|
# run: uv sync --group dev --frozen
|
|
|
|
# # No --wait: minio-init-test is a one-shot container that exits (0) after
|
|
# # creating the bucket, and --wait treats any exited container as failure.
|
|
# # Health polling is done by the `infra` fixture in
|
|
# # tests/integration/conftest.py; this step just pre-pulls the images.
|
|
# - name: Start test infrastructure (postgres/redis/rabbitmq/minio)
|
|
# run: docker compose -p contract-check-test -f docker-compose.test.yml up -d
|
|
|
|
# - name: Run integration tests
|
|
# run: uv run pytest -m integration
|
|
|
|
# - name: Teardown infrastructure
|
|
# if: always()
|
|
# run: docker compose -p contract-check-test -f docker-compose.test.yml down -v
|