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