From b6e6f6d1fbd25d49ed9b0eafeb3945ec4a3b56f3 Mon Sep 17 00:00:00 2001 From: Hannu Varjoranta Date: Wed, 13 May 2026 10:21:21 +0300 Subject: [PATCH] Add CI workflow for lint and tests on every PR Three jobs on every push to main and every PR: - lint: ruff check on src + tests - unit: pytest tests/unit on Python 3.12/3.13/3.14 - integration: pytest tests/integration on the same matrix with a Postgres 16 service container Postgres exposes 5532 to match the local conftest probe, so no env override is needed. The existing release.yml stays as the ship workflow; this is the per-PR gate it anticipated (see comment in release.yml). --- .github/workflows/ci.yml | 76 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..82e0ceb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,76 @@ +name: CI + +# Runs on every push to main and every pull request. Three jobs: +# - lint: ruff on src + tests (single Python) +# - unit: pytest tests/unit across the full supported Python matrix +# - integration: pytest tests/integration across the matrix, with a +# Postgres 16 service container. SQLite always runs; the two +# Postgres adapters point at the service via ETCHDB_TEST_POSTGRES_DSN. + +on: + push: + branches: [main] + pull_request: + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 + with: + python-version: "3.14" + cache-dependency-glob: "pyproject.toml" + - run: uv sync --extra dev + - run: uv run ruff check src/etchdb tests + + unit: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.12", "3.13", "3.14"] + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 + with: + python-version: ${{ matrix.python-version }} + cache-dependency-glob: "pyproject.toml" + - run: uv sync --extra all --extra dev + - run: uv run pytest tests/unit -q + + integration: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.12", "3.13", "3.14"] + services: + postgres: + image: postgres:16 + env: + POSTGRES_USER: etchdb + POSTGRES_PASSWORD: etchdb-test-password + POSTGRES_DB: etchdb_test + ports: + # conftest probes localhost:5532 (matches local `make db-up`); + # expose the service on the same port so no env override is + # needed and the Postgres skip-guard sees the service. + - 5532:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 + with: + python-version: ${{ matrix.python-version }} + cache-dependency-glob: "pyproject.toml" + - run: uv sync --extra all --extra dev + - run: uv run pytest tests/integration -q