Skip to content

Commit c21e802

Browse files
committed
Generate a coverage report in CI
1 parent 8c50839 commit c21e802

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

.github/workflows/coverage.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Code coverage
2+
on:
3+
- push
4+
- pull_request
5+
6+
jobs:
7+
coverage:
8+
runs-on: ubuntu-22.04
9+
steps:
10+
- name: Checkout repo
11+
uses: actions/checkout@v4
12+
- name: Install deps
13+
shell: bash
14+
run: |
15+
./.github/scripts/install_deps.sh ubuntu-22.04
16+
- name: Install LCOV
17+
run: |
18+
sudo apt-get install lcov
19+
- name: Generate coverage report
20+
run: |
21+
./contrib/coverage.bash false
22+
- name: Package coverage report
23+
run: |
24+
zip -r rgbds-coverage.zip coverage
25+
- name: Upload coverage report
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: coverage
29+
path: rgbds-coverage.zip

contrib/coverage.bash

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ lcov -c --no-external -d . -o coverage/coverage.info --ignore-errors format,inco
2020
genhtml -f -s -o coverage/ coverage/coverage.info --ignore-errors category,corrupt,inconsistent
2121

2222
# Open report in web browser
23-
if [ "$(uname)" == "Darwin" ]; then
24-
open coverage/index.html
25-
else
26-
xdg-open coverage/index.html
23+
if [ "$1" != "false" ]; then
24+
if [ "$(uname)" == "Darwin" ]; then
25+
open coverage/index.html
26+
else
27+
xdg-open coverage/index.html
28+
fi
2729
fi

0 commit comments

Comments
 (0)