Skip to content

Commit 3d46a3a

Browse files
authored
ci: run codecov job using PR head (#4488)
* ci: run codecov job using PR head * ci: run all coverage OS on PR, and none on merge group
1 parent 2e891d0 commit 3d46a3a

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -386,40 +386,33 @@ jobs:
386386
- run: cargo rustdoc --lib --no-default-features --features full -Zunstable-options --config "build.rustdocflags=[\"--cfg\", \"docsrs\"]"
387387

388388
coverage:
389+
if : ${{ github.event_name != 'merge_group' }}
389390
needs: [fmt]
390391
name: coverage ${{ matrix.os }}
391392
strategy:
392393
matrix:
393394
os: ["windows-latest", "macos-14", "ubuntu-latest"] # first available arm macos runner
394395
runs-on: ${{ matrix.os }}
395396
steps:
396-
- if: ${{ github.event_name == 'pull_request' && matrix.os != 'ubuntu-latest' }}
397-
id: should-skip
398-
shell: bash
399-
run: echo 'skip=true' >> $GITHUB_OUTPUT
400397
- uses: actions/checkout@v4
401-
if: steps.should-skip.outputs.skip != 'true'
398+
with:
399+
# Use the PR head, not the merge commit, because the head commit (and the base)
400+
# is what codecov uses to calculate diffs.
401+
ref: ${{ github.event.pull_request.head.sha }}
402402
- uses: actions/setup-python@v5
403-
if: steps.should-skip.outputs.skip != 'true'
404403
with:
405404
python-version: '3.12'
406405
- uses: Swatinem/rust-cache@v2
407-
if: steps.should-skip.outputs.skip != 'true'
408406
with:
409407
save-if: ${{ github.event_name != 'merge_group' }}
410408
- uses: dtolnay/rust-toolchain@stable
411-
if: steps.should-skip.outputs.skip != 'true'
412409
with:
413410
components: llvm-tools-preview,rust-src
414411
- name: Install cargo-llvm-cov
415-
if: steps.should-skip.outputs.skip != 'true'
416412
uses: taiki-e/install-action@cargo-llvm-cov
417413
- run: python -m pip install --upgrade pip && pip install nox
418-
if: steps.should-skip.outputs.skip != 'true'
419414
- run: nox -s coverage
420-
if: steps.should-skip.outputs.skip != 'true'
421415
- uses: codecov/codecov-action@v4
422-
if: steps.should-skip.outputs.skip != 'true'
423416
with:
424417
file: coverage.json
425418
name: ${{ matrix.os }}

0 commit comments

Comments
 (0)