...
1on: [push, pull_request]
2name: tests
3env:
4 GO111MODULE: on
5
6jobs:
7 test:
8 strategy:
9 matrix:
10 go-version: [1.x, 1.14.x]
11 platform: [ubuntu-latest, windows-latest]
12 runs-on: ${{ matrix.platform }}
13
14 steps:
15 - uses: actions/setup-go@v1
16 with:
17 go-version: ${{ matrix.go-version }}
18 - uses: actions/checkout@v2
19
20 - name: Cache go modules
21 uses: actions/cache@v1
22 with:
23 path: ~/go/pkg/mod
24 key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
25 restore-keys: ${{ runner.os }}-go-
26
27 - name: Run go fmt
28 if: runner.os != 'Windows'
29 run: diff -u <(echo -n) <(gofmt -d -s .)
30
31 - name: Ensure go generate produces a zero diff
32 shell: bash
33 run: go generate -x ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code)
34
35 - name: Run go vet
36 run: go vet ./...
37
38 - name: Run go test
39 run: go test -v -race -coverprofile coverage.txt -covermode atomic ./...
40
41 - name: Ensure integration tests build
42 # don't actually run tests since they hit live GitHub API
43 run: go test -v -tags=integration -run=^$ ./test/integration
44
45 - name: Run scrape tests
46 run: |
47 cd scrape
48 go test ./...
49
50 - name: Upload coverage to Codecov
51 uses: codecov/codecov-action@v1
52 with:
53 token: ${{ secrets.CODECOV_TOKEN }}
View as plain text