-
Notifications
You must be signed in to change notification settings - Fork 49
67 lines (63 loc) · 2.04 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
56
57
58
59
60
61
62
63
64
65
66
67
name: Tests / Code Coverage
on:
push:
branches:
- master
- develop
pull_request:
jobs:
tests:
strategy:
matrix:
go-version: [1.20.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
env:
GOPRIVATE: github.com/bnb-chain
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_SECRET }}
CGO_CFLAGS: "-O -D__BLST_PORTABLE__"
CGO_CFLAGS_ALLOW: "-O -D__BLST_PORTABLE__"
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Setup GitHub Token
run: git config --global url.https://[email protected]/.insteadOf https://github.com/
- name: run tests
run: |
make test
- name: make coverage report
id: coverage-report
if: github.event_name == 'pull_request'
continue-on-error: true
run: |
echo '## Test Coverage Report' >> coverage-report.txt
echo 'commit-id: ${{ github.event.pull_request.head.sha }}' >> coverage-report.txt
echo 'generated by https://github.com/vladopajic/go-test-coverage' >> coverage-report.txt
echo >> coverage-report.txt
echo '<details><summary>Additional details and impacted files</summary>' >> coverage-report.txt
echo >> coverage-report.txt
echo '```' >> coverage-report.txt
make check-coverage >> coverage-report.txt
echo '```' >> coverage-report.txt
echo >> coverage-report.txt
echo '</details>' >> coverage-report.txt
cat coverage-report.txt >> $GITHUB_STEP_SUMMARY