Skip to content

Commit 6fd9c76

Browse files
committed
ci: upload PR E2E coverage from originating run
1 parent 5f71f55 commit 6fd9c76

2 files changed

Lines changed: 46 additions & 6 deletions

File tree

.github/workflows/ci-tests-e2e-coverage.yaml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
name: 'CI: E2E Coverage'
22

33
on:
4+
workflow_call:
5+
inputs:
6+
source_branch:
7+
required: true
8+
type: string
9+
source_pr:
10+
required: false
11+
type: string
12+
source_run_id:
13+
required: true
14+
type: string
15+
source_sha:
16+
required: true
17+
type: string
18+
secrets:
19+
CODECOV_TOKEN:
20+
required: true
421
workflow_run:
522
workflows: ['CI: Tests E2E']
623
types:
724
- completed
825

926
concurrency:
10-
group: e2e-coverage-${{ github.event.workflow_run.head_sha }}
27+
group: e2e-coverage-${{ inputs.source_sha || github.event.workflow_run.head_sha }}
1128
cancel-in-progress: true
1229

1330
permissions:
@@ -18,6 +35,10 @@ jobs:
1835
# Not gated on full success: fail-fast:false means one flaky shard flips the whole run to failure, which would skip merging every other shard's real coverage.
1936
if: >
2037
github.repository == 'Comfy-Org/ComfyUI_frontend' &&
38+
(github.event_name == 'workflow_call' ||
39+
github.event.workflow_run.event != 'pull_request' ||
40+
github.event.workflow_run.head_repository.full_name != github.repository ||
41+
github.event.workflow_run.actor.login == 'dependabot[bot]') &&
2142
github.event.workflow_run.conclusion != 'cancelled'
2243
runs-on: ubuntu-latest
2344
timeout-minutes: 10
@@ -28,15 +49,15 @@ jobs:
2849
- name: Checkout sources for genhtml
2950
uses: actions/checkout@v7
3051
with:
31-
ref: ${{ github.event.workflow_run.head_sha }}
52+
ref: ${{ inputs.source_sha || github.event.workflow_run.head_sha }}
3253
sparse-checkout: |
3354
src
3455
packages
3556
3657
- name: Download all shard coverage data
3758
uses: dawidd6/action-download-artifact@0bd50d53a6d7fb5cb921e607957e9cc12b4ce392 # v12
3859
with:
39-
run_id: ${{ github.event.workflow_run.id }}
60+
run_id: ${{ inputs.source_run_id || github.event.workflow_run.id }}
4061
name: e2e-coverage-shard-.*
4162
name_is_regexp: true
4263
path: temp/coverage-shards
@@ -123,9 +144,9 @@ jobs:
123144
with:
124145
files: coverage/playwright/coverage.lcov
125146
flags: e2e
126-
override_branch: ${{ github.event.workflow_run.head_branch }}
127-
override_commit: ${{ github.event.workflow_run.head_sha }}
128-
override_pr: ${{ github.event.workflow_run.pull_requests[0].number }}
147+
override_branch: ${{ inputs.source_branch || github.event.workflow_run.head_branch }}
148+
override_commit: ${{ inputs.source_sha || github.event.workflow_run.head_sha }}
149+
override_pr: ${{ inputs.source_pr || github.event.workflow_run.pull_requests[0].number }}
129150
token: ${{ secrets.CODECOV_TOKEN }}
130151
fail_ci_if_error: false
131152

.github/workflows/ci-tests-e2e.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,25 @@ jobs:
223223
[[ "$SHARDED" != "success" || "$BROWSERS" != "success" || ( "$VIDEO" != "success" && "$VIDEO" != "skipped" ) ]] && echo "E2E failed" && exit 1
224224
echo "E2E passed"
225225
226+
upload-e2e-coverage:
227+
needs: [changes, playwright-tests-chromium-sharded]
228+
if: >-
229+
${{
230+
always() &&
231+
needs.changes.outputs.should-run == 'true' &&
232+
github.event_name == 'pull_request' &&
233+
github.event.pull_request.head.repo.fork == false &&
234+
github.event.pull_request.user.login != 'dependabot[bot]' &&
235+
needs.playwright-tests-chromium-sharded.result != 'cancelled'
236+
}}
237+
uses: ./.github/workflows/ci-tests-e2e-coverage.yaml
238+
with:
239+
source_branch: ${{ github.head_ref || github.ref_name }}
240+
source_pr: ${{ format('{0}', github.event.pull_request.number) }}
241+
source_run_id: ${{ format('{0}', github.run_id) }}
242+
source_sha: ${{ github.event.pull_request.head.sha || github.sha }}
243+
secrets: inherit
244+
226245
# Records video only for spec files newly added in this PR, to keep cost bounded.
227246
playwright-video-new-tests:
228247
needs: setup

0 commit comments

Comments
 (0)