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, 1.22.x, 1.23.x, 1.24.x, 1.25.x, 1.26.x, tip] full-tests: [false] include: - go-version: 1.27.x full-tests: true runs-on: ubuntu-latest steps: - name: Setup go run: | curl -sL https://raw.githubusercontent.com/maxatome/install-go/v3.8/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://golangci-lint.run/install.sh | sh -s -- -b $HOME/go/bin v2.13.0 $HOME/go/bin/golangci-lint run - 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="-coverpkg=./... -covermode=atomic -test.gocoverdir=$(pwd)/cov/" GO_TEST_BASE_FLAGS="$cover_flags"base GO_TEST_SAFE_FLAGS="$cover_flags"safe GO_TEST_RACE_FLAGS="$cover_flags"race GO_TEST_RACE_SAFE_FLAGS="$cover_flags"race-safe GO_TEST_RACE_CGO_FLAGS="$cover_flags"cgo mkdir -p cov/base cov/safe cov/race cov/race-safe cov/cgo fi export GORACE="halt_on_error=1" echo "BASE ===========================================" go test ./... $GO_TEST_BASE_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 echo "RACE + CGO (internal/spew only) ===================" CGO_ENABLED=1 \ go test -race -tags testcgo ./internal/spew $GO_TEST_RACE_CGO_FLAGS - name: Reporting if: matrix.full-tests env: COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | dirs= for d in cov/*; do [ -d $d ] && dirs="${dirs:+"$dirs,"}$d" done go tool covdata textfmt -i="$dirs" -o /dev/fd/1 | egrep -v '^github\.com/maxatome/go-testdeep/internal/(json/parser\.go:|test/)' > coverage.out go install github.com/mattn/goveralls@v0.0.12 goveralls -coverprofile=coverage.out -service=github