ci(linux): add lcov commands #55
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: linux | |
| on: [push, pull_request] | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| cxx: [g++] | |
| build_type: [Debug] | |
| std: [23] | |
| os: [ubuntu-24.04] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install python virtual environment | |
| run: | | |
| sudo apt-get install python3-venv -y | |
| python3 -m venv $HOME/.venv | |
| - name: Activate python virtual environment | |
| run: | | |
| source $HOME/.venv/bin/activate | |
| export PATH=$HOME/.venv/bin:$PATH | |
| - name: Setup Conan Client | |
| uses: conan-io/setup-conan@v1 | |
| with: | |
| conan_audit_token: ${{ secrets.CONAN_AUDIT_TOKEN }} | |
| cache_packages: true | |
| use_venv: true | |
| - name: Install packages | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install cmake ninja-build python3-pip lcov -y | |
| pip3 install --upgrade pip | |
| pip3 install coverage | |
| - name: Create Build Environment | |
| run: cmake -E make_directory ${{runner.workspace}}/build | |
| - name: CMake Configure | |
| working-directory: ${{runner.workspace}}/build | |
| env: | |
| CXX: ${{matrix.cxx}} | |
| run: | | |
| cmake -S ${GITHUB_WORKSPACE} \ | |
| -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="${GITHUB_WORKSPACE}/cmake/conan_provider.cmake" \ | |
| -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ | |
| -DENABLE_TESTS=True \ | |
| -DENABLE_COVERAGE=True \ | |
| -G "Ninja" | |
| - name: CMake Build | |
| working-directory: ${{runner.workspace}}/build | |
| run: cmake --build . --config ${{matrix.build_type}} | |
| - name: Test | |
| working-directory: ${{runner.workspace}}/build/ | |
| run: ctest --progress --verbose --build-config ${{matrix.build_type}} --output-on-failure | |
| - name: Coverage | |
| working-directory: ${{runner.workspace}}/build/ | |
| run: | | |
| lcov --capture --directory . --output-file coverage.info | |
| lcov --remove coverage.info '/usr/*' --output-file coverage.info | |
| lcov --list coverage.info | |
| - name: Upload codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| fail_ci_if_error: true # optional (default = false) | |
| files: ${{runner.workspace}}/build/coverage.info | |
| # flags: unittests # optional | |
| # name: codecov-umbrella # optional | |
| verbose: true # optional (default = false) | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| # - name: Coverage | |
| # shell: bash | |
| # env: | |
| # CODECOV_TOKEN: "7526d1fa-caa6-41f8-9ed0-41982d2504d4" | |
| # working-directory: ${{runner.workspace}}/build | |
| # run: bash <(curl -s https://codecov.io/bash) |