Skip to content

Commit 1dd227e

Browse files
committed
ci: catch cross-platform build breaks, gofmt drift and untidy go.mod
CI builds one platform (linux/amd64) while release.yml ships six. The repo has platform-gated source - shell_windows.go, procattr_windows.go and their _unix twins - that CI never compiles, so a signature change to shellCommand or configureProcessGroup compiles green on main and breaks at tag time, after the tag is public. Add a cross-compile matrix job covering the five targets the test job does not, mirroring the shape release.yml:11-29 already runs on this same runner pool. fail-fast: false so a failure names the target. Also add two cheap gates the repo lacked: gofmt -s drift (make fmt rewrites and can never fail CI) and go mod tidy drift (make check mutates, so it cannot gate either). Both print the remedy. All six targets build clean today - this is a missing guard, not a fix.
1 parent c60e886 commit 1dd227e

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,24 @@ jobs:
2525
- name: Trust workspace
2626
run: git config --global --replace-all safe.directory '*'
2727

28+
- name: Check formatting
29+
run: |
30+
unformatted="$(gofmt -s -l .)"
31+
if [ -n "$unformatted" ]; then
32+
echo "::error::Not gofmt-clean. Run 'gofmt -s -w .' and commit:"
33+
echo "$unformatted"
34+
gofmt -s -d .
35+
exit 1
36+
fi
37+
38+
- name: Check go.mod is tidy
39+
run: |
40+
go mod tidy
41+
if ! git diff --exit-code -- go.mod go.sum; then
42+
echo "::error::go.mod/go.sum are not tidy. Run 'go mod tidy' and commit the diff above."
43+
exit 1
44+
fi
45+
2846
- name: Vet
2947
run: go vet ./...
3048

@@ -50,3 +68,27 @@ jobs:
5068
5169
- name: Build
5270
run: go build -o /dev/null ./cmd/opencodereview
71+
72+
cross-compile:
73+
runs-on: self-hosted
74+
timeout-minutes: 20
75+
container:
76+
image: golang:1.26.5
77+
strategy:
78+
fail-fast: false
79+
matrix:
80+
include:
81+
- {goos: linux, goarch: arm64}
82+
- {goos: darwin, goarch: amd64}
83+
- {goos: darwin, goarch: arm64}
84+
- {goos: windows, goarch: amd64}
85+
- {goos: windows, goarch: arm64}
86+
steps:
87+
- uses: actions/checkout@v4
88+
89+
- name: Build ${{ matrix.goos }}/${{ matrix.goarch }}
90+
env:
91+
GOOS: ${{ matrix.goos }}
92+
GOARCH: ${{ matrix.goarch }}
93+
CGO_ENABLED: '0'
94+
run: go build -o /dev/null ./...

0 commit comments

Comments
 (0)