Skip to content

Commit 06138f0

Browse files
SVilgelmCopilot
andauthored
feat(ci): dynamic Go version lookup (#118)
* feat(ci): dynamic Go version lookup Introduce a new job (GoVersions) that uses arnested/go-version-action to compute a matrix of supported Go versions and expose it as an output. Make UnitTestJob depend on GoVersions and replace the hardcoded go matrix with a dynamic matrix sourced from needs.GoVersions.outputs.matrix. This removes the need to update the workflow whenever new Go versions are added, ensuring the CI runs tests across the current set of supported Go releases automatically. * Update .github/workflows/code.yaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent e4360ca commit 06138f0

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

.github/workflows/code.yaml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,22 @@ jobs:
2929
with:
3030
version: latest
3131

32+
GoVersions:
33+
name: Lookup Go versions
34+
runs-on: ubuntu-latest
35+
outputs:
36+
matrix: ${{ steps.versions.outputs.matrix }}
37+
steps:
38+
- uses: actions/checkout@v5.0.0 # immutable action, safe to use the versions
39+
- uses: arnested/go-version-action@81f730770833dd20e6365d535ce7efcb3b136e7d #v1.1.21
40+
id: versions
41+
3242
UnitTestJob:
3343
runs-on: ubuntu-latest
44+
needs: GoVersions
3445
strategy:
3546
matrix:
36-
go:
37-
- "1.22"
38-
- "1.23"
39-
- "1.24"
40-
- "1.25"
47+
go: ${{ fromJSON(needs.GoVersions.outputs.matrix) }}
4148
steps:
4249
- name: Checkout repository
4350
uses: actions/checkout@v5.0.0 # immutable action, safe to use the versions

0 commit comments

Comments
 (0)