Merge branch 'release' into prerelease #8
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: coverage | |
| on: | |
| push: | |
| branches: [prerelease] | |
| pull_request: | |
| branches: [prerelease] | |
| 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 cmake build-essential | |
| - name: Configure | |
| run: | | |
| cmake -S . -B build -DENABLE_COVERAGE=ON | |
| - name: Build | |
| run: cmake --build build | |
| - name: Test | |
| run: ctest --test-dir build --output-on-failure | |
| - name: Generate coverage report | |
| run: | | |
| lcov --capture --directory build --output-file coverage.info | |
| lcov --remove coverage.info '/usr/*' --output-file coverage.info | |
| genhtml coverage.info --output-directory docs/coverage --title "yafl Code Coverage" | |
| - name: Normalize coverage HTML timestamps | |
| run: | | |
| # Remove or normalize timestamps from generated HTML to avoid merge conflicts | |
| find docs/coverage -name "*.html" -type f -exec sed -i 's/<td class="headerValue">[^<]*<\/td>/<td class="headerValue">Generated<\/td>/g' {} \; | |
| echo "Normalized timestamps in coverage HTML files" | |
| - name: Generate coverage badge | |
| run: | | |
| chmod +x scripts/make_coverage_badge.sh | |
| scripts/make_coverage_badge.sh docs/coverage.svg coverage.info | |
| - name: Create GitHub Pages configuration | |
| run: | | |
| touch docs/.nojekyll | |
| - name: Commit and push coverage badge to prerelease | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/prerelease' | |
| run: | | |
| git config user.name "GitHub Actions" | |
| git config user.email "actions@github.com" | |
| git add docs/coverage.svg | |
| if git diff --quiet --cached; then | |
| echo "No coverage badge changes to commit" | |
| else | |
| git commit -m "Update code coverage badge [skip ci]" && git push origin prerelease | |
| fi |