fix(csharp-ci): pin Record-shard-result to workspace for non-root working-directory callers#28
Merged
Conversation
…ing-directory callers upload artifacts
The v2.2.0 badge feature added a `Record shard result` run-step and an
`Upload shard result` upload-artifact step. `Record shard result` had no
`working-directory:` override, so it inherited the job's
`defaults.run.working-directory` (`inputs.working-directory`). For a caller
passing `working-directory: csharp` it wrote `csharp/ci-result/<name>.txt`.
`actions/upload-artifact` ignores `defaults.run.working-directory` and
resolves its `path:` relative to the repo root, so `Upload shard result`
looked for `./ci-result/<name>.txt`, which did not exist, and failed with
`No files were found with the provided path: ci-result/<name>.txt` under
`if-no-files-found: error`. This broke every caller with a non-root
`working-directory` (observed in peacefulstudio/canton-localnet-internal,
PR #102: steps 1-19 including coverage at 95% pass; only the shard upload
fails).
Pin `Record shard result` to `working-directory: ${{ github.workspace }}`
so it writes `ci-result/<name>.txt` at the repo root, matching where
`upload-artifact` reads — mirroring how the adjacent coverage
Extract/Prepend/Write steps are already pinned. The coverage upload pair
and the pack `Compute artifact path`/`Upload nupkg artifact` pair were
audited and already resolve their paths at the repo root, so no other site
needed changing.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
csharp-ci.yaml'sUpload shard resultstep (added in v2.2.0's badge feature) fails for any caller passing a non-rootworking-directory(e.g.working-directory: csharp).Record shard resultrun:step had noworking-directory:override, so it inherited the job'sdefaults.run.working-directoryand wrote<working-directory>/ci-result/<name>.txt.actions/upload-artifactignoresdefaults.run.working-directoryand resolvespath:relative to the repo root, so the upload looked for./ci-result/<name>.txt, didn't find it, and failed underif-no-files-found: error.Record shard resulttoworking-directory: ${{ github.workspace }}so it writes at the repo root, exactly mirroring how the adjacent coverage steps (Extract coverage percentage,Prepend coverage title,Write to Job Summary) are already pinned.Observed downstream in
peacefulstudio/canton-localnet-internalPR #102: steps 1–19 (including coverage at 95% andRecord shard result) all succeed; only step 20Upload shard resultfails withNo files were found with the provided path: ci-result/ubuntu-latest.txt.Audited every
actions/upload-artifact/download-artifactsite in the file:Extract coverage percentagealready pinned to${{ github.workspace }}. OK.packjobUpload nupkg artifact— itspath:comes fromCompute artifact path, which runs at${{ github.workspace }}and explicitly prepends$WD/, so it's already root-relative. OK.coverage-output/matrix-outputdownload steps run in separate jobs with nodefaults.run.working-directory, so they resolve at root. OK.Only
Record shard resultneeded the fix.Type of change
Test plan
actionlintclean oncsharp-ci.yamlpython3 -c "import yaml; yaml.safe_load(...)")@v2carries this, the failingci / build-and-testjob onpeacefulstudio/canton-localnet-internalPR #102 is re-run to confirm green. (N/A unit tests — workflow-only change.)Record shard resultwrite path vs.upload-artifactread path for aworking-directory: csharpcaller.Checklist
[Unreleased]entry inCHANGELOG.mdfor user-visible changesBreaking changes / migration notes
None.