Skip to content

Commit

Permalink
fix: Update coverage action to trigger on (un)labeled
Browse files Browse the repository at this point in the history
Signed-off-by: George Cosma <[email protected]>
  • Loading branch information
george-cosma authored and wucke13 committed Jul 24, 2024
1 parent 256e3cd commit cc40bfc
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions .github/workflows/pages_coverage_preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- synchronize
- closed
- labeled
- unlabeled

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
Expand All @@ -20,16 +21,21 @@ concurrency: preview-cov-${{ github.ref }}
jobs:
deploy:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'coverage')
steps:
- uses: actions/checkout@v4
# -=-=-=-= Coverage test =-=-=-=-
# -=-=-=-= Coverage test (if labeled) =-=-=-=-
- name: Install coverage test tooling
if: |
(github.event.action == 'labeled' && github.event.label.name == 'coverage') ||
(github.event.action != 'labeled' && github.event.action != 'unlabeled' && contains(github.event.pull_request.labels.*.name, 'coverage'))
run: |
rustup toolchain install nightly &&
rustup component add llvm-tools-preview &&
cargo install cargo-binutils
- name: Run & compile coverage test
if: |
(github.event.action == 'labeled' && github.event.label.name == 'coverage') ||
(github.event.action != 'labeled' && github.event.action != 'unlabeled' && contains(github.event.pull_request.labels.*.name, 'coverage'))
run: |
cargo clean &&
RUSTFLAGS="-C instrument-coverage -Z coverage-options=branch,mcdc" cargo +nightly test --tests --no-run &&
Expand All @@ -38,8 +44,26 @@ jobs:
RUSTFLAGS="-C instrument-coverage -Z coverage-options=branch,mcdc" cargo +nightly test --tests -- --test-threads=1 &&
cargo profdata -- merge -sparse *.profraw -o default.profdata &&
cargo cov -- show -show-line-counts-or-regions -output-dir=cov_out -format=html --ignore-filename-regex='.*cargo.*' --instr-profile=default.profdata $OBJS
# -=-=-=-= Deploy =-=-=-=-
- name: Deploy Preview
# -=-=-=-= Deploy (when labeled) =-=-=-=-
- name: Deploy Preview (labeled)
if: ${{ github.event.action == 'labeled' && github.event.label.name == 'coverage' }}
uses: rossjrw/[email protected]
with:
source-dir: cov_out/
umbrella-dir: coverage/pr-preview
action: deploy # force deployment since, by default, this actions does nothing on the 'labeled' event
# -=-=-=-= Deploy (when unlabeled) =-=-=-=-
- name: Deploy Preview (unlabeled)
if: ${{ github.event.action == 'unlabeled' && github.event.label.name == 'coverage' }}
uses: rossjrw/[email protected]
with:
source-dir: cov_out/
umbrella-dir: coverage/pr-preview
action: remove # force removal since, by default, this actions does nothing on the 'labeled' event
# -=-=-=-= Deploy (default) =-=-=-=-
- name: Deploy Preview (default)
if: ${{ github.event.action != 'labeled' && github.event.action != 'unlabeled' && contains(github.event.pull_request.labels.*.name, 'coverage') }}
uses: rossjrw/[email protected]
with:
source-dir: cov_out/
Expand Down

0 comments on commit cc40bfc

Please sign in to comment.