Skip to content

Commit

Permalink
ci: run codecov job using PR head (#4488)
Browse files Browse the repository at this point in the history
* ci: run codecov job using PR head

* ci: run all coverage OS on PR, and none on merge group
  • Loading branch information
davidhewitt committed Aug 25, 2024
1 parent 2e891d0 commit 3d46a3a
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -386,40 +386,33 @@ jobs:
- run: cargo rustdoc --lib --no-default-features --features full -Zunstable-options --config "build.rustdocflags=[\"--cfg\", \"docsrs\"]"

coverage:
if : ${{ github.event_name != 'merge_group' }}
needs: [fmt]
name: coverage ${{ matrix.os }}
strategy:
matrix:
os: ["windows-latest", "macos-14", "ubuntu-latest"] # first available arm macos runner
runs-on: ${{ matrix.os }}
steps:
- if: ${{ github.event_name == 'pull_request' && matrix.os != 'ubuntu-latest' }}
id: should-skip
shell: bash
run: echo 'skip=true' >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
if: steps.should-skip.outputs.skip != 'true'
with:
# Use the PR head, not the merge commit, because the head commit (and the base)
# is what codecov uses to calculate diffs.
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-python@v5
if: steps.should-skip.outputs.skip != 'true'
with:
python-version: '3.12'
- uses: Swatinem/rust-cache@v2
if: steps.should-skip.outputs.skip != 'true'
with:
save-if: ${{ github.event_name != 'merge_group' }}
- uses: dtolnay/rust-toolchain@stable
if: steps.should-skip.outputs.skip != 'true'
with:
components: llvm-tools-preview,rust-src
- name: Install cargo-llvm-cov
if: steps.should-skip.outputs.skip != 'true'
uses: taiki-e/install-action@cargo-llvm-cov
- run: python -m pip install --upgrade pip && pip install nox
if: steps.should-skip.outputs.skip != 'true'
- run: nox -s coverage
if: steps.should-skip.outputs.skip != 'true'
- uses: codecov/codecov-action@v4
if: steps.should-skip.outputs.skip != 'true'
with:
file: coverage.json
name: ${{ matrix.os }}
Expand Down

0 comments on commit 3d46a3a

Please sign in to comment.