github.com/google/go-github/v70@v70.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@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.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@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
    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@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
    80          with:
    81            use_oidc: true