-
Notifications
You must be signed in to change notification settings - Fork 2
68 lines (63 loc) · 2.21 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
name: Coverage
on:
pull_request:
push:
branches:
- main
env:
DD_APPSEC_WAF_TIMEOUT: 5s
jobs:
test:
strategy:
fail-fast: true
matrix:
runs-on: [macos, ubuntu, windows]
cgo-enabled: [0, 1]
tags:
- '' # Default behavior
- 'go1.22' # Unsupported (too new) Go version
- 'datadog.no_waf' # Explicit WAF disable
runs-on: ${{ matrix.runs-on }}-latest
name: ${{ matrix.runs-on }} CGO=${{ matrix.cgo-enabled }} -tags="${{ matrix.tags }}"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
cache: true
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: go test
env:
CGO_ENABLED: ${{ matrix.cgo-enabled }}
shell: bash # Also on Windows!!
run: |-
mkdir -p coverage
gotestsum -- -tags='${{ matrix.tags }}' \
-v -shuffle=on \
-coverprofile=coverage/${{ matrix.runs-on }}-${{ matrix.cgo-enabled }}-${{ matrix.tags }}.gocov \
-covermode=atomic \
./...
- uses: actions/upload-artifact@v3
with:
name: coverprofiles
path: coverage/*.gocov
report:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
- name: Install gocovmerge
run: go install go.shabbyrobe.org/gocovmerge/cmd/gocovmerge@latest
- name: Install go-cover-treemap
run: go install github.com/nikolaydubina/go-cover-treemap@latest
- uses: actions/download-artifact@v3
with:
name: coverprofiles
- name: Merge all profiles
run: gocovmerge *.gocov > full-coverage.gocov
- name: Generate Tree Map
run: go-cover-treemap -coverprofile full-coverage.gocov > coverage-tree-map.svg
- uses: actions/upload-artifact@v3
with:
name: coverage-tree-map.svg
path: coverage-tree-map.svg