...
1name: Build
2
3on:
4 push:
5 branches: [ v1 ]
6 pull_request:
7 branches: [ v1 ]
8
9jobs:
10 test:
11 strategy:
12 matrix:
13 go-version: [1.9.x, 1.10.x, 1.11.x, 1.12.x, 1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x, tip]
14 full-tests: [false]
15 include:
16 - go-version: 1.18.x
17 full-tests: true
18
19 runs-on: ubuntu-latest
20
21 steps:
22 - name: Setup go
23 run: |
24 curl -sL https://raw.githubusercontent.com/maxatome/install-go/v3.3/install-go.pl |
25 perl - ${{ matrix.go-version }} $HOME/go
26
27 - name: Checkout code
28 uses: actions/checkout@v2
29
30 - name: Linting
31 if: matrix.full-tests
32 run: |
33 curl -sL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh |
34 sh -s -- -b $HOME/go/bin v1.45.2
35 $HOME/go/bin/golangci-lint run --max-issues-per-linter 0 \
36 --max-same-issues 0 \
37 -E bidichk \
38 -E exportloopref \
39 -E gocritic \
40 -E godot \
41 -E goimports \
42 -E maligned \
43 -E misspell \
44 -E prealloc \
45 -E revive \
46 -E unconvert \
47 -E whitespace \
48 ./...
49
50 - name: Testing
51 continue-on-error: ${{ matrix.go-version == 'tip' }}
52 run: |
53 go version
54 if [ ${{ matrix.full-tests }} = true ]; then
55 GO_TEST_OPTS="-covermode=atomic -coverprofile=coverage.out"
56 fi
57 case ${{ matrix.go-version }} in
58 1.9.x | 1.10.x) # Before go 1.11, go modules are not available
59 mkdir -p ../src/github.com/$GITHUB_REPOSITORY_OWNER
60 ln -s $(pwd) ../src/github.com/$GITHUB_REPOSITORY
61 export GOPATH=$(dirname $(pwd))
62 cd $GOPATH/src/github.com/$GITHUB_REPOSITORY
63 go get -t ./...
64 ;;
65 esac
66 export GORACE="halt_on_error=1"
67 go test -race $GO_TEST_OPTS ./...
68
69 - name: Reporting
70 if: matrix.full-tests
71 env:
72 COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73 run: |
74 go install github.com/mattn/goveralls@v0.0.9
75 goveralls -coverprofile=coverage.out -service=github
View as plain text