github.com/google/go-github/v42@v42.0.0/.github/workflows/tests.yml (about) 1 on: 2 push: 3 branches: 4 - master 5 pull_request: 6 branches: 7 - master 8 9 name: tests 10 env: 11 GO111MODULE: on 12 13 jobs: 14 test: 15 strategy: 16 matrix: 17 go-version: [1.x, 1.16.x] 18 platform: [ubuntu-latest] 19 include: 20 # include windows, but only with the latest Go version, since there 21 # is very little in the library that is platform specific 22 - go-version: 1.x 23 platform: windows-latest 24 25 # only update test coverage stats with the most recent go version on linux 26 - go-version: 1.x 27 platform: ubuntu-latest 28 update-coverage: true 29 runs-on: ${{ matrix.platform }} 30 31 steps: 32 - name: Cancel previous 33 uses: styfle/cancel-workflow-action@a40b8845c0683271d9f53dfcb887a7e181d3918b #0.9.1 34 with: 35 access_token: ${{ github.token }} 36 37 - uses: actions/setup-go@v2 38 with: 39 go-version: ${{ matrix.go-version }} 40 - uses: actions/checkout@v2 41 42 # Get values for cache paths to be used in later steps 43 - id: cache-paths 44 run: | 45 echo "::set-output name=go-cache::$(go env GOCACHE)" 46 echo "::set-output name=go-mod-cache::$(go env GOMODCACHE)" 47 48 - name: Cache go modules 49 uses: actions/cache@v2 50 with: 51 path: | 52 ${{ steps.cache-paths.outputs.go-cache }} 53 ${{ steps.cache-paths.outputs.go-mod-cache }} 54 key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 55 restore-keys: ${{ runner.os }}-go- 56 57 - name: Ensure go generate produces a zero diff 58 shell: bash 59 run: go generate -x ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code) 60 61 - name: Run go test 62 run: go test -v -race -coverprofile coverage.txt -covermode atomic ./... 63 64 - name: Ensure integration tests build 65 # don't actually run tests since they hit live GitHub API 66 run: go test -v -tags=integration -run=^$ ./test/integration 67 68 - name: Run scrape tests 69 run: | 70 cd scrape 71 go test ./... 72 73 - name: Upload coverage to Codecov 74 if: ${{ matrix.update-coverage }} 75 uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b #v2.1.0 76 77 - name: Ensure go generate produces a zero diff for update-urls 78 shell: bash 79 run: cd update-urls && go generate -x ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code) 80 81 - name: Run go test for update-urls 82 run: cd update-urls && go test -v -race ./...