-
Notifications
You must be signed in to change notification settings - Fork 36
101 lines (89 loc) · 2.63 KB
/
code-coverage.yml
File metadata and controls
101 lines (89 loc) · 2.63 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Code Coverage
on:
push:
branches: [ 'master', 'main', 'release/**' ]
pull_request:
branches: [ '*' ]
permissions:
contents: read
jobs:
coverage:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: base
flags: ""
- name: dma
flags: "DMA=1"
- name: threadsafe
flags: "THREADSAFE=1"
- name: she
flags: "SHE=1"
- name: auth
flags: "AUTH=1"
- name: nocrypto
flags: "NOCRYPTO=1"
steps:
- uses: actions/checkout@v4
- name: Install gcovr
run: |
sudo apt-get update
sudo apt-get install -y gcovr
- name: Checkout wolfssl
uses: actions/checkout@v4
with:
repository: wolfssl/wolfssl
path: wolfssl
- name: Build, run, and emit tracefile (${{ matrix.name }})
run: |
cd test && make coverage-json \
OUT=$GITHUB_WORKSPACE/cov-json/legacy-${{ matrix.name }}.json \
WOLFSSL_DIR=../wolfssl ${{ matrix.flags }}
- name: Upload tracefile
uses: actions/upload-artifact@v4
with:
name: legacy-tracefile-${{ matrix.name }}
path: cov-json/legacy-${{ matrix.name }}.json
retention-days: 7
merge:
needs: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install gcovr
run: |
sudo apt-get update
sudo apt-get install -y gcovr
- name: Download legacy tracefiles
uses: actions/download-artifact@v4
with:
pattern: legacy-tracefile-*
path: cov-json
merge-multiple: true
- name: Merge tracefiles into HTML report
run: |
# nullglob so an empty match returns 0 files instead of the
# literal pattern, which would slip past the guard below.
shopt -s nullglob
files=(cov-json/legacy-*.json)
if [ ${#files[@]} -eq 0 ]; then
echo "No tracefiles found to merge" >&2
exit 1
fi
# Build "--add-tracefile <path>" pairs for each tracefile.
args=()
for f in "${files[@]}"; do
args+=(--add-tracefile "$f")
done
mkdir -p coverage-merged
gcovr "${args[@]}" \
--html-details coverage-merged/index.html \
--print-summary
- name: Upload merged coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage-merged/
retention-days: 30