Merge pull request #30 from yobeonline/mismatch #196
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: code coverage | |
on: [push] | |
jobs: | |
coverage: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get latest cmake | |
uses: lukka/get-cmake@latest | |
- name: Install gcovr | |
run: pip install gcovr | |
- name: Configure | |
env: | |
CXXFLAGS: --coverage -fprofile-abs-path -g -O1 | |
CFLAGS: --coverage -fprofile-abs-path -g -O1 | |
LDFLAGS: --coverage | |
CC: gcc-13 | |
CXX: g++-13 # gcov (!= gcovr) version should match | |
run: cmake -S . -B build -D VCPKG_TARGET_TRIPLET=x64-linux --toolchain "${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" | |
- name: Build | |
run: cmake --build build --parallel | |
- name: Execute | |
run: ctest --test-dir build | |
- name: Create report | |
run: | | |
mkdir build/html | |
gcovr --gcov-executable /usr/bin/gcov-13 --filter include/io1/money.hpp --exclude-unreachable-branches --exclude-lines-by-pattern '.*assert.*' --print-summary -x build/coverage.xml --html-details build/html/index.html --html-details-syntax-highlighting -r . build | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: detailed coverage report | |
path: build/html | |
- uses: irongut/[email protected] | |
with: | |
filename: build/coverage.xml | |
badge: true | |
fail_below_min: true | |
format: markdown | |
output: both | |
thresholds: '75 90' | |
- name: Add Coverage PR Comment | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message-id: coverage | |
refresh-message-position: true | |
message-path: code-coverage-results.md |