mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Generate a coverage report in CI (#1736)
This commit is contained in:
2
.github/workflows/checkdiff.yml
vendored
2
.github/workflows/checkdiff.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Code coverage checking
|
name: Diff completeness check
|
||||||
on: pull_request
|
on: pull_request
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
2
.github/workflows/checkformat.yml
vendored
2
.github/workflows/checkformat.yml
vendored
@@ -9,4 +9,4 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Check format
|
- name: Check format
|
||||||
run: |
|
run: |
|
||||||
./contrib/checkformat.bash
|
contrib/checkformat.bash
|
||||||
|
|||||||
30
.github/workflows/coverage.yml
vendored
Normal file
30
.github/workflows/coverage.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
name: Code coverage report
|
||||||
|
on:
|
||||||
|
- push
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
coverage:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Install deps
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
./.github/scripts/install_deps.sh ubuntu
|
||||||
|
- name: Install LCOV
|
||||||
|
run: |
|
||||||
|
sudo apt-get install lcov
|
||||||
|
- name: Install test dependency dependencies
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
test/fetch-test-deps.sh --get-deps ubuntu
|
||||||
|
- name: Generate coverage report
|
||||||
|
run: |
|
||||||
|
contrib/coverage.bash false
|
||||||
|
- name: Upload coverage report
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: coverage-report
|
||||||
|
path: coverage
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Build RGBDS with gcov support
|
# Build RGBDS with gcov support
|
||||||
|
|
||||||
make coverage -j
|
make coverage -j
|
||||||
|
|
||||||
# Run the tests
|
# Run the tests
|
||||||
@@ -15,13 +14,20 @@ popd
|
|||||||
gcov src/**/*.cpp
|
gcov src/**/*.cpp
|
||||||
mkdir -p coverage
|
mkdir -p coverage
|
||||||
|
|
||||||
# Generate coverage report
|
# Check whether running from coverage.yml workflow
|
||||||
lcov -c --no-external -d . -o coverage/coverage.info --ignore-errors format,inconsistent,unsupported
|
if [ "$1" != "false" ]; then
|
||||||
genhtml -f -s -o coverage/ coverage/coverage.info --ignore-errors category,corrupt,inconsistent
|
# Generate coverage report
|
||||||
|
lcov -c --no-external -d . -o coverage/coverage.info --ignore-errors format,inconsistent,unsupported
|
||||||
|
genhtml -f -s -o coverage/ coverage/coverage.info --ignore-errors category,corrupt,inconsistent
|
||||||
|
|
||||||
# Open report in web browser
|
# Open report in web browser
|
||||||
if [ "$(uname)" == "Darwin" ]; then
|
if [ "$(uname)" == "Darwin" ]; then
|
||||||
open coverage/index.html
|
open coverage/index.html
|
||||||
|
else
|
||||||
|
xdg-open coverage/index.html
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
xdg-open coverage/index.html
|
# Generate coverage report
|
||||||
|
lcov -c --no-external -d . -o coverage/coverage.info
|
||||||
|
genhtml -f -s -o coverage/ coverage/coverage.info
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user