-
Notifications
You must be signed in to change notification settings - Fork 50
ci: test against per-module minimum go version #215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,12 +17,33 @@ on: [push, pull_request] | |
|
|
||
| jobs: | ||
| test: | ||
| name: ${{ matrix.module }} / ${{ matrix.platform }} / ${{ matrix.go-version || 'minimum' }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| go-version: [1.18.x, oldstable, stable] | ||
| module: | ||
| - atomicwriter | ||
| - capability | ||
| - mount | ||
| - mountinfo | ||
| - reexec | ||
| - sequential | ||
| - signal | ||
| - symlink | ||
| - user | ||
| - userns | ||
| go-version: | ||
| - "" # do not specify go-version to fall back on go-version-file (use go.mod); see https://github.com/actions/setup-go/issues/450#issuecomment-3620402646 | ||
| - oldstable | ||
| - stable | ||
| platform: [ubuntu-22.04, ubuntu-24.04, windows-2022, windows-2025, macos-15, macos-26] | ||
| runs-on: ${{ matrix.platform }} | ||
| timeout-minutes: 10 # guardrails timeout for the whole job | ||
|
|
||
| env: | ||
| GOTOOLCHAIN: local | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a request for go to NOT download another go version? If yes, why do we need it here? I mean, it may only happen if we have go.mod with Or is this something more generic, like "don't download anything" and omitting it may mask some issue? |
||
| PACKAGES: ${{ matrix.module }} | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
@@ -33,6 +54,7 @@ jobs: | |
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version: ${{ matrix.go-version }} | ||
| go-version-file: ./${{ matrix.module }}/go.mod # used when go-version is not specified. | ||
| # Disable caching as we don't have top-level go.sum needed for | ||
| # the cache key, and specifying multiple go.sums is not trivial | ||
| # (see https://github.com/moby/sys/pull/160 for details). | ||
|
|
@@ -43,25 +65,8 @@ jobs: | |
| version: v2.10 | ||
| # We don't need to run golangci-lint here yet, but | ||
| # there's no way to avoid it, so run it on one module. | ||
| working-directory: ./mountinfo | ||
| - name: Set PACKAGES env | ||
| if: ${{ matrix.go-version == '1.18.x' }} | ||
| run: | | ||
| # Check if the module supports this version of Go. | ||
| go_version="$(go env GOVERSION)" | ||
| go_version="${go_version#go}" | ||
|
|
||
| packages="" | ||
| for p in */; do | ||
| [ -f "$p/go.mod" ] || continue | ||
| if ! (cd "$p" && go list -m -f "{{if gt .GoVersion \"$go_version\"}}ko{{end}}" | grep -q ko); then | ||
| packages+="${p%/} " | ||
| else | ||
| echo "::notice::SKIP: github.com/moby/sys/${p%/} requires a more recent version of Go" | ||
| fi | ||
| done | ||
|
|
||
| echo "PACKAGES=${packages}" >> "$GITHUB_ENV" | ||
| working-directory: ./${{ matrix.module }} | ||
|
|
||
| - name: go mod tidy | ||
| run: | | ||
| make foreach CMD="go mod tidy" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the way it is used here. I don't like that we have to also list all the modules in the top-level Makefile.