ci: run tests against single version first #24
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
on: [push, pull_request] | |
name: Test | |
jobs: | |
# Run tests for the oldest supported Go version and OS first. | |
pre-test: | |
strategy: | |
matrix: | |
go-version: [1.18.x] | |
os: [ubuntu-20.04] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} | |
- run: go test ./... | |
# Main test suite for all Go versions and OS. | |
test: | |
needs: pre-test | |
strategy: | |
matrix: | |
go-version: [1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x, 1.23.x] | |
os: | |
- ubuntu-22.04 | |
- ubuntu-20.04 | |
- windows-2022 | |
- windows-2019 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
~\AppData\Local\go-build | |
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-${{ matrix.go-version }}- | |
- name: Run tests (with race detector on Linux) | |
if: matrix.os != 'windows-2019' | |
run: go test -race ./... | |
- name: Run tests (without race detector) | |
if: matrix.os == 'windows-2019' | |
run: go test ./... |