From 08802adf14210070ccb440679dbace74533c1529 Mon Sep 17 00:00:00 2001 From: Ruslan Strazhnyk Date: Sun, 22 Nov 2026 10:45:54 +0100 Subject: [PATCH] Add PR CI, tag release workflow and repository hygiene; version 0.2.0-rc.2 CI runs the README development checks (fmt, clippy -D warnings, cargo test, ruff, adapter tests) on every pull request and on main. Version tags on main run those checks, build static linux-x86_64 musl and darwin-arm64 binaries in the workflow, and publish them with SHA256SUMS and a build.json that names the producing run. Signed attestations need a public repo or Enterprise Cloud and are not produced. Add CHANGELOG, SECURITY and a proprietary LICENSE. --- .github/workflows/ci.yml | 55 +++++++++++ .github/workflows/release.yml | 171 ++++++++++++++++++++++++++++++++++ CHANGELOG.md | 38 ++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- LICENSE | 5 + README.md | 38 ++++---- SECURITY.md | 17 ++++ 8 files changed, 309 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 SECURITY.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..84bc840 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: CI + +# The checks every change previously ran by hand (README "Development"). +# The release workflow calls this one, so a tag can never ship code that +# would fail here. + +on: + pull_request: + push: + branches: [main] + workflow_call: + +permissions: + contents: read + +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +env: + CARGO_TERM_COLOR: always + # Keep in step with the toolchain recorded by the release workflow. + RUST_TOOLCHAIN: 1.94.1 + +jobs: + checks: + name: checks + runs-on: ubuntu-24.04 + timeout-minutes: 20 + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + - name: Install Rust toolchain + run: | + rustup toolchain install "$RUST_TOOLCHAIN" --profile minimal --component rustfmt,clippy + rustup default "$RUST_TOOLCHAIN" + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: "3.12" + - name: Install adapter tooling + run: python -m pip install --disable-pip-version-check -r adapter/requirements-dev.txt + - name: cargo fmt + run: cargo fmt --check + - name: cargo clippy + run: cargo clippy --locked --all-targets -- -D warnings + - name: cargo test + # Also builds target/debug/panthera, which the adapter end-to-end tests run. + run: cargo test --locked + - name: ruff + run: | + python -m ruff check adapter examples + python -m ruff format --check adapter examples + - name: adapter tests + run: python -m unittest discover -s adapter -p 'test_*.py' -v diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4e836c1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,171 @@ +name: Release + +# A version tag on main produces the only binaries consumers may pin. The +# assets are built and uploaded by this workflow run, never by hand, and +# build.json records which run produced them. +# +# Signed artifact attestations (actions/attest-build-provenance) require a +# public repository or GitHub Enterprise Cloud; this private repository is on +# the Team plan. Consumers verify instead that each asset was uploaded by +# github-actions[bot], that its SHA-256 matches SHA256SUMS and build.json, and +# that build.json names this workflow, the tag and the source commit. + +on: + push: + tags: ["v*"] + +permissions: + contents: read + +concurrency: + group: release-${{ github.ref }} + cancel-in-progress: false + +env: + CARGO_TERM_COLOR: always + RUST_TOOLCHAIN: 1.94.1 + # rust:1.94.1-alpine3.22, pinned by digest. Static musl, as for earlier releases. + LINUX_BUILDER: rust@sha256:797631f9efd6957d0013f200e410478c380907eee3b469c6f80d89022df28bc7 + +jobs: + verify: + name: verify tag + runs-on: ubuntu-24.04 + timeout-minutes: 5 + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + persist-credentials: false + - name: Tag must match Cargo.toml and point into main + id: version + env: + TAG: ${{ github.ref_name }} + run: | + version=$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -1) + test "v$version" = "$TAG" || { echo "tag $TAG does not match Cargo.toml version $version"; exit 1; } + git fetch --no-tags origin main + git merge-base --is-ancestor "$GITHUB_SHA" origin/main || { echo "tagged commit is not on main"; exit 1; } + grep -q "^## \[$version\]" CHANGELOG.md || { echo "CHANGELOG.md has no [$version] section"; exit 1; } + echo "version=$version" >> "$GITHUB_OUTPUT" + + checks: + needs: verify + uses: ./.github/workflows/ci.yml + + build-linux: + needs: checks + runs-on: ubuntu-24.04 + timeout-minutes: 20 + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + - name: Build static x86_64 musl binary + run: | + docker run --rm --platform linux/amd64 -v "$PWD:/src" -w /src "$LINUX_BUILDER" \ + sh -ec 'apk add --no-cache musl-dev >/dev/null && cargo build --release --locked && ./target/release/panthera --version' + mkdir -p dist + cp target/release/panthera dist/panthera-linux-x86_64 + file dist/panthera-linux-x86_64 | grep -q 'statically linked' + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: panthera-linux-x86_64 + path: dist/panthera-linux-x86_64 + if-no-files-found: error + retention-days: 7 + + build-macos: + needs: checks + runs-on: macos-14 + timeout-minutes: 20 + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + - name: Build arm64 binary + run: | + rustup toolchain install "$RUST_TOOLCHAIN" --profile minimal + rustup default "$RUST_TOOLCHAIN" + test "$(uname -m)" = arm64 + cargo build --release --locked + ./target/release/panthera --version + mkdir -p dist + cp target/release/panthera dist/panthera-darwin-arm64 + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: panthera-darwin-arm64 + path: dist/panthera-darwin-arm64 + if-no-files-found: error + retention-days: 7 + + publish: + needs: [verify, build-linux, build-macos] + runs-on: ubuntu-24.04 + timeout-minutes: 10 + permissions: + contents: write + steps: + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + path: dist + merge-multiple: true + - name: Write SHA256SUMS and build.json + env: + TAG: ${{ github.ref_name }} + REPOSITORY: ${{ github.repository }} + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + RUN_ID: ${{ github.run_id }} + RUN_ATTEMPT: ${{ github.run_attempt }} + WORKFLOW_REF: ${{ github.workflow_ref }} + run: | + cd dist + chmod 0755 panthera-* + sha256sum panthera-darwin-arm64 panthera-linux-x86_64 > SHA256SUMS + python3 - <<'EOF' + import hashlib, json, os + def sha(name): + return hashlib.sha256(open(name, "rb").read()).hexdigest() + build = { + "schema": 2, + "repository": os.environ["REPOSITORY"], + "tag": os.environ["TAG"], + "source_commit": os.environ["GITHUB_SHA"], + "assets": { + "linux-x86_64": {"name": "panthera-linux-x86_64", "sha256": sha("panthera-linux-x86_64")}, + "darwin-arm64": {"name": "panthera-darwin-arm64", "sha256": sha("panthera-darwin-arm64")}, + }, + "builder": { + "workflow_ref": os.environ["WORKFLOW_REF"], + "run_id": int(os.environ["RUN_ID"]), + "run_attempt": int(os.environ["RUN_ATTEMPT"]), + "run_url": os.environ["RUN_URL"], + "rust_toolchain": os.environ["RUST_TOOLCHAIN"], + "linux_builder": os.environ["LINUX_BUILDER"], + "linux_builder_prerequisite": "musl-dev (Alpine mirror, not snapshotted)", + "macos_runner": "macos-14", + }, + "attestation": "unavailable: private repository on the GitHub Team plan", + } + json.dump(build, open("build.json", "w"), indent=2, sort_keys=True) + open("build.json", "a").write("\n") + EOF + cat SHA256SUMS + - name: Create release and upload assets + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ github.ref_name }} + VERSION: ${{ needs.verify.outputs.version }} + run: | + flags="" + case "$VERSION" in *-*) flags="--prerelease" ;; esac + # Never replace assets of an existing release: a tag is built once. + if gh release view "$TAG" -R "$GITHUB_REPOSITORY" >/dev/null 2>&1; then + echo "release $TAG already exists; refusing to overwrite its assets"; exit 1 + fi + gh release create "$TAG" -R "$GITHUB_REPOSITORY" --verify-tag $flags \ + --title "Panthera $TAG" \ + --notes "Built by $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID. See CHANGELOG.md and build.json." \ + dist/panthera-linux-x86_64 dist/panthera-darwin-arm64 dist/SHA256SUMS dist/build.json diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..53ea7a4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,38 @@ +# Changelog + +All notable changes to Panthera. Versions follow the tags whose binaries +consumers pin; see `build.json` in each release for the producing workflow run. + +## [Unreleased] + +## [0.2.0-rc.2] + +First release built and uploaded by the release workflow rather than by hand. + +### Added +- CI on every pull request and on `main`: `cargo fmt`, `clippy -D warnings`, + `cargo test`, ruff and the adapter test suite. +- Tag-triggered release workflow: static x86_64 musl and macOS arm64 builds, + `SHA256SUMS`, and a schema 2 `build.json` naming the workflow run and toolchain. +- Opt-in per-file input dependencies, static import closure and file-open + observation in the standalone adapter; experimental fixture-consumer tracking + (PR #4). +- Reproducible qualification campaigns with seeded strata and cost accounting, + and a frozen historical replay pilot (PR #4). +- How-it-works page and approval-gated Pages publication (PR #3). + +### Fixed +- Cached-fixture dependencies are attributed to every consumer, not only the + first test that ran the fixture (PR #4). +- Suite-local `pytest_generate_tests` changes, primed dynamic fixtures, Git + executable modes and incomplete base collections in historical replay (PR #4). + +### Unchanged +- The planner request schema (`shadow-plan`, schema 1) and its conservative + expansion rules. No test skipping is enabled. + +## [0.2.0-rc.1] - 2026-11-20 + +Private observation candidate, built manually. Deterministic fault +qualification campaigns (PR #2) and batched shadow plans with +security-inclusive selection (PR #1). diff --git a/Cargo.lock b/Cargo.lock index 2f1d5ee..96f0017 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -76,7 +76,7 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" [[package]] name = "panthera" -version = "0.2.0-rc.1" +version = "0.2.0-rc.2" dependencies = [ "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 8a68781..944aab9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "panthera" -version = "0.2.0-rc.1" +version = "0.2.0-rc.2" edition = "2024" publish = false diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4502817 --- /dev/null +++ b/LICENSE @@ -0,0 +1,5 @@ +Copyright (c) 2026 Quality-Max. All rights reserved. + +This software is proprietary and confidential. No license is granted to use, +copy, modify, distribute or create derivative works of it, in whole or in +part, except as expressly authorized in writing by Quality-Max. diff --git a/README.md b/README.md index 845561b..5ca8757 100644 --- a/README.md +++ b/README.md @@ -330,29 +330,33 @@ cargo clippy --locked --all-targets -- -D warnings ``` Run `cargo test` before adapter tests: their end-to-end checks use the debug binary. -The project is a private prototype; no public distribution license has been selected. +The project is a private prototype; see [LICENSE](LICENSE). CI runs these same checks on every +pull request (`.github/workflows/ci.yml`). ## Pinned candidate builds -`v0.2.0-rc.1` is a private prerelease for observation, with Linux x86-64 -(static musl) and macOS ARM64 assets. `panthera --version` identifies the build; -`SHA256SUMS` and `build.json` record artifact hashes and the source commit. -Consumers must pin both the release and the SHA-256 of their platform asset. -The release does not enable CI test skipping or claim selected/full equivalence. - -Build macOS locally with `cargo build --release --locked`. The Linux build uses -`rust:1.90.0-alpine3.22` at digest -`sha256:b4b54b176a74db7e5c68fdfe6029be39a02ccbcfe72b6e5a3e18e2c61b57ae26`, -with `musl-dev` installed, `--platform linux/amd64`, and -`CARGO_TARGET_DIR=/source/target/linux-amd64`. Run `cargo build --release --locked` -and `cargo test --locked` inside that builder. The builder image is pinned; -Alpine package mirrors are not snapshotted, so these are identified artifacts -rather than a claim of byte-for-byte reproducible builds. +Releases are produced only by `.github/workflows/release.yml`, triggered by a +`v*` tag on `main` whose version matches `Cargo.toml` and has a `CHANGELOG.md` +section. It runs the CI checks, builds a static x86-64 musl binary in +`rust:1.94.1-alpine3.22` (pinned by digest, `--platform linux/amd64`) and a +macOS arm64 binary on `macos-14`, then uploads them with `SHA256SUMS` and a +schema 2 `build.json` naming the workflow run, toolchain and builder. Existing +releases are never overwritten. `panthera --version` identifies the build. + +Consumers must pin both the release and the SHA-256 of their platform asset, +and should check that the asset uploader is `github-actions[bot]` and that +`build.json` names this workflow and the tagged commit. Signed artifact +attestations need a public repository or GitHub Enterprise Cloud, so none are +produced. Alpine package mirrors are not snapshotted: these are identified +artifacts, not byte-for-byte reproducible builds. + +`v0.2.0-rc.1` was built manually before this workflow existed. Releases do not +enable CI test skipping or claim selected/full equivalence. ## Dependency inputs and roadmap -The following adapter features are unreleased development work; they are not -included in the published `v0.2.0-rc.1` artifact. +The following adapter features ship from `v0.2.0-rc.2`; they were not included +in the manually built `v0.2.0-rc.1` artifact. See [the roadmap](docs/ROADMAP.md) for evidence gates, CI economics, additional languages, production fault contracts and the separate 9lives integration. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..fbed5e9 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,17 @@ +# Security + +Panthera is a private Quality-Max project. Report suspected vulnerabilities +privately to the maintainers, not in issues, pull requests or chat: use a +private GitHub security advisory on this repository. + +## Scope and trust model + +- Panthera executes the test suites it is pointed at. Repository code, scope + files and evidence are trusted input; Panthera is not a sandbox. +- Baselines and receipts are trusted CI evidence, not signed attestations. + Content hashes detect change; they do not authenticate an author. +- Release binaries are built and uploaded only by `.github/workflows/release.yml`. + Pin both the release tag and the SHA-256 of your platform asset, and verify + the asset was uploaded by `github-actions[bot]`. Never pin a moving ref. +- Never put credentials in scope files, test IDs, receipts or manifests. + Receipts deliberately omit captured output and exception text.