-
Notifications
You must be signed in to change notification settings - Fork 0
Adopt the estate CodeScene coverage pattern in generated repos #32
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| name: Coverage (main) | ||
|
|
||
| # CodeScene accepts `cs-coverage upload` only for analysed branches, so | ||
| # main-branch coverage is uploaded here on push; pull requests generate | ||
| # coverage (and, in a future fast-follow, run the changed-line | ||
| # `cs-coverage check` gate) in ci.yml instead. This workflow also | ||
| # advances the coverage ratchet baseline: caches saved on main are | ||
| # readable by every pull-request run, so the baseline written here is the | ||
| # one PR ratchet checks compare against. | ||
| # | ||
| # `workflow_dispatch` is mandatory, not a convenience: merges performed by | ||
| # the automerge workflow's GITHUB_TOKEN do not fire push-event workflows, | ||
| # so automerged changes to main only receive coverage via a manual | ||
| # dispatch. | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| coverage-upload: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| env: | ||
| CS_ACCESS_TOKEN: ${{ "{{" }} secrets.CS_ACCESS_TOKEN || '' {{ "}}" }} | ||
| CODESCENE_CLI_SHA256: ${{ "{{" }} vars.CODESCENE_CLI_SHA256 || '' {{ "}}" }} | ||
| {% if use_rust %} | ||
| CARGO_TERM_COLOR: always | ||
| BUILD_PROFILE: debug | ||
| {% endif %} | ||
| steps: | ||
| - name: Check out repository | ||
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | ||
| with: | ||
| python-version: '3.13' | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5 | ||
|
|
||
| {% if use_rust %} | ||
| - name: Set up Rust | ||
| uses: leynos/shared-actions/.github/actions/setup-rust@927edd45ae77be4251a8a18ca9eb5613a2e32cbd | ||
| with: | ||
| toolchain: stable | ||
|
|
||
| {% endif %} | ||
| - name: Generate coverage | ||
| uses: leynos/shared-actions/.github/actions/generate-coverage@927edd45ae77be4251a8a18ca9eb5613a2e32cbd | ||
| with: | ||
| output-path: coverage.xml | ||
| format: cobertura | ||
| artefact-name-suffix: {{ package_name | lower | replace("_", "-") }} | ||
| with-ratchet: 'true' | ||
| {% if use_rust %} | ||
| cargo-manifest: rust_extension/Cargo.toml | ||
| {% endif %} | ||
|
|
||
| - name: Upload coverage data to CodeScene | ||
| if: env.CS_ACCESS_TOKEN != '' | ||
| uses: leynos/shared-actions/.github/actions/upload-codescene-coverage@927edd45ae77be4251a8a18ca9eb5613a2e32cbd | ||
| with: | ||
| format: cobertura | ||
| path: coverage.xml | ||
| access-token: ${{ "{{" }} env.CS_ACCESS_TOKEN {{ "}}" }} | ||
| installer-checksum: ${{ "{{" }} env.CODESCENE_CLI_SHA256 {{ "}}" }} |
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With
with-ratchetenabled here, generated repos rely on the pinnedgenerate-coverageaction to restore the main-branch baseline before PR checks. I checked the pinned action at927edd45ae77be4251a8a18ca9eb5613a2e32cbd: it restores withkey: ratchet-baseline-${{ runner.os }}-${{ github.run_id }}andrestore-keys: ratchet-baseline-${{ runner.os }}-, but saves withkey: ratchet-baseline-${{ runner.os }}. Because GitHub cache restore keys are prefix matches, the saved cache does not start with the restore prefix, so the baseline is never restored and coverage drops compare against the freshly-created0baseline. Please bump/fix the action pin or leave the ratchet disabled until the cache keys align.Useful? React with 👍 / 👎.