-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (43 loc) · 1.12 KB
/
test.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
name: Test
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.22'
- name: Cache modules
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install modules
run: |
go mod download
- name: Setup gotestsum
uses: autero1/[email protected]
with:
gotestsum_version: 1.6.4
- run: mkdir -p /tmp/test-results
- name: Run Tests
run: |
gotestsum --junitfile /tmp/test-results/unit-tests.xml -- ./... -coverprofile=/tmp/test-coverage.txt
- name: Upload Code Coverage
uses: codecov/codecov-action@v1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: /tmp/test-coverage.txt
fail_ci_if_error: true
verbose: true