ci: Test against Go 1.20 and 1.21 (#404)
Per the [Go Release Policy][1], upstream supports only the two most recent major releases of Go. For example, with Go 1.21 available, only 1.21 and 1.20 are supported. Many projects adopt a similar support policy to strike a balance between new features and backwards support. [1]: https://go.dev/doc/devel/release#policy If the project has the same policy, it makes sense to test against both versions of Go. This change adds a test matrix to CI, testing against both Go 1.20 and 1.21, on both Windows and Linux.
This commit is contained in:
@@ -4,28 +4,45 @@ on:
|
|||||||
- master
|
- master
|
||||||
pull_request:
|
pull_request:
|
||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Test
|
name: Test / Go ${{ matrix.go }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
# These are the release channels.
|
||||||
|
# Hermit will handle installing the right patch.
|
||||||
|
go: ["1.20", "1.21"]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Init Hermit
|
- name: Init Hermit
|
||||||
run: ./bin/hermit env -r >> "$GITHUB_ENV"
|
run: ./bin/hermit env -r >> "$GITHUB_ENV"
|
||||||
|
- name: Install Go ${{ matrix.go }}
|
||||||
|
run: |
|
||||||
|
hermit install go@"${GO_VERSION}"
|
||||||
|
go version
|
||||||
|
env:
|
||||||
|
GO_VERSION: ${{ matrix.go }}
|
||||||
- name: Test
|
- name: Test
|
||||||
run: go test ./...
|
run: go test ./...
|
||||||
|
|
||||||
test-windows:
|
test-windows:
|
||||||
name: Test / Windows
|
name: Test / Windows / Go ${{ matrix.go }}
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
# These are versions for GitHub's setup-go.
|
||||||
|
# '.x' will pick the latest patch release.
|
||||||
|
go: ["1.20.x", "1.21.x"]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: 1.21
|
go-version: ${{ matrix.go }}
|
||||||
- name: Test
|
- name: Test
|
||||||
run: go test ./...
|
run: go test ./...
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user