github.com/google/go-github/v74@v74.0.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 permissions: 23 contents: read 24 id-token: write 25 defaults: 26 run: 27 shell: bash 28 strategy: 29 matrix: 30 go-version: [1.x, 1.23.0] # test with N and the .0 release of N-1 31 platform: [ubuntu-latest] 32 include: 33 # include windows, but only with the latest Go version, since there 34 # is very little in the library that is platform specific 35 - go-version: 1.x 36 platform: windows-latest 37 38 # only update test coverage stats with the most recent go version on linux 39 - go-version: 1.x 40 platform: ubuntu-latest 41 update-coverage: true 42 runs-on: ${{ matrix.platform }} 43 44 steps: 45 - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 46 with: 47 go-version: ${{ matrix.go-version }} 48 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 49 50 # Get values for cache paths to be used in later steps 51 - id: cache-paths 52 run: | 53 echo "go-cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT 54 echo "go-mod-cache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT 55 56 - name: Cache go modules 57 uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 58 with: 59 path: | 60 ${{ steps.cache-paths.outputs.go-cache }} 61 ${{ steps.cache-paths.outputs.go-mod-cache }} 62 key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 63 restore-keys: ${{ runner.os }}-go- 64 65 - name: Run go test 66 run: | 67 if [ -n "${{ matrix.update-coverage }}" ]; then 68 script/test.sh -race -covermode atomic -coverprofile coverage.txt ./... 69 exit 70 fi 71 script/test.sh -race -covermode atomic ./... 72 73 - name: Ensure integration tests build 74 # don't actually run tests since they hit live GitHub API 75 run: go test -v -tags=integration -run=^$ ./test/integration 76 77 - name: Upload coverage to Codecov 78 if: ${{ matrix.update-coverage }} 79 uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3 80 with: 81 use_oidc: true