Skip to content

Commit 88bf183

Browse files
committed
Update CI to also test "latest" (go and deps)
1 parent 93bccb0 commit 88bf183

1 file changed

Lines changed: 47 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,64 @@ defaults:
1212
shell: 'bash -Eeuo pipefail -x {0}'
1313

1414
jobs:
15+
1516
test:
16-
name: Test
17+
18+
strategy:
19+
matrix:
20+
go:
21+
- release # test the version in Dockerfile + go.mod (the versions we release with)
22+
- latest # test latest (of Go, and deps)
23+
24+
name: Test (${{ matrix.go }} go)
1725
runs-on: ubuntu-latest
26+
1827
steps:
28+
1929
- uses: actions/checkout@v4
20-
- run: sudo apt-get update && sudo apt-get install -y --no-install-recommends binfmt-support qemu-user-static
21-
- run: ./build.sh
30+
31+
# used for both building "latest" and for govulncheck in the final step
32+
- run: docker pull golang
33+
34+
- name: hack in qemu-binfmt
35+
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends binfmt-support qemu-user-static
36+
if: matrix.go == 'release'
37+
38+
- name: "${{ matrix.go == 'latest' && 'update and build' || 'build' }}"
39+
env:
40+
go: '${{ matrix.go }}'
41+
run: |
42+
case "$go" in
43+
release) ./build.sh ;;
44+
45+
latest)
46+
user="$(id -u):$(id -g)"
47+
docker run --rm --mount "type=bind,src=$PWD,dst=/wd" --workdir /wd --user "$user" --env HOME=/tmp golang bash -Eeuo pipefail -xc '
48+
go get -u go@latest ./... # update Go and deps
49+
git diff
50+
51+
export CGO_ENABLED=0 GOFLAGS="-v -trimpath"
52+
GOARCH=amd64 go build -o gosu-amd64
53+
GOARCH=386 go build -o gosu-i386
54+
'
55+
;;
56+
57+
*) echo >&2 "error: unknown 'go' value: '$go'"; exit 1 ;;
58+
esac
59+
60+
# explicitly test our (native) amd64/i386 binaries
2261
- run: ./test.sh gosu-amd64
2362
- run: ./test.sh gosu-i386
2463
- run: ./test.sh --debian gosu-amd64
2564
- run: ./test.sh --debian gosu-i386
65+
66+
# smoke test our Docker image builds
2667
- run: docker build --pull --file hub/Dockerfile.alpine hub
68+
if: matrix.go == 'release'
2769
- run: docker build --pull --file hub/Dockerfile.debian hub
70+
if: matrix.go == 'release'
2871

72+
# run "govulncheck" automatically to ensure we don't have any new/unknown vulnerabilities
2973
- name: govulncheck
3074
run: |
3175
for gosu in gosu-*; do

0 commit comments

Comments
 (0)