Skip to content

Merge remote-tracking branch 'origin/main' into feat/s4-nika-fs #45

Merge remote-tracking branch 'origin/main' into feat/s4-nika-fs

Merge remote-tracking branch 'origin/main' into feat/s4-nika-fs #45

Workflow file for this run

name: public-api
on:
pull_request:
paths:
- 'crates/**/src/**'
- 'crates/**/Cargo.toml'
- 'Cargo.toml'
# Also run on direct pushes to non-main branches. The Diamond rebuild commits
# straight to its feature branch, so a PR-only trigger let the committed
# baselines drift silently (caught only when a PR finally opened). main stays
# PR-gated, so it is excluded to avoid a redundant re-run after merge.
push:
branches-ignore: ['main']
paths:
- 'crates/**/src/**'
- 'crates/**/Cargo.toml'
- 'Cargo.toml'
permissions:
contents: read
jobs:
diff:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: install cargo-public-api
run: cargo install --locked cargo-public-api
- name: diff each covered lib crate
# The crate list is PROJECTED from the coverage floor (ADR-090: one SSOT,
# three consumers — this job, semver-checks.yml, and hygiene vector 38).
# Add a crate to scripts/ci/public-api-coverage-baseline.txt + commit its
# public-api.txt, and all three pick it up. No hardcoded parallel list.
# Reads a repo-tracked file only (no untrusted github.event.* input).
# nika-catalog-verify is binary-only (no lib target) so it is never floored.
# Foundation crates are publish=false (ADR-022); snapshots live in-repo to
# enforce Gate 12 (FCI) locally and in CI.
run: |
set -euo pipefail
fail=0
crates=$(grep -vE '^[[:space:]]*#' scripts/ci/public-api-coverage-baseline.txt | grep -E '^nika-')
for crate in $crates; do
actual=$(cargo public-api -p "$crate" --all-features --omit auto-trait-impls)
expected=$(cat "crates/$crate/public-api.txt")
if [ "$actual" != "$expected" ]; then
echo "::error::public API drift in $crate — regenerate snapshot or revert"
diff <(echo "$expected") <(echo "$actual") || true
fail=1
fi
done
exit $fail