Skip to content

Commit 737527d

Browse files
committed
add coverage action
1 parent 0034bc7 commit 737527d

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/coverage.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Code Coverage
2+
3+
permissions:
4+
pull-requests: write
5+
contents: write
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
pull_request:
12+
13+
jobs:
14+
coverage_report:
15+
name: Generate coverage report
16+
runs-on: ubuntu-latest
17+
steps:
18+
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: '3.x'
26+
27+
- name: Setup vcpkg
28+
run: |
29+
python ./tools/install-vcpkg.py
30+
31+
- name: Setup lcov
32+
uses: hrishikesh-kadam/setup-lcov@v1
33+
34+
- name: Generate lcov input
35+
run: |
36+
chmod +x ./build.sh
37+
chmod +x ./test/coverage.sh
38+
./test/coverage.sh
39+
40+
- name: Report code coverage
41+
if: ${{ github.event_name == 'pull_request' }}
42+
uses: zgosalvez/github-actions-report-lcov@v4
43+
with:
44+
coverage-files: build/filtered_coverage.info
45+
minimum-coverage: 80
46+
artifact-name: code-coverage-report
47+
github-token: ${{ secrets.GITHUB_TOKEN }}
48+
update-comment: true
49+
50+
- name: Upload code coverage report
51+
if: ${{ github.ref_name == 'master' && github.event_name == 'push' }}
52+
uses: JamesIves/github-pages-deploy-action@v4
53+
with:
54+
folder: build/coverage_report
55+
target-folder: coverage-report
56+
branch: gh-pages

0 commit comments

Comments
 (0)