-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (47 loc) · 1.37 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
name: coverage
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
coverage:
runs-on: ubuntu-latest
strategy:
matrix:
module:
- "fxgcppubsub"
- "fxgomysqlserver"
- "fxslack"
- "fxredis"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
check-latest: true
- name: Install dependencies for module ${{ matrix.module }}
working-directory: ${{ matrix.module }}
run: go mod download
- name: Run tests for module ${{ matrix.module }}
working-directory: ${{ matrix.module }}
run: go test -v -race -failfast -coverpkg=./... -covermode=atomic -coverprofile=coverage.tmp.out ./...
- name: Exclude testdata
working-directory: ${{ matrix.module}}
run: cat coverage.tmp.out | grep -v "testdata" > coverage.out
- name: Clean temp coverage
working-directory: ${{ matrix.module }}
run: rm coverage.tmp.out
- name: Codecov for module ${{ matrix.module }}
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
flags: ${{ matrix.module }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}