Refactor CI #1
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
name: CI | |
on: [push, pull_request] | |
jobs: | |
gofmt: | |
name: Validate gofmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: "1.21" | |
- run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi | |
staticcheck: | |
name: Validate staticcheck | |
runs-on: ubuntu-latest | |
container: golang:alpine | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: "1.21" | |
- run: "go install honnef.co/go/tools/cmd/staticcheck@2022.1.3" | |
- run: "staticcheck ./..." | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest] | |
go: ["1.12", "1.13", "1.14", "1.15", "1.16", "1.17", "1.18", "1.19", "1.20", "1.21"] | |
name: Run tests for go v${{ matrix.go }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go }} | |
- run: go test ./... | |
if: matrix.os == 'windows-latest' | |
- run: go test --race ./... | |
if: matrix.os == 'ubuntu-latest' |