summaryrefslogtreecommitdiff
path: root/.github/workflows/coverage.yml
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhsoting.net>2026-05-08 11:54:15 +0200
committerJörg Frings-Fürst <debian@jff-webhsoting.net>2026-05-08 11:54:15 +0200
commit9d62028a6e8eced2ae6fabedd2b6317e9519b00d (patch)
tree1d8458cb6627ccfc673f791c5f0db45f9c06f7e0 /.github/workflows/coverage.yml
parenta1dac799b819ba356a2faff3a98d7f5f076c24b6 (diff)
parent5177d88bf591522d1b934e24221e16e02cd1592b (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to '.github/workflows/coverage.yml')
-rw-r--r--.github/workflows/coverage.yml77
1 files changed, 77 insertions, 0 deletions
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
new file mode 100644
index 0000000..39e4bb1
--- /dev/null
+++ b/.github/workflows/coverage.yml
@@ -0,0 +1,77 @@
+# Copyright (C) 2025 Sebastian Pipping <sebastian@pipping.org>
+# Licensed under the MIT license
+
+name: Run tests under coverage
+
+on:
+ pull_request:
+ push:
+ schedule:
+ - cron: '0 2 * * 5' # Every Friday at 2am
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+jobs:
+ test_coverage:
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+
+ - name: Install Clang 21
+ run: |-
+ set -x
+ source /etc/os-release
+ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
+ sudo add-apt-repository "deb https://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}-21 main"
+ sudo apt-get update # due to new repository
+ sudo apt-get install --yes --no-install-recommends -V \
+ clang-21 \
+ libclang-rt-21-dev \
+ llvm-21
+ echo /usr/lib/llvm-21/bin >>"${GITHUB_PATH}"
+
+ - name: Install other build dependencies
+ run: |-
+ set -x
+ sudo apt-get install --yes --no-install-recommends -V \
+ libgtest-dev
+
+ - name: Build uriparser fuzzers
+ run: |
+ args=(
+ # Build nothing but the test suite
+ -DURIPARSER_BUILD_DOCS=OFF
+ -DURIPARSER_BUILD_TESTS=ON
+ -DURIPARSER_BUILD_TOOLS=OFF
+ -DURIPARSER_ENABLE_INSTALL=OFF
+
+ # Tune compilation to use Clang with code coverage
+ -DCMAKE_C_COMPILER=clang-21
+ -DCMAKE_CXX_COMPILER=clang++-21
+ -DCMAKE_{C,CXX}_FLAGS='-Wall -Wextra -pedantic -O2 -g -fprofile-instr-generate -fcoverage-mapping'
+ -DURIPARSER_WARNINGS_AS_ERRORS=ON
+ )
+ set -x -o pipefail
+ cmake "${args[@]}" -S . -B build
+ make -C build VERBOSE=1 -j$(nproc)
+
+ - name: Run tests under coverage
+ run: |
+ CTEST_OUTPUT_ON_FAILURE=1 make -C build all test
+
+ - name: Generate reports
+ run: |
+ set -x -o pipefail
+ mkdir coverage/
+ llvm-profdata merge -sparse build/default.profraw -o coverage/indexed.profraw
+ llvm-cov show -instr-profile=coverage/indexed.profraw -format=html -output-dir=coverage/html/ build/testrunner
+ llvm-cov report -instr-profile=coverage/indexed.profraw build/testrunner |& tee coverage/report.txt
+
+ - name: Store coverage report
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: uriparser_coverage_${{ github.sha }}
+ path: coverage/
+ if-no-files-found: error