# SPDX-FileCopyrightText: 2026 Progmasoft # SPDX-License-Identifier: MPL-2.0 WITH AdditionRef-Progmasoft-Exception-2.0 name: Native coverage on: push: branches: [devel] pull_request: workflow_dispatch: permissions: contents: read jobs: coverage: runs-on: ubuntu-26.04 timeout-minutes: 40 permissions: contents: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Install Clang, LLVM tools, CMake and Ninja run: | sudo apt-get update sudo apt-get install -y clang llvm cmake ninja-build python3 - name: Configure Clang coverage build run: >- cmake --preset basic-tests -G Ninja -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS='-fprofile-instr-generate -fcoverage-mapping' -DCMAKE_EXE_LINKER_FLAGS='-fprofile-instr-generate' -DCMAKE_SHARED_LINKER_FLAGS='-fprofile-instr-generate' - run: cmake --build build --parallel 4 --target SelfTest ProgmasoftSelfTest - name: Run framework and Progmasoft tests env: LLVM_PROFILE_FILE: catch3-%p.profraw run: ctest --test-dir build --output-on-failure -R '^(RunTests|Progmasoft::PropertyTests)$' - name: Export LLVM source coverage run: | llvm-profdata merge -sparse build/tests/catch3-*.profraw -o catch3.profdata llvm-cov export \ -instr-profile=catch3.profdata \ -format=lcov \ build/tests/SelfTest \ -object=build/tests/ProgmasoftSelfTest \ > catch3.lcov - name: Upload coverage artifact for Codecov uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: catch3-native-coverage path: catch3.lcov if-no-files-found: error retention-days: 1 codecov: needs: coverage if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-26.04 permissions: id-token: write steps: - name: Download coverage artifact uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: catch3-native-coverage path: coverage - name: Upload coverage to Codecov uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 with: use_oidc: true files: coverage/catch3.lcov flags: catch3-native fail_ci_if_error: true