-
Notifications
You must be signed in to change notification settings - Fork 268
78 lines (75 loc) · 1.9 KB
/
coverage.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
68
69
70
71
72
73
74
75
76
77
78
name: Test Coverage
on:
pull_request:
push:
branches:
- v0.34.x-celestia
jobs:
build-linux:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
goarch: ["arm", "amd64"]
timeout-minutes: 5
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.23.1"
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- name: install
run: GOOS=linux GOARCH=${{ matrix.goarch }} make build
if: env.GIT_DIFF
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.23.1"
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- name: test & coverage report creation
run: go test ./... -mod=readonly -timeout 15m -race -coverprofile=profile.out -covermode=atomic
if: env.GIT_DIFF
- uses: actions/upload-artifact@v4
with:
name: "${{ github.sha }}-coverage"
path: ./profile.out
upload-coverage-report:
runs-on: ubuntu-latest
needs: tests
steps:
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/[email protected]
with:
name: "${{ github.sha }}-coverage"
if: env.GIT_DIFF
- run: |
cat ./profile.out | grep -v "mode: atomic" >> coverage.txt
if: env.GIT_DIFF
- uses: codecov/codecov-action@v4
with:
file: ./coverage.txt
if: env.GIT_DIFF