Update gcovr command to ignore errors #6
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: CI | |
| on: | |
| # Trigger on pushes ONLY to the main branch | |
| push: | |
| branches: [ "main" ] | |
| # Trigger on PRs targeting the main branch | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download Test Data | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Built-in token, no setup needed | |
| run: | | |
| # Download specific file from the specific tag | |
| gh release download timescales-data-v1 -p "data.zip" | |
| unzip data.zip | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get install -y gcovr libboost-all-dev | |
| - name: Configure & Build | |
| run: | | |
| cmake -B build -DENABLE_COVERAGE=ON | |
| cmake --build build | |
| - name: Test & Generate Report | |
| run: | | |
| # Run tests | |
| ./build/tests/unit_tests | |
| # 2. Run gcovr from the root | |
| # --root . : explicit root | |
| # --filter "include/" : keeps files that have 'include/' in their path | |
| # --print-summary : prints text output to the GitHub console (so you can verify immediately) | |
| gcovr --root . --filter "include/" --gcov-ignore-errors=no_working_dir_found --print-summary --xml -o build/tests/coverage.xml build | |
| - name: Upload to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./build/tests/coverage.xml | |
| fail_ci_if_error: true |