-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a meta "required-checks" job that succeeds if things are skipped
- Loading branch information
Showing
2 changed files
with
69 additions
and
16 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
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 |
---|---|---|
|
@@ -77,24 +77,39 @@ jobs: | |
- name: Build benchmarks with all features | ||
run: cargo bench --verbose --no-run --workspace --all-features | ||
|
||
tests: | ||
# Run tests on Rust stable | ||
tests-stable: | ||
needs: changes | ||
if: ${{ needs.changes.outputs.rust == 'true' }} | ||
runs-on: ubuntu-latest | ||
name: tests (Rust stable) | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: mozilla-actions/[email protected] | ||
- id: toolchain | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: 'stable' | ||
- name: Configure default rust toolchain | ||
run: rustup override set ${{steps.toolchain.outputs.name}} | ||
- name: Build with no features | ||
run: cargo test --verbose --workspace --no-default-features --no-run | ||
- name: Tests with no features | ||
run: cargo test --verbose --workspace --no-default-features | ||
- name: Build with all features | ||
run: cargo test --verbose --workspace --all-features --no-run | ||
- name: Tests with all features | ||
run: cargo test --verbose --workspace --all-features | ||
|
||
# Run tests on other toolchains | ||
tests-other: | ||
needs: changes | ||
if: ${{ needs.changes.outputs.rust == 'true' && github.event_name != 'merge_group' }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
rust: ['1.75', stable, beta, nightly] | ||
# workaround to ignore non-stable tests when running the merge queue checks | ||
# see: https://github.community/t/how-to-conditionally-include-exclude-items-in-matrix-eg-based-on-branch/16853/6 | ||
isMerge: | ||
- ${{ github.event_name == 'merge_group' }} | ||
exclude: | ||
- rust: '1.75' | ||
isMerge: true | ||
- rust: beta | ||
isMerge: true | ||
- rust: nightly | ||
isMerge: true | ||
rust: ['1.75', beta, nightly] | ||
name: tests (Rust ${{ matrix.rust }}) | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -114,9 +129,28 @@ jobs: | |
- name: Tests with all features | ||
run: cargo test --verbose --workspace --all-features | ||
|
||
# This is a meta job to mark successful completion of the required checks, | ||
# even if they are skipped due to no changes in the relevant files. | ||
required-checks: | ||
name: Required checks | ||
needs: [check, tests-stable] | ||
if: always() | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Fail if required checks failed | ||
if: (failure() || cancelled()) | ||
run: | | ||
echo "Required checks failed" | ||
echo "Please check the logs for more information" | ||
exit 1 | ||
- name: Pass if required checks passed | ||
run: | | ||
echo "All required checks passed" | ||
coverage: | ||
needs: [changes, tests, check] | ||
if: ${{ needs.changes.outputs.rust == 'true' }} && github.event_name != 'merge_group' | ||
needs: [changes, tests-stable, tests-other, check] | ||
# Run only if there are changes in the relevant files and the check job passed or was skipped | ||
if: always() && !failure() && !cancelled() && needs.changes.outputs.rust == 'true' && github.event_name != 'merge_group' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|