Skip to content

Commit 6fa1427

Browse files
authored
Merge pull request #63 from githubnext/copilot/add-macos-to-build-matrix
Add macOS coverage to Go CI
2 parents 764bcb8 + a234980 commit 6fa1427

2 files changed

Lines changed: 51 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ jobs:
7575
- name: Lint - auth-protocol boundary (#1212 anti-regression)
7676
run: bash scripts/lint-auth-signals.sh
7777

78-
# Linux-only for PR feedback. Full platform matrix (incl. macOS + Windows) runs post-merge in build-release.yml.
78+
# Python test + binary build remain Linux-only for PR feedback. Full packaged
79+
# platform coverage (incl. macOS + Windows) runs post-merge in build-release.yml.
7980
# Combines unit tests + binary build into a single job to eliminate runner re-provisioning overhead.
8081
build-and-test:
8182
name: Build & Test (Linux)
@@ -128,6 +129,31 @@ jobs:
128129
retention-days: 30
129130
if-no-files-found: error
130131

132+
go-build-test:
133+
name: Go Build & Test (${{ matrix.os }})
134+
runs-on: ${{ matrix.os }}
135+
permissions:
136+
contents: read
137+
strategy:
138+
fail-fast: false
139+
matrix:
140+
os: [ubuntu-24.04, macos-latest]
141+
142+
steps:
143+
- uses: actions/checkout@v4
144+
145+
- name: Set up Go
146+
uses: actions/setup-go@v5
147+
with:
148+
go-version-file: go.mod
149+
cache: true
150+
151+
- name: Run Go tests
152+
run: go test ./...
153+
154+
- name: Run Go build
155+
run: go build ./...
156+
131157
# Dogfood the two CI gates we ship and document to users:
132158
# - Gate A (consumer-side): `apm audit --ci` -- lockfile / install fidelity.
133159
# - Gate B (producer-side): regeneration drift -- did someone hand-edit

tests/unit/test_ci_workflows.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from pathlib import Path
2+
3+
import yaml
4+
5+
REPO_ROOT = Path(__file__).resolve().parents[2]
6+
7+
8+
def _load_ci_workflow():
9+
return yaml.safe_load((REPO_ROOT / ".github/workflows/ci.yml").read_text())
10+
11+
12+
def test_go_build_test_matrix_includes_macos():
13+
job = _load_ci_workflow()["jobs"]["go-build-test"]
14+
15+
assert job["runs-on"] == "${{ matrix.os }}"
16+
assert job["strategy"]["matrix"]["os"] == ["ubuntu-24.04", "macos-latest"]
17+
18+
19+
def test_go_build_test_runs_build_and_tests():
20+
steps = _load_ci_workflow()["jobs"]["go-build-test"]["steps"]
21+
commands = [step.get("run") for step in steps]
22+
23+
assert "go test ./..." in commands
24+
assert "go build ./..." in commands

0 commit comments

Comments
 (0)