-
Notifications
You must be signed in to change notification settings - Fork 17
Add script and github workflow to ratchet coverage to 100% #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
33de99b
5bfede7
c70a150
ac4caf7
4b2c8a5
e32938f
5ade202
cb460e4
ea5296e
f68588b
d393d1b
5adf9e4
efb1264
bc294e6
1b9406b
087abf0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "nocov": 564 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -157,11 +157,13 @@ jobs: | |
| name: coverage | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| contents: write # needed for ratchet auto-update | ||
| pull-requests: write # needed for creating PRs on main | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| # persist-credentials needed for git push in the auto-update step below | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 # zizmor: ignore[artipacked] | ||
| with: | ||
| persist-credentials: false | ||
| ref: ${{ github.head_ref || github.ref }} | ||
|
|
||
|
DRMacIver marked this conversation as resolved.
|
||
| - name: Install Rust | ||
| run: rustup toolchain install stable --profile minimal -c llvm-tools-preview | ||
|
|
@@ -177,6 +179,40 @@ jobs: | |
| - name: Run coverage | ||
| run: just check-coverage | ||
|
|
||
| - name: Auto-update coverage annotations and ratchet | ||
| if: success() | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
|
Comment on lines
181
to
+185
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm confused why we need an auto-update job - shouldn't CI fail at PR-time if
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should, but we've seen enough things go out of sync when multiple merges happen that I wanted a fallback. I'd be happy to remove this if we add "require branches to be up to date before merging" but that's a bit of a pain in the ass.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code as written has confusing semantics to a reader. The intent of the person who wrote the code (you) was that we should be alerted if an edge case occurs that we don't expect to occur. A reasonable reader of the code instead reads this as "this is an integral part to the coverage ratchet workflow and can't be removed". There should be a comment here at least!
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that's fair. I'll add a comment in. |
||
| run: | | ||
| if git diff --quiet; then | ||
| echo "No coverage annotation changes needed" | ||
| exit 0 | ||
| fi | ||
|
|
||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add -u | ||
| git add .github/coverage-ratchet.json | ||
|
|
||
| if git diff --cached --quiet; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| if [ "${{ github.event_name }}" = "pull_request" ]; then | ||
| git commit -m "Auto-update coverage annotations and ratchet" | ||
| git push | ||
| else | ||
| BRANCH="auto/coverage-ratchet-update" | ||
| git checkout -b "$BRANCH" | ||
| git commit -m "Auto-update coverage annotations and ratchet" | ||
| git push -f origin "$BRANCH" | ||
| gh pr create \ | ||
| --title "Auto-update coverage ratchet" \ | ||
| --body "The coverage ratchet has tightened on main. This PR updates the ratchet file and removes unnecessary annotations." \ | ||
| --base main \ | ||
| --head "$BRANCH" || true | ||
| fi | ||
|
DRMacIver marked this conversation as resolved.
|
||
|
|
||
| conformance: | ||
| name: conformance | ||
| runs-on: ubuntu-latest | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.