Skip to content

Commit cf3384e

Browse files
committed
added code coverage to github actions
1 parent 7cd533e commit cf3384e

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Code Coverage
2+
3+
on:
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
jobs:
10+
coverage:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
# List compiler version
17+
- name: List compiler and gcov version
18+
run: |
19+
gcc --version
20+
gcov --version
21+
22+
# Install gcovr for coverage report generation
23+
- name: Install gcovr
24+
run: |
25+
sudo apt-get update
26+
sudo apt-get install -y gcovr
27+
28+
# Checkout wolfssl
29+
- name: Checkout wolfssl
30+
uses: actions/checkout@v4
31+
with:
32+
repository: wolfssl/wolfssl
33+
path: wolfssl
34+
35+
# Run coverage
36+
- name: Build and run tests with coverage
37+
run: cd test && make coverage WOLFSSL_DIR=../wolfssl
38+
39+
# Display coverage summary in the action log
40+
- name: Display coverage summary
41+
run: |
42+
echo "=== Coverage Summary ==="
43+
cd test
44+
gcovr Build --root .. --filter '\.\./src/.*' --filter '\.\./wolfhsm/.*' --print-summary
45+
46+
# Upload coverage report as artifact
47+
- name: Upload coverage report
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: coverage-report
51+
path: coverage/
52+
retention-days: 30
53+

0 commit comments

Comments
 (0)