ci: test against go 1.21 & use golangci-lint 1.54.1 #108
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: Build | |
on: | |
push: | |
branches: [ v1 ] | |
pull_request: | |
branches: [ v1 ] | |
workflow_dispatch: | |
jobs: | |
test: | |
strategy: | |
matrix: | |
go-version: [1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x, 1.18.x, 1.19.x, 1.20.x, tip] | |
full-tests: [false] | |
include: | |
- go-version: 1.21.x | |
full-tests: true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup go | |
run: | | |
curl -sL https://raw.githubusercontent.com/maxatome/install-go/v3.5/install-go.pl | | |
perl - ${{ matrix.go-version }} $HOME/go | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Linting | |
if: matrix.full-tests | |
run: | | |
curl -sL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | | |
sh -s -- -b $HOME/go/bin v1.54.1 | |
$HOME/go/bin/golangci-lint run --max-issues-per-linter 0 \ | |
--max-same-issues 0 \ | |
--exclude="unused-parameter: parameter '[^']+' seems to be unused, consider removing or renaming it as _" \ | |
-E asciicheck \ | |
-E bidichk \ | |
-E durationcheck \ | |
-E exportloopref \ | |
-E gocritic \ | |
-E godot \ | |
-E goimports \ | |
-E maligned \ | |
-E misspell \ | |
-E prealloc \ | |
-E revive \ | |
-E unconvert \ | |
-E whitespace \ | |
./... | |
- name: Testing | |
continue-on-error: ${{ matrix.go-version == 'tip' }} | |
run: | | |
go version | |
if [ ${{ matrix.full-tests }} = true ]; then | |
GO_TEST_OPTS="-covermode=atomic -coverprofile=coverage.out" | |
fi | |
export GORACE="halt_on_error=1" | |
go test -race $GO_TEST_OPTS ./... | |
- name: Reporting | |
if: matrix.full-tests | |
env: | |
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
go install github.com/mattn/[email protected] | |
goveralls -coverprofile=coverage.out -service=github |