Bump codecov/codecov-action from 3 to 4 #117
Workflow file for this run
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: tests | |
on: | |
push: | |
pull_request: | |
jobs: | |
build: | |
name: ${{matrix.os}} ${{ matrix.description }} (C++ ${{ matrix.cppstd }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-20.04 | |
# oldest LLVM that the install-llvm-action action is able to install | |
llvm-version: "5" | |
description: "LLVM 5" | |
cppstd: "11 14 17" | |
gcov_executable: "llvm-cov gcov" | |
- os: ubuntu-20.04 | |
# oldest GCC that the setup-gcc action is able to install | |
gcc-version: "7" | |
description: "GCC 7" | |
cppstd: "11 14" | |
- os: ubuntu-latest | |
gcc-version: "13" | |
description: "GCC 13" | |
cppstd: "11 14 17 20 23" | |
- os: ubuntu-latest | |
# default GCC, which has gcov | |
cppstd: "11 14 17 20 23" | |
gcov_executable: "gcov" | |
- os: macos-latest | |
# uses Apple Clang | |
cppstd: "11 14 17 20 23" | |
gcov_executable: "llvm-cov gcov" | |
- os: windows-latest | |
# uses MSVC | |
cppstd: "11 14 17 20 23" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup GCC | |
uses: egor-tensin/setup-gcc@v1 | |
if: ${{ matrix.gcc-version != '' }} | |
with: | |
version: ${{ matrix.gcc-version }} | |
- name: Setup LLVM and Clang | |
uses: KyleMayes/install-llvm-action@v1 | |
if: ${{ matrix.llvm-version != '' }} | |
with: | |
version: ${{ matrix.llvm-version }} | |
env: true | |
- name: Build and Test | |
run: | | |
pip install gcovr | |
for cppstd in ${{ matrix.cppstd }}; do | |
echo "" | |
echo "" | |
echo "Testing C++${cppstd}" | |
BUILD="build-cpp${cppstd}" | |
cmake -S . -B $BUILD -DCMAKE_CXX_STANDARD=${cppstd} -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON -DTASK_THREAD_POOL_TEST=ON -DTASK_THREAD_POOL_TEST_COVERAGE=ON -DTASK_THREAD_POOL_BENCH=ON | |
cmake --build $BUILD --config Debug | |
cd $BUILD/tests | |
ctest -C Debug --output-on-failure --verbose | |
if [ -n '${{ matrix.gcov_executable }}' ]; then | |
gcovr --delete --root ../../ --print-summary --xml coverage.xml . --gcov-executable '${{ matrix.gcov_executable }}' --merge-mode-functions=separate --gcov-ignore-parse-errors=negative_hits.warn_once_per_file | |
fi | |
cd ../.. | |
done | |
shell: bash | |
- name: Create code coverage report (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
choco install opencppcoverage | |
for cppstd in ${{ matrix.cppstd }}; do | |
cd build-cpp${cppstd}/tests | |
OpenCppCoverage.exe --export_type cobertura:coverage.xml --cover_children -- ctest -C Debug | |
cd ../.. | |
done | |
- name: Upload Coverage to Codecov | |
if: matrix.gcov_executable != '' || runner.os == 'Windows' | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
verbose: true | |
token: ${{ secrets.CODECOV_TOKEN }} |