feat: upload fork pull request coverage to Codecov - #4931
Draft
ernst-dev wants to merge 1 commit into
Draft
Conversation
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.
Change
Adds the Codecov fork-coverage wrapper to this repository, so fork pull requests report coverage again. Fork PRs run without secrets, so
CODECOV_TOKENis unavailable and the upload cannot happen from the build job.Two files, because this repository fans the shared build over a react matrix:
build-lint-test.ymlnow passescoverage-artifact-name: coverage-report-react${{ matrix.react }}. Artifact names must be unique within a workflow run, and this repository runs two build legs (react: [16, 18]), so the matrix has to be templated into the name — exactly as this file already does forartifact-name: dev-pages-react${{ matrix.react }}. Without this, both legs would uploadcoverage-reportandactions/upload-artifact@v4would reject the second, failing a build job on fork PRs only.codecov-fork-upload.ymlis the newworkflow_runwrapper. It mirrors this repository's existingdeploy-fork-preview.yml— same trigger shape, workflow-levelpermissions,secrets: inherit, and the samestrategy.matrix.react: [16, 18]fan-out passing a per-legartifact-name, so each leg downloads its own coverage artifact.All privileged logic lives in
cloudscape-design/actions; these are only the rollout units. The wrapper never checks out or executes fork code.Both legs upload, and that is intended
Each leg uploads against the same commit. Codecov's documented behaviour is to merge: "Codecov does not override report data for multiple uploads. We always merge the data." It also holds PR comments until all uploads are in. So the fan-out yields a more complete report than designating a single leg, and it matches how dev-pages already fans out here.
Verified for this repo, not assumed
The caller workflow's
name:is exactlyBuild, lint and test, matching this wrapper'sworkflow_run.workflowsentry.workflow_runmatches on workflow name, so a mismatch would silently never fire.coverage/is the correct output path:jest.unit.config.jssetscollectCoveragewhenCI === 'true', and neither it nor@cloudscape-design/jest-presetsetscoverageDirectoryorcoverageReporters, so jest's defaults apply and coverage lands in./coverage.This wrapper deliberately differs from the four single-leg wrappers (
board-components,chart-components,chat-components,code-view): it carries a matrix and passeswith:, and it uses this repository's single-quotedworkflows: ['Build, lint and test']style. Local consistency withdeploy-fork-preview.ymlwas preferred over uniformity across repositories.Rollout order
cloudscape-design/actions#132 must merge first — it adds the
coverage-artifact-nameinput this PR passes.cloudscape-design/actions#131, which added the flow itself, has already landed.The upstream workflow runs with
continue-on-error: true, so a failure there can never block a pull request. The attribution risk and the first-run checks are documented in #131.Must never be a required status check
This workflow deliberately does not run on
merge_group(it only triggers onworkflow_runof a pull request build). Adding it as a required status check would deadlock the merge queue.Context: cloudscape-design/actions#131, cloudscape-design/actions#132, cloudscape-design/build-tools#78.