diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17324b1d..b6b5dc20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,7 +75,8 @@ jobs: - name: Lint - auth-protocol boundary (#1212 anti-regression) run: bash scripts/lint-auth-signals.sh - # Linux-only for PR feedback. Full platform matrix (incl. macOS + Windows) runs post-merge in build-release.yml. + # Python test + binary build remain Linux-only for PR feedback. Full packaged + # platform coverage (incl. macOS + Windows) runs post-merge in build-release.yml. # Combines unit tests + binary build into a single job to eliminate runner re-provisioning overhead. build-and-test: name: Build & Test (Linux) @@ -128,6 +129,31 @@ jobs: retention-days: 30 if-no-files-found: error + go-build-test: + name: Go Build & Test (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + permissions: + contents: read + strategy: + fail-fast: false + matrix: + os: [ubuntu-24.04, macos-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Run Go tests + run: go test ./... + + - name: Run Go build + run: go build ./... + # Dogfood the two CI gates we ship and document to users: # - Gate A (consumer-side): `apm audit --ci` -- lockfile / install fidelity. # - Gate B (producer-side): regeneration drift -- did someone hand-edit diff --git a/internal/utils/reflink/reflink_other.go b/internal/utils/reflink/reflink_other.go index d8386f69..fdcb5ef1 100644 --- a/internal/utils/reflink/reflink_other.go +++ b/internal/utils/reflink/reflink_other.go @@ -1,4 +1,4 @@ -//go:build !linux && !darwin +//go:build !linux package reflink diff --git a/tests/unit/test_ci_workflows.py b/tests/unit/test_ci_workflows.py new file mode 100644 index 00000000..7eba1aa0 --- /dev/null +++ b/tests/unit/test_ci_workflows.py @@ -0,0 +1,24 @@ +from pathlib import Path + +import yaml + +REPO_ROOT = Path(__file__).resolve().parents[2] + + +def _load_ci_workflow(): + return yaml.safe_load((REPO_ROOT / ".github/workflows/ci.yml").read_text()) + + +def test_go_build_test_matrix_includes_macos(): + job = _load_ci_workflow()["jobs"]["go-build-test"] + + assert job["runs-on"] == "${{ matrix.os }}" + assert job["strategy"]["matrix"]["os"] == ["ubuntu-24.04", "macos-latest"] + + +def test_go_build_test_runs_build_and_tests(): + steps = _load_ci_workflow()["jobs"]["go-build-test"]["steps"] + commands = [step.get("run") for step in steps] + + assert "go test ./..." in commands + assert "go build ./..." in commands