1name: Main workflow 2on: 3 push: 4 pull_request: 5 6jobs: 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 runs-on: ubuntu-latest 55 steps: 56 - name: Setup | Checkout 57 uses: actions/checkout@v2 58 59 - name: Setup | Rust 60 uses: actions-rs/toolchain@v1 61 with: 62 toolchain: stable 63 profile: minimal 64 override: true 65 66 - name: Build | Check 67 run: cargo check --workspace 68 69 # Run tests on Linux, macOS, and Windows 70 # On both Rust stable and Rust nightly 71 test: 72 name: Test Suite 73 runs-on: ${{ matrix.os }} 74 needs: cargo_check # First check then run expansive tests 75 strategy: 76 fail-fast: false 77 matrix: 78 os: [ubuntu-latest, windows-latest, macos-latest] 79 rust: [stable, nightly] 80 steps: 81 - name: Setup | Checkout 82 uses: actions/checkout@v2 83 84 - name: Setup | Rust 85 uses: actions-rs/toolchain@v1 86 with: 87 toolchain: ${{ matrix.rust }} 88 profile: minimal 89 override: true 90 91 # Run the ignored tests that expect the above setup 92 - name: Build | Test 93 run: cargo test --workspace --all-features -- -Z unstable-options --include-ignored 94