Skip to content

Commit 7e71ac0

Browse files
authored
Merge pull request #197 from thaJeztah/skip_mods
gha: skip modules on unsupported Go versions, test against 1.18.x, oldstable, stable
2 parents f4c0392 + 5e37d7d commit 7e71ac0

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

.github/workflows/test.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
test:
55
strategy:
66
matrix:
7-
go-version: [1.18.x, 1.23.x, 1.24.x]
7+
go-version: [1.18.x, oldstable, stable]
88
platform: [ubuntu-22.04, ubuntu-24.04, windows-latest, macos-13, macos-14, macos-15]
99
runs-on: ${{ matrix.platform }}
1010
defaults:
@@ -24,10 +24,21 @@ jobs:
2424
- name: Set PACKAGES env
2525
if: ${{ matrix.go-version == '1.18.x' }}
2626
run: |
27-
# This corresponds with the list in Makefile:1, but omits the "userns"
28-
# and "capability" modules, which require go1.21 as minimum, and "reexec",
29-
# which requires go1.20 in tests.
30-
echo 'PACKAGES=atomicwriter mountinfo mount sequential signal symlink user' >> $GITHUB_ENV
27+
# Check if the module supports this version of Go.
28+
go_version="$(go env GOVERSION)"
29+
go_version="${go_version#go}"
30+
31+
packages=""
32+
for p in */; do
33+
[ -f "$p/go.mod" ] || continue
34+
if ! (cd "$p" && go list -m -f "{{if gt .GoVersion \"$go_version\"}}ko{{end}}" | grep -q ko); then
35+
packages+="${p%/} "
36+
else
37+
echo "::notice::SKIP: github.com/moby/sys/${p%/} requires a more recent version of Go"
38+
fi
39+
done
40+
41+
echo "PACKAGES=${packages}" >> "$GITHUB_ENV"
3142
- name: go mod tidy
3243
run: |
3344
make foreach CMD="go mod tidy"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PACKAGES ?= atomicwriter capability mountinfo mount reexec sequential signal symlink user userns # IMPORTANT: when updating this list, also update the conditional one in .github/workflows/test.yml
1+
PACKAGES ?= atomicwriter capability mountinfo mount reexec sequential signal symlink user userns
22
BINDIR ?= _build/bin
33
CROSS ?= linux/arm linux/arm64 linux/ppc64le linux/s390x \
44
freebsd/amd64 openbsd/amd64 darwin/amd64 darwin/arm64 windows/amd64

0 commit comments

Comments
 (0)