-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate and publish code coverage reports in the CI (#1947)
Fuel-core counterpart for FuelLabs/fuel-vm#750 This PR sets up code coverage reporting. It commits the report to [a branch called `codecov-pages`](https://github.com/FuelLabs/fuel-core/tree/codecov-pages), which contains a folder for each branch. Branch names are urlsafe-base64-encoded to avoid (security) bugs. Every time a PR workflow runs or the `master` receives new commits, a CI action pushes updated codecov report there. ## Repository setup The configuration has to be done by someone who has permission to edit [the repo settings](https://github.com/FuelLabs/fuel-core/settings/pages): set deployment from `codecov-pages` branch, like this: <img width="510" alt="Screenshot of the settings page" src="https://github.com/FuelLabs/fuel-vm/assets/2204863/e22d5c43-825d-4fd2-b5e1-0a2c3e826ce8"> --------- Co-authored-by: Mitchell Turner <james.mitchell.turner@gmail.com>
- Loading branch information
1 parent
8b1bf02
commit 12cb17f
Showing
4 changed files
with
73 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!python3 | ||
# Generate index.html for code coverage pages | ||
|
||
from glob import iglob | ||
from base64 import urlsafe_b64encode, urlsafe_b64decode | ||
|
||
master_path = urlsafe_b64encode(b"master").decode("utf-8") | ||
|
||
print("<html><head><title>Code Coverage</title>") | ||
print("<style>body { font-size: 1.2em }</style>") | ||
print(f"</head><body><h1>Code coverage</h1>") | ||
print(f"<h2>Per branch (<a href=\"{master_path}/index.html\">master</a>)</h2><ul>") | ||
for path in sorted(list(iglob("*/index.html", recursive=True))): | ||
name = urlsafe_b64decode(path.split("/")[0].encode()).decode() | ||
style = "font-weight: bold" if name == "master" else "" | ||
print(f'<li style="{style}"><a href="{path}">{name}</a></li>') | ||
print("</ul></body></html>") |
This file contains 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
This file contains 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