ci: Make it so that the workflow fails is any job fails #125
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
name: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
workflow_dispatch: | |
merge_group: | |
types: [checks_requested] | |
jobs: | |
linux-ci: | |
name: Linux | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
features: ["", "force-inprocess", "memfd", "async"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install nightly toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt, clippy | |
- name: rustfmt | |
run: cargo fmt --check | |
- name: clippy | |
run: cargo clippy --features "${{ matrix.features }}" | |
- name: Cargo build | |
run: cargo build --features "${{ matrix.features }}" | |
- name: Cargo test | |
run: cargo test --features "${{ matrix.features }}" | |
env: | |
RUST_BACKTRACE: 1 | |
mac-ci: | |
name: macOS | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
features: ["", "force-inprocess", "async"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install nightly toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
- name: Cargo build | |
run: cargo build --features "${{ matrix.features }}" | |
- name: Cargo test | |
run: cargo test --features "${{ matrix.features }}" | |
env: | |
RUST_BACKTRACE: 1 | |
windows-ci: | |
name: Windows | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
features: ["", "--features force-inprocess", "--features windows-shared-memory-equality", "--features async"] | |
target: ["x86_64-pc-windows-msvc", "i686-pc-windows-msvc"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install nightly toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
targets: ${{ matrix.target }} | |
- name: Cargo build | |
run: cargo build ${{ matrix.features }} --target ${{ matrix.target }} | |
- name: Cargo test | |
run: cargo test ${{ matrix.features }} --target ${{ matrix.target }} | |
env: | |
RUST_BACKTRACE: 1 | |
build_result: | |
name: Result | |
runs-on: ubuntu-latest | |
if: always() | |
needs: | |
- "linux-ci" | |
- "mac-ci" | |
- "windows-ci" | |
steps: | |
- name: Success | |
run: exit 0 | |
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }} | |
- name: Failure | |
run: exit 1 | |
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') | |