-
Notifications
You must be signed in to change notification settings - Fork 54
67 lines (61 loc) · 1.74 KB
/
go-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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Go Test and Coverage
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
strategy:
matrix:
go-version: ["1.22.1"]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cache/go-build # ubuntu-latest
~/Library/Caches/go-build # macos-latest
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Download dependencies
run: go mod download
- name: Run Go tests
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
go test -v -timeout 5m -coverpkg=./... -coverprofile=coverage.tmp.txt -covermode=atomic ./...
grep -v -E ".pb.go|_mock.go" coverage.tmp.txt > coverage.txt
else
go test -v -timeout 2m ./...
fi
shell: bash
env:
HOTSTUFF_LOG: info
- name: Run docker tests
if: runner.os == 'Linux'
run: |
cd scripts
bash deploy_test.sh
- name: Upload code coverage report to Codecov
if: runner.os == 'Linux'
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./coverage.txt
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
verbose: true