Rename from libshotscope to libgolf, ShotScope is a real company (who… #14
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" ] | |
| jobs: | |
| coverage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y lcov | |
| - name: Configure CMake with Coverage | |
| env: | |
| CC: gcc | |
| CXX: g++ | |
| run: | | |
| cmake -B build \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DENABLE_COVERAGE=ON | |
| - name: Build | |
| run: cmake --build build | |
| - name: Run tests | |
| working-directory: build | |
| run: ctest --output-on-failure | |
| - name: Generate coverage report | |
| run: | | |
| lcov --directory . --capture --output-file coverage.info --ignore-errors mismatch | |
| lcov --remove coverage.info '/usr/*' '*/build/_deps/*' '*/test/*' --output-file coverage.info --ignore-errors unused | |
| lcov --list coverage.info | |
| - name: Generate HTML coverage report | |
| run: | | |
| genhtml coverage.info --output-directory coverage_html | |
| - name: Generate coverage summary | |
| run: | | |
| echo "## Code Coverage Summary" > coverage-summary.txt | |
| lcov --summary coverage.info 2>&1 | tee -a coverage-summary.txt | |
| - name: Upload coverage HTML | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: coverage_html/ | |
| - name: Upload coverage summary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-summary | |
| path: coverage-summary.txt |