Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
aa4ce6c
feat: refuse a plan the configuration did not produce
AlexeyShalaev Sep 1, 2026
2da5a30
feat: one wiring, built once, handed back by name
AlexeyShalaev Sep 1, 2026
385424f
feat: a deployment's tables and their wiring, written down
AlexeyShalaev Sep 1, 2026
1a377d9
feat: a command line for the read-only half
AlexeyShalaev Sep 1, 2026
58856f1
chore: lock the cli extra and the yaml test dependency
AlexeyShalaev Sep 1, 2026
0690659
feat: apply, and the artifact between plan and apply
AlexeyShalaev Sep 1, 2026
0e0fe86
feat: an image for stacks with no Python in them
AlexeyShalaev Sep 1, 2026
5bb3bef
feat: a command at every lifecycle moment, for teams that write no Py…
AlexeyShalaev Sep 1, 2026
f349b82
feat: the same run, as numbers a node_exporter can pick up
AlexeyShalaev Sep 1, 2026
34cbcf1
feat: a plan says what it will lock, on paper as well as in memory
AlexeyShalaev Sep 1, 2026
20e12a5
feat: a block of Python where a command would go
AlexeyShalaev Sep 1, 2026
648260e
refactor: the command line on typer, and a usage error that is not drift
AlexeyShalaev Sep 2, 2026
8925231
test: plan against the clock the run was made on
AlexeyShalaev Sep 2, 2026
0204f0d
feat: a stop signal cancels the run instead of killing it
AlexeyShalaev Sep 2, 2026
e4239be
docs: every way to run it, and a DSN from a secret file
AlexeyShalaev Sep 2, 2026
8aaa513
docs: examples that are tested, and a schema for the editor
AlexeyShalaev Sep 2, 2026
b02df33
fix: import PyYAML where it is needed, so the missing-extra branch is…
AlexeyShalaev Sep 2, 2026
a173a5b
chore: pin the Trivy action to a tag that exists
AlexeyShalaev Sep 2, 2026
afa51f3
fix: leave pip out of the runtime image
AlexeyShalaev Sep 2, 2026
dcd93a3
fix: an image with no pip in it at all, and tests for the corners
AlexeyShalaev Sep 2, 2026
e0914c7
fix: the line continuations the runtime stage's rm lost
AlexeyShalaev Sep 2, 2026
bbac5eb
Merge remote-tracking branch 'origin/master' into feat/cli-and-container
AlexeyShalaev Sep 2, 2026
e005587
feat: a distroless image on Python 3.14, and the two flags a shell us…
AlexeyShalaev Sep 2, 2026
1a55afc
ci: every platform, both ends of the clock, and the lowest versions t…
AlexeyShalaev Sep 2, 2026
fe1601b
ci: what the first run of the new checks needed
AlexeyShalaev Sep 2, 2026
ed689c4
ci: what the second run of the new checks needed
AlexeyShalaev Sep 2, 2026
de7cdea
Merge remote-tracking branch 'origin/master' into feat/cli-and-container
AlexeyShalaev Sep 2, 2026
648f0f9
docs: file the notes under 1.2.0, which is where they ship
AlexeyShalaev Sep 2, 2026
ec7290b
fix: name the path when --write or --save cannot write it
AlexeyShalaev Sep 2, 2026
f28fbbf
test: the image end to end, as a container against a database of its own
AlexeyShalaev Sep 2, 2026
c201b8c
ci: the derived image a test builds is built by the daemon's own builder
AlexeyShalaev Sep 2, 2026
08d9f5d
ci: the published image, pulled back and verified
AlexeyShalaev Sep 2, 2026
ee53785
test: the guides' YAML blocks, and the manifests through kubeconform
AlexeyShalaev Sep 2, 2026
75ff17e
test: keep freezegun out of testcontainers, which opens a socket when…
AlexeyShalaev Sep 2, 2026
6d7715f
ci: the image on each architecture first, then PyPI, then the tags
AlexeyShalaev Sep 2, 2026
8e5333b
fix: what the review found in the command line and the document
AlexeyShalaev Sep 2, 2026
5009656
docs: the image as it is, the counts as they are, and a reference pag…
AlexeyShalaev Sep 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Everything the build does not need: the image is measured, and a build
# context that carries the test suite and a virtualenv is how it stops being.
*
!pyproject.toml
!uv.lock
!README.md
!LICENSE
!CHANGELOG.md
!pg_partsmith/**
pg_partsmith/**/__pycache__/
35 changes: 23 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
# What moves under this project without a commit of its own: the base images,
# the actions the workflows run, and the lock file. Each gets one pull request
# a week, so a security rebuild of the image is a merge and a release rather
# than a hunt for which digest to bump.
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
- package-ecosystem: docker
directory: /
schedule:
interval: "weekly"
day: "monday"
interval: weekly
labels: [dependencies, image]

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
labels: [dependencies, ci]
groups:
dev-dependencies:
dependency-type: "development"
open-pull-requests-limit: 5
actions:
patterns: ["*"]

- package-ecosystem: "github-actions"
directory: "/"
- package-ecosystem: uv
directory: /
schedule:
interval: "weekly"
day: "monday"
open-pull-requests-limit: 5
interval: weekly
labels: [dependencies]
groups:
dev:
dependency-type: development
269 changes: 255 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,68 +6,309 @@ on:
pull_request:
branches: [master]

permissions:
contents: read

# A push to a pull request while the previous run is still going restarts it;
# the old one is answering a question nobody is asking any more. A run on
# master is left to finish: every commit there should end with a verdict.
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
lint:
name: Lint & type check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v7
- run: uv sync --group dev
with:
enable-cache: true
cache-dependency-glob: uv.lock
# A lock file out of step with pyproject.toml fails here, in one line,
# rather than in an image build three jobs away.
- run: uv lock --check
- run: uv sync --frozen --group dev
- run: uv run ruff check
- run: uv run ruff format --check
- run: uv run mypy pg_partsmith
- name: The workflows parse, and their shell steps pass shellcheck
run: docker run --rm -v "$PWD:/repo" -w /repo rhysd/actionlint:1.7.12 -color
- name: Dockerfile lint
run: docker run --rm -v "$PWD:/repo" -w /repo hadolint/hadolint:v2.15.1 hadolint Dockerfile
# The Job and CronJob the running guide shows are what a team pastes into
# a cluster: kubeconform checks them against the API schema, strictly, so
# a misspelt field fails here and not at kubectl apply.
- name: The Kubernetes manifests in the guide validate
run: |
uv run python scripts/k8s_manifests.py docs/guide/running.md manifests
docker run --rm -v "$PWD/manifests:/manifests:ro" ghcr.io/yannh/kubeconform:v0.8.0 -strict -summary /manifests

test-unit:
name: Unit tests (Python ${{ matrix.python-version }})
# Every direct dependency at the lowest version pyproject.toml admits, on
# the oldest Python. The bounds a library declares are a promise, and this
# is the only job that tests it; everything else runs on the lock file.
test-lowest:
name: Lowest declared dependencies (Python 3.11)
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v7
with:
python-version: "3.11"
enable-cache: true
cache-dependency-glob: uv.lock
cache-suffix: lowest
- run: uv sync --resolution lowest-direct --no-default-groups --group test --extra cli --extra pydantic-settings
# An old floor on a new transitive dependency deprecates things between
# the two; that is theirs to fail on, not this library's.
- run: uv run --no-sync pytest -W default::DeprecationWarning

test-unit:
name: Unit tests (${{ matrix.os }}, Python ${{ matrix.python-version }})
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
os: [ubuntu-latest]
python-version: ["3.11", "3.12", "3.13", "3.14"]
# The other platforms at both ends of the range: the CLI runs
# subprocesses and handles signals differently on each of them.
include:
- { os: windows-latest, python-version: "3.11" }
- { os: windows-latest, python-version: "3.14" }
- { os: macos-latest, python-version: "3.11" }
- { os: macos-latest, python-version: "3.14" }
- { os: ubuntu-24.04-arm, python-version: "3.14" }
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
- run: uv sync --group dev --extra pydantic-settings
enable-cache: true
cache-dependency-glob: uv.lock
- run: uv sync --frozen --group dev --extra pydantic-settings
- run: uv run pytest -m unit --cov=pg_partsmith --cov-report=xml
- uses: codecov/codecov-action@v7
if: matrix.python-version == '3.11'
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
continue-on-error: true

test-integration:
name: Integration tests (PostgreSQL ${{ matrix.postgres }}) & coverage gate
# A partition boundary is a moment. The suite runs where the clock is
# furthest from UTC in either direction, so a naive datetime has nowhere
# to hide.
test-unit-far-from-utc:
name: Unit tests (TZ=${{ matrix.tz }})
needs: lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
postgres: ["15-alpine", "16-alpine", "17-alpine"]
tz: [Pacific/Kiritimati, Etc/GMT+12]
env:
TZ: ${{ matrix.tz }}
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v7
with:
python-version: "3.14"
enable-cache: true
cache-dependency-glob: uv.lock
- run: uv sync --frozen --group dev --extra pydantic-settings
- run: uv run pytest -m unit

test-integration:
name: Integration tests (${{ matrix.name }})
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { name: PostgreSQL 15, os: ubuntu-latest, image: postgres:15-alpine }
- { name: PostgreSQL 16, os: ubuntu-latest, image: postgres:16-alpine }
- { name: PostgreSQL 17, os: ubuntu-latest, image: postgres:17-alpine }
- { name: PostgreSQL 18, os: ubuntu-latest, image: postgres:18-alpine }
- { name: PostgreSQL 17 on arm64, os: ubuntu-24.04-arm, image: postgres:17-alpine }
# The server's clock at UTC+14 and the client's at UTC-12: a bound
# written as a date must mean the same day on both sides.
- name: PostgreSQL 17, server at UTC+14, client at UTC-12
os: ubuntu-latest
image: postgres:17-alpine
server-tz: Pacific/Kiritimati
client-tz: Etc/GMT+12
# No Docker on these runners; the action brings a server of its own,
# and the tests that reach into the container skip.
- { name: PostgreSQL 17 on Windows, os: windows-latest, server: "17" }
- { name: PostgreSQL 17 on macOS, os: macos-latest, server: "17" }
env:
PG_PARTSMITH_TEST_PG_IMAGE: postgres:${{ matrix.postgres }}
PG_PARTSMITH_TEST_PG_IMAGE: ${{ matrix.image }}
PG_PARTSMITH_TEST_PG_TZ: ${{ matrix.server-tz }}
# An unset matrix value is an empty string here, and an empty TZ is not
# "unset" to everything that reads it; the default is spelled out.
TZ: ${{ matrix.client-tz || 'UTC' }}
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v7
- run: uv sync --group dev --extra pydantic-settings
with:
enable-cache: true
cache-dependency-glob: uv.lock
- run: uv sync --frozen --group dev --extra pydantic-settings
- name: A PostgreSQL server of the runner's own
if: matrix.server
id: postgres
uses: ikalnytskyi/action-setup-postgres@v8
with:
postgres-version: ${{ matrix.server }}
username: partsmith
password: partsmith
database: partsmith
# Both suites together: the gate is on the whole library, not on one half of it.
- run: uv run pytest --cov=pg_partsmith --cov-report=xml --cov-fail-under=90
- name: Both suites, and the coverage gate
if: ${{ !matrix.server }}
run: uv run pytest --cov=pg_partsmith --cov-report=xml --cov-fail-under=90
- name: The integration suite against the runner's server
if: matrix.server
run: uv run pytest -m integration
env:
PG_PARTSMITH_TEST_DSN: ${{ steps.postgres.outputs.connection-uri }}
- uses: codecov/codecov-action@v7
if: matrix.postgres == '17-alpine'
if: matrix.name == 'PostgreSQL 17'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
continue-on-error: true

# What PyPI will get, installed from the wheel alone on each platform: the
# entry point, the package data, the extra's dependencies, and the whole
# stack up to the socket.
package:
name: Package (${{ matrix.os }})
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v7
with:
python-version: "3.14"
- run: uv build
- name: The wheel and the sdist pass the checks PyPI and a reader would make
shell: bash
run: |
uvx twine check --strict dist/*
uvx check-wheel-contents dist/*.whl
- name: Installed from the wheel alone, the command runs here
shell: bash
run: |
uv venv --python 3.14 smoke
if [ "$RUNNER_OS" = Windows ]; then BIN=smoke/Scripts; else BIN=smoke/bin; fi
WHEEL=$("$BIN/python" -c 'import pathlib, sys; print(pathlib.Path(sys.argv[1]).resolve().as_uri())' dist/*.whl)
# The environment directory, not its interpreter: uv resolves that the
# same way on every platform, and Windows spells the interpreter differently.
uv pip install --python smoke "pg-partsmith[cli] @ $WHEEL"
"$BIN/pg-partsmith" --version
"$BIN/pg-partsmith" schema | "$BIN/python" -c 'import json, sys; json.load(sys.stdin)'
# Everything short of a server: the document parses, the driver loads,
# the connection is refused, and that is exit 5 -- not a traceback.
set +e
PYTHONIOENCODING=ascii "$BIN/pg-partsmith" plan -c examples/partitions.minimal.yaml --dsn postgresql://nobody:nobody@127.0.0.1:1/none
rc=$?
set -e
test "$rc" -eq 5
- name: Without the extra, the command on PATH says what to install
shell: bash
run: |
uv venv --python 3.14 bare
if [ "$RUNNER_OS" = Windows ]; then BIN=bare/Scripts; else BIN=bare/bin; fi
WHEEL=$("$BIN/python" -c 'import pathlib, sys; print(pathlib.Path(sys.argv[1]).resolve().as_uri())' dist/*.whl)
uv pip install --python bare "pg-partsmith @ $WHEEL"
set +e
"$BIN/pg-partsmith" --version 2> bare.err
rc=$?
set -e
test "$rc" -eq 64
grep -q 'pip install "pg-partsmith\[cli\]"' bare.err

image:
name: Container image (${{ matrix.os }})
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# The release builds both architectures; both are built and run here.
os: [ubuntu-latest, ubuntu-24.04-arm]
steps:
- uses: actions/checkout@v7
- uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v6
with:
context: .
load: true
tags: pg-partsmith:ci
build-args: VERSION=ci
cache-from: type=gha,scope=${{ runner.arch }}
cache-to: type=gha,mode=max,scope=${{ runner.arch }}
# Size is the first thing a team evaluating this reads, so a regression in
# it is a build failure and not a note in a release.
- name: Size budget
run: |
BYTES=$(docker image inspect pg-partsmith:ci -f '{{.Size}}')
MB=$((BYTES / 1024 / 1024))
echo "image is ${MB} MB (budget ${IMAGE_SIZE_BUDGET_MB} MB)"
test "$MB" -le "$IMAGE_SIZE_BUDGET_MB"
env:
IMAGE_SIZE_BUDGET_MB: 160
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: uv.lock
- run: uv sync --frozen --no-default-groups --group test --extra pydantic-settings
# The image as a container, against a database on a network of its own,
# run the way the guides say to: read-only, no capabilities, the
# document mounted, the commands the guides show, the codes they promise.
- name: End to end
run: uv run --no-sync pytest -m e2e
env:
PG_PARTSMITH_E2E_IMAGE: pg-partsmith:ci
# One test builds an image FROM pg-partsmith:ci, which was loaded into
# the daemon; the container builder set up above keeps a store of its
# own and would go to the registry for it. The daemon's builder sees it.
BUILDX_BUILDER: default
- name: Scan
uses: aquasecurity/trivy-action@v0.36.0
with:
image-ref: pg-partsmith:ci
severity: CRITICAL,HIGH
ignore-unfixed: true
exit-code: "1"

# A dependency a pull request adds or bumps is looked up before it is
# merged: a known vulnerability or an incompatible license fails the check.
dependency-review:
name: New dependencies carry no known vulnerability
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/dependency-review-action@v5
with:
fail-on-severity: high

# Sentinel job — use this as the single required status check in branch protection.
all-checks-passed:
name: All checks passed
if: always()
needs: [lint, test-unit, test-integration]
needs: [lint, test-lowest, test-unit, test-unit-far-from-utc, test-integration, package, image, dependency-review]
runs-on: ubuntu-latest
steps:
- name: Check all jobs succeeded
Expand Down
Loading
Loading