Improve SonarCloud quality #460
Workflow file for this run
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: Code Coverage | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| PYTHON_VERSION: '3.12' | |
| jobs: | |
| build-ubuntu: | |
| strategy: | |
| matrix: | |
| include: | |
| # Ubuntu 24.04 + gcc-14 | |
| - name: "Ubuntu 24.04 + gcc-14" | |
| os: ubuntu-24.04 | |
| compiler: gcc | |
| version: "14" | |
| runs-on: ${{ matrix.os }} | |
| name: 🧪 Code Coverage - Codecov | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install packages | |
| run: sudo apt-get update && sudo apt-get install -yq autoconf autoconf-archive automake libtool lcov | |
| - name: Configure Compiler | |
| run: | | |
| if [ "${{ matrix.compiler }}" = "gcc" ]; then | |
| echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV | |
| echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV | |
| else | |
| echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV | |
| echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV | |
| fi | |
| - name: Configure Build | |
| run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_COVERAGE=ON -DCMAKE_TOOLCHAIN_FILE="${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" .. | |
| - name: Build | |
| run: cd build && make | |
| - name: Run Unit Test | |
| run: /home/runner/work/RosettaStone/RosettaStone/build/bin/UnitTests | |
| - name: Collect coverage report | |
| run: | | |
| GCOV_TOOL="$(command -v gcov-${{ matrix.version }})" | |
| lcov --gcov-tool "${GCOV_TOOL}" --directory build --capture --output-file build/coverage.info | |
| lcov --ignore-errors unused --gcov-tool "${GCOV_TOOL}" --remove build/coverage.info '/usr/*' '*/Tests/*' --output-file build/coverage.info.cleaned | |
| - name: Upload Coverage Reports to Codecov | |
| uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac # v5 | |
| with: | |
| fail_ci_if_error: true | |
| files: ./build/coverage.info.cleaned | |
| flags: unittests | |
| name: ubuntu-codecov | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true |