github.com/clerkinc/clerk-sdk-go@v1.49.1/.github/workflows/tests.yml (about)

     1  on:
     2    pull_request:
     3    push:
     4      branches: [$default-branch]
     5  
     6  name: tests
     7  env:
     8    GO111MODULE: on
     9  
    10  jobs:
    11    test:
    12      strategy:
    13        matrix:
    14          go-version: [1.16.x]
    15          platform: [ubuntu-latest]
    16      runs-on: ${{ matrix.platform }}
    17  
    18      steps:
    19        - uses: actions/setup-go@v4
    20          with:
    21            go-version: ${{ matrix.go-version }}
    22        - uses: actions/checkout@v3
    23  
    24        - name: Cache go modules
    25          uses: actions/cache@v3
    26          with:
    27            path: ~/go/pkg/mod
    28            key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
    29            restore-keys: ${{ runner.os }}-go-
    30  
    31        - name: Run go fmt
    32          if: runner.os != 'Windows'
    33          run: diff -u <(echo -n) <(gofmt -d -s .)
    34  
    35        - name: Run go vet
    36          run: go vet ./...
    37  
    38        - name: Run go test
    39          run: go test -v -race -coverprofile coverage.out -covermode atomic ./...
    40  
    41        - name: Run coverage
    42          if: runner.os != 'Windows'
    43          run: |
    44            EXPECTED_COVER=95
    45            TOTAL_COVER=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'`
    46            echo "Total coverage was: $TOTAL_COVER %"
    47            echo "Expected coverage: $EXPECTED_COVER %"
    48  
    49        - name: Run integration tests
    50          env:
    51            CLERK_API_URL: ${{ secrets.CLERK_API_URL }}
    52            CLERK_API_KEY: ${{ secrets.CLERK_API_KEY }}
    53            CLERK_SESSION_TOKEN: ${{ secrets.CLERK_SESSION_TOKEN }}
    54            CLERK_SESSION_ID: ${{ secrets.CLERK_SESSION_ID }}
    55          run: go test -tags=integration ./tests/integration