Skip to content

Commit fc9c660

Browse files
kolyshkintianon
andcommitted
ci: use supported Go versions
This reduces maintenance burden by letting setup-go track our Go versions. actions/setup-go supports "stable" and "oldstable" as automatic aliases for the latest release and the previous to latest release, which was our intent with two of these three hard-coded versions. The third is hard-coded to match our `go.mod`, which actions/setup-go also supports reading from, so we can be completely DRY here. Co-authored-by: Tianon Gravi <[email protected]> Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 5610abd commit fc9c660

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ jobs:
1414

1515
strategy:
1616
matrix:
17-
go: [1.21.x, 1.22.x]
17+
# Supported Go releases plus the version in the go.mod are tested. See:
18+
# - https://github.com/actions/setup-go/tree/v5#getting-go-version-from-the-gomod-file
19+
# - https://github.com/actions/setup-go/tree/v5#using-stableoldstable-aliases
20+
go: ['go.mod', 'oldstable', 'stable']
1821

1922
steps:
2023
- name: checkout source code
@@ -23,7 +26,8 @@ jobs:
2326
- name: setup go environment
2427
uses: actions/setup-go@v5
2528
with:
26-
go-version: ${{ matrix.go }}
29+
go-version: ${{ matrix.go != 'go.mod' && matrix.go || null }}
30+
go-version-file: ${{ matrix.go == 'go.mod' && 'go/src/github.com/opencontainers/image-spec/go.mod' || null }}
2731

2832
- name: create go.mod
2933
run: |

0 commit comments

Comments
 (0)