Repository navigation
149 lines (131 loc) · 4.38 KB
/
Copy pathcode-coverage.yml
File metadata and controls
149 lines (131 loc) · 4.38 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Code Coverage
on:
# Coverage is an on-demand, information-only report, not a PR gate.
# Run it manually from the Actions tab against any branch (including a
# PR branch); the nightly run keeps a fresh artifact and catches rot.
workflow_dispatch:
schedule:
- cron: '0 6 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
coverage:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
tree: [legacy, refactor]
config:
- 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
# Pin a modern gcovr via pipx; the apt-shipped 7.0 on ubuntu-noble
# cannot parse gcc 13's gcov output with block IDs >= 10000 (fixed
# upstream in gcovr 7.1, see gcovr PR #883).
run: pipx install 'gcovr==8.6'
- name: Checkout wolfssl
uses: ./.github/actions/checkout-wolfssl
- name: Build, run, and emit tracefile (${{ matrix.tree }} ${{ matrix.config.name }})
# legacy and refactor trees differ only in the test dir and the
# relative path back to the wolfssl checkout; both emit paths
# rooted at the repo, so their tracefiles compare apples-to-apples.
run: |
if [ "${{ matrix.tree }}" = "legacy" ]; then
dir=test; wolfssl=../wolfssl
else
dir=test-refactor/posix; wolfssl=../../wolfssl
fi
cd "$dir"
make coverage-json \
OUT=$GITHUB_WORKSPACE/cov-json/${{ matrix.tree }}-${{ matrix.config.name }}.json \
WOLFSSL_DIR=$wolfssl ${{ matrix.config.flags }}
- name: Upload tracefile
uses: actions/upload-artifact@v4
with:
name: tracefile-${{ matrix.tree }}-${{ matrix.config.name }}
path: cov-json/${{ matrix.tree }}-${{ matrix.config.name }}.json
retention-days: 7
report:
needs: coverage
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install gcovr
run: pipx install 'gcovr==8.6'
- name: Download tracefiles
uses: actions/download-artifact@v4
with:
pattern: tracefile-*
path: cov-json
merge-multiple: true
- name: Build HTML reports
run: |
# nullglob so an empty match returns 0 files instead of the
# literal pattern, which would slip past the guard below.
shopt -s nullglob
for tree in legacy refactor; do
files=(cov-json/$tree-*.json)
if [ ${#files[@]} -eq 0 ]; then
echo "No $tree tracefiles found to merge" >&2
exit 1
fi
args=()
for f in "${files[@]}"; do
args+=(--add-tracefile "$f")
done
mkdir -p coverage-$tree
gcovr "${args[@]}" \
--html-details coverage-$tree/index.html \
--print-summary
done
- name: Upload legacy coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage-legacy/
retention-days: 30
- name: Upload refactor coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-refactor-report
path: coverage-refactor/
retention-days: 30
compare:
needs: coverage
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Download tracefiles
uses: actions/download-artifact@v4
with:
pattern: tracefile-*
path: cov-json
merge-multiple: true
- name: Compare legacy vs refactor coverage
run: |
python3 tools/coverage-compare/compare_tracefiles.py cov-json compare
cat compare/summary.md >> "$GITHUB_STEP_SUMMARY"
- name: Upload coverage comparison
uses: actions/upload-artifact@v4
with:
name: coverage-comparison
path: compare/
retention-days: 30