1212permissions :
1313 contents : read
1414 pull-requests : write
15+ pages : write
16+ id-token : write
1517
1618defaults :
1719 run :
6769 --json \
6870 --output-path coverage.json
6971
72+ - name : Generate HTML coverage report
73+ run : |
74+ cargo llvm-cov --workspace \
75+ --features lambda-rs/with-vulkan,lambda-rs/audio-output-device \
76+ --html \
77+ --output-dir coverage-html \
78+ --no-run
79+
7080 - name : Get changed files in PR
7181 if : github.event_name == 'pull_request'
7282 id : changed
@@ -97,11 +107,18 @@ jobs:
97107 id : comment
98108 env :
99109 CHANGED_FILES : ${{ steps.changed.outputs.files }}
110+ RUN_ID : ${{ github.run_id }}
111+ REPO : ${{ github.repository }}
100112 run : |
113+ # Base URL for GitHub Pages coverage (from main branch)
114+ PAGES_BASE="https://lambda-sh.github.io/lambda/coverage"
115+
101116 # Build the comment body
102117 {
103118 echo "### ✅ Coverage Report"
104119 echo ""
120+ echo "📊 [View Full HTML Report](https://github.com/${REPO}/actions/runs/${RUN_ID}) (download artifact)"
121+ echo ""
105122 echo "#### Overall Coverage"
106123 echo ""
107124 echo "| Metric | Value |"
@@ -129,7 +146,9 @@ jobs:
129146 file_total=$(echo "$match" | cut -d'|' -f4)
130147 # Format percentage to 2 decimal places
131148 file_pct_fmt=$(printf "%.2f" "$file_pct")
132- echo "| \`${file}\` | ${file_pct_fmt}% | ${file_covered}/${file_total} |"
149+ # Create HTML filename (replace / with path structure, add .html)
150+ html_file=$(echo "$file" | sed 's|/|/|g').html
151+ echo "| [\`${file}\`](${PAGES_BASE}/${html_file}) | ${file_pct_fmt}% | ${file_covered}/${file_total} |"
133152 pr_covered=$((pr_covered + file_covered))
134153 pr_total=$((pr_total + file_total))
135154 else
@@ -148,7 +167,7 @@ jobs:
148167
149168 echo ""
150169 echo "---"
151- echo "*Generated by [cargo-llvm-cov](https://github.com/taiki-e/cargo-llvm-cov)*"
170+ echo "*Generated by [cargo-llvm-cov](https://github.com/taiki-e/cargo-llvm-cov) · [Latest main coverage](${PAGES_BASE}) *"
152171 } > comment_body.md
153172
154173 # Store as output (handle multiline)
@@ -210,9 +229,46 @@ jobs:
210229 console.log('Created new coverage comment');
211230 }
212231
232+ - name : Upload coverage HTML as artifact
233+ uses : actions/upload-artifact@v4
234+ with :
235+ name : coverage-html-report
236+ path : coverage-html/
237+ retention-days : 30
238+
213239 - name : Upload coverage JSON as artifact
214240 uses : actions/upload-artifact@v4
215241 with :
216- name : coverage-report
242+ name : coverage-json
217243 path : coverage.json
218244 retention-days : 30
245+
246+ # Deploy HTML report to GitHub Pages on pushes to main
247+ deploy-coverage :
248+ name : Deploy coverage to GitHub Pages
249+ needs : coverage
250+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
251+ runs-on : ubuntu-latest
252+
253+ environment :
254+ name : github-pages
255+ url : ${{ steps.deployment.outputs.page_url }}
256+
257+ steps :
258+ - name : Download coverage HTML artifact
259+ uses : actions/download-artifact@v4
260+ with :
261+ name : coverage-html-report
262+ path : coverage-html
263+
264+ - name : Setup Pages
265+ uses : actions/configure-pages@v4
266+
267+ - name : Upload to GitHub Pages
268+ uses : actions/upload-pages-artifact@v3
269+ with :
270+ path : coverage-html
271+
272+ - name : Deploy to GitHub Pages
273+ id : deployment
274+ uses : actions/deploy-pages@v4
0 commit comments