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