From 611b0041c4fcc33b05a227d3fc8283237eae9f4b Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Sat, 12 Jul 2025 10:11:23 -0400 Subject: [PATCH] Exclude Bison-generated files from coverage report, and use dark theme (#1742) --- .github/workflows/coverage.yml | 8 ++++++-- contrib/coverage.bash | 14 ++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 24d2a7a1..ec942257 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -5,7 +5,7 @@ on: jobs: coverage: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout repo uses: actions/checkout@v4 @@ -27,4 +27,8 @@ jobs: uses: actions/upload-artifact@v4 with: name: coverage-report - path: coverage + # Workaround for keeping the top-level coverage/ directory + # https://github.com/actions/upload-artifact/issues/174 + path: | + coverage + dummy-file-to-keep-directory-structure.txt diff --git a/contrib/coverage.bash b/contrib/coverage.bash index c0607e18..489b4d95 100755 --- a/contrib/coverage.bash +++ b/contrib/coverage.bash @@ -14,20 +14,18 @@ popd gcov src/**/*.cpp mkdir -p coverage +# Generate coverage report, excluding Bison-generated files +COVERAGE_INFO=coverage/coverage.info +lcov -c --no-external -d . -o "$COVERAGE_INFO" +lcov -r "$COVERAGE_INFO" src/asm/parser.{hpp,cpp} src/link/script.{hpp,cpp} -o "$COVERAGE_INFO" +genhtml --dark-mode -f -s -o coverage/ "$COVERAGE_INFO" + # Check whether running from coverage.yml workflow if [ "$1" != "false" ]; then - # 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 if [ "$(uname)" == "Darwin" ]; then open coverage/index.html else xdg-open coverage/index.html fi -else - # Generate coverage report - lcov -c --no-external -d . -o coverage/coverage.info - genhtml -f -s -o coverage/ coverage/coverage.info fi