| name: Code Coverage |
| |
| on: |
| pull_request: |
| push: |
| branches: |
| - master |
| |
| env: |
| BUILD_TYPE: Debug |
| |
| jobs: |
| build: |
| name: Coveralls |
| runs-on: ubuntu-latest |
| |
| steps: |
| - name: Checkout |
| uses: actions/checkout@v4 |
| with: |
| submodules: true |
| persist-credentials: false |
| - name: Download and install lcov |
| run: | |
| VERSION="1.15" |
| mkdir lcov_pkg && cd lcov_pkg |
| wget "https://github.com/linux-test-project/lcov/releases/download/v$VERSION/lcov-$VERSION.tar.gz" |
| tar -xzf "lcov-$VERSION.tar.gz" |
| cd "lcov-$VERSION" |
| sudo make install |
| - name: Configure |
| run: cd build && cmake .. -DCOVERAGE=ON |
| - name: Build unit tests |
| run: cmake --build build |
| - name: Run tests |
| run: cmake --build build --target test |
| - name: Generate coverage .info |
| run: cmake --build build --target coverage_report |
| - name: Post to Coveralls |
| uses: coverallsapp/github-action@master |
| with: |
| github-token: ${{ secrets.GITHUB_TOKEN }} |
| path-to-lcov: build/lcov.info |