[CONFIG] [Github Actions] trying to collect better coverage to sonarc… #349
This file contains hidden or 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: C++ CI Coverage | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: ["main"] | |
pull_request: | |
# The branches below must be a subset of the branches above | |
branches: ["main"] | |
workflow_dispatch: | |
jobs: | |
coverage: | |
name: C++ CMake CI Coverage | |
runs-on: macos-14 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
- name: Install Tools | |
shell: bash | |
run: | | |
# Install vcpkg | |
export VCPKG_VERSION=2025.02.14 | |
git clone \ | |
--depth 1 \ | |
--branch $VCPKG_VERSION \ | |
https://github.com/microsoft/vcpkg.git \ | |
--single-branch \ | |
"$HOME/vcpkg" | |
export VCPKG_ROOT="$HOME/vcpkg" | |
echo "$VCPKG_ROOT" >> $GITHUB_PATH | |
sh $VCPKG_ROOT/bootstrap-vcpkg.sh | |
echo "VCPKG_ROOT=$HOME/vcpkg" >> $GITHUB_ENV | |
# lcov is available via homebrew | |
brew install lcov | |
- name: Check Tools | |
run: | | |
make --version | |
cmake --version | |
vcpkg --version | |
lcov --version | |
- name: Install dependencies | |
run: | | |
make dependencies | |
# yamllint disable rule:line-length | |
- name: Build | |
run: | | |
export VCPKG_ROOT=/usr/local/share/vcpkg | |
make build | |
# yamllint enable rule:line-length | |
- name: Test / Coverage | |
run: make coverage | |
- name: Upload coverage reports to Codecov with GitHub Action | |
uses: codecov/codecov-action@v5 | |
with: | |
directory: ./coverage | |
files: coverage/lcov.info | |
token: ${{ secrets.CODECOV_TOKEN }} # required | |
verbose: true # optional (default = false) |