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