| 1 |
name: Main workflow |
| 2 |
on: |
| 3 |
push: |
| 4 |
pull_request: |
| 5 |
|
| 6 |
jobs: |
| 7 |
# Run the `rustfmt` code formatter |
| 8 |
rustfmt: |
| 9 |
name: Rustfmt [Formatter] |
| 10 |
runs-on: ubuntu-latest |
| 11 |
steps: |
| 12 |
- name: Setup | Checkout |
| 13 |
uses: actions/checkout@v2 |
| 14 |
|
| 15 |
- name: Setup | Rust |
| 16 |
uses: actions-rs/toolchain@v1 |
| 17 |
with: |
| 18 |
toolchain: stable |
| 19 |
override: true |
| 20 |
profile: minimal |
| 21 |
components: rustfmt |
| 22 |
|
| 23 |
- name: Build | Format |
| 24 |
run: cargo fmt --all -- --check |
| 25 |
|
| 26 |
# Run the `clippy` linting tool |
| 27 |
clippy: |
| 28 |
name: Clippy [Linter] |
| 29 |
strategy: |
| 30 |
matrix: |
| 31 |
os: [ubuntu-latest, windows-latest, macos-latest] |
| 32 |
runs-on: ${{ matrix.os }} |
| 33 |
steps: |
| 34 |
- name: Setup | Checkout |
| 35 |
uses: actions/checkout@v2 |
| 36 |
|
| 37 |
- name: Setup | Rust |
| 38 |
uses: actions-rs/toolchain@v1 |
| 39 |
with: |
| 40 |
toolchain: stable |
| 41 |
override: true |
| 42 |
profile: minimal |
| 43 |
components: clippy |
| 44 |
|
| 45 |
- name: Build | Lint |
| 46 |
uses: actions-rs/cargo@v1 |
| 47 |
with: |
| 48 |
command: clippy |
| 49 |
args: --workspace --all-targets --all-features -- -Dwarnings |
| 50 |
|
| 51 |
# Ensure that the project could be successfully compiled |
| 52 |
cargo_check: |
| 53 |
name: Compile |
| 54 |
strategy: |
| 55 |
matrix: |
| 56 |
target: [x86_64-unknown-linux-musl, wasm32-wasi] |
| 57 |
runs-on: ubuntu-latest |
| 58 |
steps: |
| 59 |
- name: Setup | Checkout |
| 60 |
uses: actions/checkout@v2 |
| 61 |
|
| 62 |
- name: Setup | Rust |
| 63 |
uses: actions-rs/toolchain@v1 |
| 64 |
with: |
| 65 |
toolchain: stable |
| 66 |
profile: minimal |
| 67 |
override: true |
| 68 |
target: ${{ matrix.target }} |
| 69 |
|
| 70 |
- name: Build | Check |
| 71 |
run: cargo check --workspace --target ${{ matrix.target }} |
| 72 |
|
| 73 |
# Run tests on Linux, macOS, and Windows |
| 74 |
# On both Rust stable and Rust nightly |
| 75 |
test: |
| 76 |
name: Test Suite |
| 77 |
runs-on: ${{ matrix.os }} |
| 78 |
needs: cargo_check # First check then run expansive tests |
| 79 |
strategy: |
| 80 |
fail-fast: false |
| 81 |
matrix: |
| 82 |
os: [ubuntu-latest, windows-latest, macos-latest] |
| 83 |
rust: [1.63, stable, nightly] |
| 84 |
steps: |
| 85 |
- name: Setup | Checkout |
| 86 |
uses: actions/checkout@v2 |
| 87 |
|
| 88 |
- name: Setup | Rust |
| 89 |
uses: actions-rs/toolchain@v1 |
| 90 |
with: |
| 91 |
toolchain: ${{ matrix.rust }} |
| 92 |
profile: minimal |
| 93 |
override: true |
| 94 |
|
| 95 |
# Run the ignored tests that expect the above setup |
| 96 |
- name: Build | Test |
| 97 |
run: cargo test --workspace --all-features -- --include-ignored |
| 98 |
cargo-deny: |
| 99 |
runs-on: ubuntu-22.04 |
| 100 |
steps: |
| 101 |
- uses: actions/checkout@v3 |
| 102 |
- uses: EmbarkStudios/cargo-deny-action@v1 |