Switch CI to go 1.22 & golangci-lint 1.55.2 #497
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
name: Build | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
test: | |
strategy: | |
matrix: | |
go-version: [1.16.x, 1.17.x, 1.18.x, 1.19.x, 1.20.x, 1.21.x, tip] | |
full-tests: [false] | |
include: | |
- go-version: 1.22.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: Miscellaneous checks | |
if: matrix.full-tests | |
run: | | |
./tools/gen_funcs.pl | |
git diff --exit-code | |
if fgrep 'interface{}' $(find . -name '*.go' -not -name any.go -not -name any_test.go); then | |
echo '*** At least one interface{} occurrence found. Use any instead.' | |
false | |
fi | |
- 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.55.2 | |
$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 misspell \ | |
-E prealloc \ | |
-E revive \ | |
-E unconvert \ | |
-E whitespace \ | |
./... | |
- name: Testing | |
continue-on-error: ${{ matrix.go-version == 'tip' }} | |
run: | | |
go version | |
go env | |
if [ -z "$(go env GOPROXY)" ]; then | |
echo "Fix empty GOPROXY" | |
export GOPROXY=https://proxy.golang.org,direct | |
fi | |
if [ ${{ matrix.full-tests }} = true ]; then | |
cover_flags="-covermode=atomic -coverprofile=coverage" | |
GO_TEST_FLAGS="$cover_flags.out" | |
GO_TEST_SAFE_FLAGS="$cover_flags-safe.out" | |
GO_TEST_RACE_FLAGS="$cover_flags-race.out" | |
GO_TEST_RACE_SAFE_FLAGS="$cover_flags-race-safe.out" | |
fi | |
export GORACE="halt_on_error=1" | |
echo "CLASSIC ===========================================" | |
go test $GO_TEST_FLAGS ./... | |
echo "SAFE ==============================================" | |
go test -tags safe $GO_TEST_SAFE_FLAGS ./... | |
echo "RACE ==============================================" | |
go test -race $GO_TEST_RACE_FLAGS ./... | |
echo "RACE + SAFE =======================================" | |
go test -race -tags safe $GO_TEST_RACE_SAFE_FLAGS ./... | |
- name: Reporting | |
if: matrix.full-tests | |
env: | |
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
go install github.com/mattn/[email protected] | |
go install github.com/wadey/gocovmerge@latest | |
gocovmerge coverage.out \ | |
coverage-safe.out \ | |
coverage-race.out \ | |
coverage-race-safe.out | | |
egrep -v '^github\.com/maxatome/go-testdeep/internal/(json/parser\.go:|test/)' > coverage.out | |
goveralls -coverprofile=coverage.out -service=github |