-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Update coverage action to trigger on (un)labeled
Signed-off-by: George Cosma <[email protected]>
- Loading branch information
1 parent
256e3cd
commit cc40bfc
Showing
1 changed file
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ on: | |
- synchronize | ||
- closed | ||
- labeled | ||
- unlabeled | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
|
@@ -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 && | ||
|
@@ -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/ | ||
|