diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..28d509f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,69 @@ +name: Release + +# Tag-triggered release: builds the wheel + sdist, re-runs the CI gates +# (tests, wheel-contents check, clean-venv smoke test), then attaches both +# artifacts to the GitHub release for the pushed v* tag. Nothing is +# published until a v* tag is pushed (see issue #7, plan step 5 — the tag +# itself is the owner's call). workflow_dispatch runs the same build and +# verification as a dry run without attaching anything. +on: + push: + tags: + - "v*" + workflow_dispatch: + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-24.04 + steps: + - name: Checkout code + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: Set up Python 3.12 + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + + - name: Test with pytest + run: pytest tests/ -q + + - name: Build wheel and sdist + run: | + pip install build + python -m build + + - name: Verify wheel contents + run: | + python - <<'PY' + import glob, zipfile + wheel = glob.glob("dist/*.whl")[0] + names = zipfile.ZipFile(wheel).namelist() + expected = ["hotspot_merge", "ownership_diff", "parse_semgrep", "parse_trivy", "risk_update", "scan_drift"] + missing = [m for m in expected if f"{m}.py" not in names] + assert not missing, f"wheel missing modules: {missing}; contents: {names}" + PY + + - name: Smoke test built wheel in clean environment + run: | + python -m venv "$RUNNER_TEMP/smoke" + "$RUNNER_TEMP/smoke/bin/pip" install dist/*.whl + cd "$RUNNER_TEMP" + "$RUNNER_TEMP/smoke/bin/python" -c "import hotspot_merge, ownership_diff, parse_semgrep, parse_trivy, risk_update, scan_drift" + "$RUNNER_TEMP/smoke/bin/python" -m hotspot_merge --help + + - name: Attach artifacts to the release + if: startsWith(github.ref, 'refs/tags/v') + uses: softprops/action-gh-release@8a0cd651e5b2365bd640854a3fa5dfc70e4875f3 # v3.0.4 + with: + files: | + dist/*.whl + dist/*.tar.gz + fail_on_unmatched_files: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 96d0d13..644737b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Release preparation for #7: `seed.yaml` production contract (package + `reverse-engine-recursive-run` 0.1.0, wheel/sdist artifacts, GitHub release + target), tag-triggered `.github/workflows/release.yml`, and + `make validate-release` one-command artifact validation + - Platinum Sprint: CI/CD workflow, standardized badge row, ADR documentation - Initial CHANGELOG following Keep a Changelog format diff --git a/Makefile b/Makefile index 0c16799..f3b3f33 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Makefile for Architecture Governance Toolkit -.PHONY: help build build-analysis-image run-analysis adr-new artifacts-dir sbom hotspots ownership drift risk full-analysis clean +.PHONY: help build build-analysis-image run-analysis adr-new artifacts-dir sbom hotspots ownership drift risk full-analysis validate-release clean ANALYSIS_IMAGE=analysis:local ARTIFACTS_DIR=artifacts @@ -9,6 +9,7 @@ help: @echo "Architecture Governance Toolkit - Available Commands:" @echo "" @echo " make build - Build Python wheel and sdist package artifacts" + @echo " make validate-release - Build wheel/sdist, install the wheel in a clean venv, import all six modules, run hotspot_merge --help" @echo " make artifacts-dir - Create artifacts directory" @echo " make build-analysis-image - Build Docker analysis image" @echo " make run-analysis - Run analysis in Docker" @@ -19,6 +20,19 @@ help: build: python3 -m build +# One-command release-artifact validation (issue #7, plan step 3): build the +# wheel + sdist, install the wheel in a throwaway venv, import all six +# modules, and run hotspot_merge --help. Mirrors the wheel-contents and +# smoke-test steps in .github/workflows/ci.yml and release.yml. +validate-release: build + rm -rf .validate-venv + python3 -m venv .validate-venv + .validate-venv/bin/pip install --quiet dist/*.whl + .validate-venv/bin/python -c "import hotspot_merge, ownership_diff, parse_semgrep, parse_trivy, risk_update, scan_drift" + .validate-venv/bin/python -m hotspot_merge --help + rm -rf .validate-venv + @echo "validate-release: OK — wheel installs clean and all six modules import" + artifacts-dir: mkdir -p $(ARTIFACTS_DIR)/sbom $(ARTIFACTS_DIR)/timeseries diff --git a/README.md b/README.md index 2d0fdcb..5c0afb4 100644 --- a/README.md +++ b/README.md @@ -372,6 +372,18 @@ make build CI builds these artifacts, inspects the wheel contents, smoke-tests it in a clean environment and uploads `dist/` as a CI artifact only. No release or publication has occurred. +Validate a release artifact in one command — build the wheel and sdist, +install the wheel in a clean virtual environment, import all six modules, +and run `hotspot_merge --help`: + +```bash +make validate-release +``` + +When a `v*` tag is pushed, `.github/workflows/release.yml` runs the same +build, wheel-contents, and smoke checks and attaches the wheel and sdist to +the GitHub release. No tag exists yet, so nothing has been published. + ### Option 1: Run Directly ```bash diff --git a/seed.yaml b/seed.yaml index e7ff98b..6ec476e 100644 --- a/seed.yaml +++ b/seed.yaml @@ -12,7 +12,7 @@ metadata: implementation_status: ACTIVE tier: standard promotion_status: CANDIDATE - last_validated: "2026-02-12" + last_validated: "2026-11-28" generated: "2026-02-17" sprint: "SENSORIA" language: python @@ -20,12 +20,23 @@ metadata: agents: - name: ci trigger: on_push - workflow: .github/workflows/ci-python.yml + workflow: .github/workflows/ci.yml description: "Continuous integration pipeline" produces: - type: theory description: "Epistemological frameworks, recursive engines, ontological systems" + - type: package + name: reverse-engine-recursive-run + version: "0.1.0" + release_line: "v0.1.0" + description: "Security analysis toolkit: hotspot detection, ownership drift, vulnerability parsing, and risk consolidation" + artifacts: + - dist/*.whl + - dist/*.tar.gz + install_command: "pip install reverse-engine-recursive-run" + publication_target: "GitHub release assets on a version tag (see .github/workflows/release.yml)" + release_status: "prepared — not yet published: no v* tag exists and no release carries assets. Tag + publish is the owner's call (issue #7, plan step 5); the stale empty draft v0.0.1 (2026-04-23, zero assets) still stands and is deleted or replaced only on that call." consumes: []