name: Test coverage
on:
schedule:
- cron: "30 7 * * 1"
workflow_dispatch:
concurrency:
group: coverage-${{ github.workflow }}
cancel-in-progress: false
permissions:
contents: write
jobs:
llvm-cov:
name: cargo llvm-cov
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: llvm-tools-preview
- uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- name: Generate coverage (HTML report)
run: |
cargo llvm-cov --workspace --html --output-dir llvm-cov-html
- name: Upload HTML report artifact
uses: actions/upload-artifact@v4
with:
name: llvm-cov-html
path: llvm-cov-html/
retention-days: 90
if-no-files-found: error
- name: Job summary (stable links)
run: |
{
echo "### Test coverage (cargo-llvm-cov)"
echo ""
echo "**Stable links (same URL every week; pick the latest green run):**"
echo "- [Scheduled workflow runs](${{ github.server_url }}/${{ github.repository }}/actions/workflows/coverage.yml?query=event%3Aschedule)"
echo "- [All runs (incl. manual)](${{ github.server_url }}/${{ github.repository }}/actions/workflows/coverage.yml)"
echo ""
echo "**This run:** [artifacts and logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) — download **llvm-cov-html**, unzip, open \`index.html\`."
echo ""
echo "**Browsable site:** Pages must use branch **main** and folder **/docs**; coverage is then at **\`/llvm-cov/\`** (see repo README)."
} >> "$GITHUB_STEP_SUMMARY"
publish-llvm-cov-to-main:
name: Publish HTML to main (docs/llvm-cov/)
needs: llvm-cov
if: >-
github.ref == 'refs/heads/main' &&
(github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: llvm-cov-html
path: llvm-cov-html
- name: Commit docs/llvm-cov/ on main for Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: main
publish_dir: ./llvm-cov-html
destination_dir: docs/llvm-cov
keep_files: true
user_name: github-actions
user_email: github-actions@github.com
commit_message: "chore: refresh llvm-cov HTML report [skip ci]"