| 1 | name: test |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | pull_request: |
| 6 | |
| 7 | env: |
| 8 | CARGO_TERM_COLOR: always |
| 9 | RUST_BACKTRACE: full |
| 10 | |
| 11 | jobs: |
| 12 | test: |
| 13 | name: Build & test |
| 14 | strategy: |
| 15 | fail-fast: false |
| 16 | matrix: |
| 17 | os: |
| 18 | - ubuntu-latest |
| 19 | - macos-latest |
| 20 | - windows-latest |
| 21 | rust: |
| 22 | - stable |
| 23 | - beta |
| 24 | - nightly |
| 25 | |
| 26 | runs-on: ${{ matrix.os }} |
| 27 | |
| 28 | steps: |
| 29 | - name: checkout |
| 30 | uses: actions/checkout@v4 |
| 31 | |
| 32 | - name: Install Rust |
| 33 | uses: actions-rs/toolchain@v1 |
| 34 | with: |
| 35 | toolchain: ${{ matrix.rust }} |
| 36 | default: true |
| 37 | profile: minimal |
| 38 | |
| 39 | - name: Restore cache |
| 40 | uses: Swatinem/rust-cache@v2 |
| 41 | |
| 42 | - name: Build & test |
| 43 | env: |
| 44 | RUST_VERSION: ${{ matrix.rust }} |
| 45 | OS: ${{ matrix.os }} |
| 46 | RUSTFLAGS: -D warnings |
| 47 | run: cargo test |
| 48 | |
| 49 | no_std_builds: |
| 50 | name: Build no_std targets |
| 51 | runs-on: ubuntu-latest |
| 52 | strategy: |
| 53 | matrix: |
| 54 | target: |
| 55 | - thumbv7m-none-eabi |
| 56 | rust: |
| 57 | - stable |
| 58 | - beta |
| 59 | - nightly |
| 60 | steps: |
| 61 | - name: checkout |
| 62 | uses: actions/checkout@v4 |
| 63 | |
| 64 | - name: Install Rust |
| 65 | uses: actions-rs/toolchain@v1 |
| 66 | with: |
| 67 | toolchain: ${{ matrix.rust }} |
| 68 | target: ${{ matrix.target }} |
| 69 | default: true |
| 70 | profile: minimal |
| 71 | |
| 72 | - name: Restore cache |
| 73 | uses: Swatinem/rust-cache@v2 |
| 74 | |
| 75 | - name: Build |
| 76 | run: cargo build --no-default-features --release --target ${{ matrix.target }} |
| 77 | |
| 78 | rustfmt: |
| 79 | name: Check formatting |
| 80 | runs-on: ubuntu-latest |
| 81 | steps: |
| 82 | - name: checkout |
| 83 | uses: actions/checkout@v4 |
| 84 | |
| 85 | - name: Install Rust |
| 86 | uses: actions-rs/toolchain@v1 |
| 87 | with: |
| 88 | profile: minimal |
| 89 | toolchain: stable |
| 90 | default: true |
| 91 | components: rustfmt |
| 92 | |
| 93 | - run: cargo fmt --all -- --check |
| 94 | |
| 95 | links: |
| 96 | name: Check documentation links |
| 97 | runs-on: ubuntu-latest |
| 98 | steps: |
| 99 | - name: checkout |
| 100 | uses: actions/checkout@v4 |
| 101 | |
| 102 | - name: Install Rust |
| 103 | uses: actions-rs/toolchain@v1 |
| 104 | with: |
| 105 | toolchain: stable |
| 106 | default: true |
| 107 | |
| 108 | - name: Restore cache |
| 109 | uses: Swatinem/rust-cache@v2 |
| 110 | |
| 111 | - name: Check links |
| 112 | run: cargo rustdoc --all-features -- -D warnings |
| 113 | |
| 114 | clippy: |
| 115 | name: Clippy lints |
| 116 | runs-on: ubuntu-latest |
| 117 | steps: |
| 118 | - name: Checkout repository |
| 119 | uses: actions/checkout@v4 |
| 120 | |
| 121 | - name: Install Rust |
| 122 | uses: actions-rs/toolchain@v1 |
| 123 | with: |
| 124 | toolchain: stable |
| 125 | profile: minimal |
| 126 | default: true |
| 127 | components: clippy |
| 128 | |
| 129 | - name: Restore cache |
| 130 | uses: Swatinem/rust-cache@v2 |
| 131 | |
| 132 | - name: Run clippy linter |
| 133 | run: cargo clippy --all --tests -- -D clippy::all -D warnings |
| 134 | |
| 135 | miri: |
| 136 | name: Miri checks |
| 137 | runs-on: ubuntu-latest |
| 138 | steps: |
| 139 | - name: Checkout repository |
| 140 | uses: actions/checkout@v4 |
| 141 | |
| 142 | - name: Install Rust |
| 143 | uses: actions-rs/toolchain@v1 |
| 144 | with: |
| 145 | toolchain: nightly |
| 146 | profile: minimal |
| 147 | default: true |
| 148 | components: "miri" |
| 149 | |
| 150 | - name: Restore cache |
| 151 | uses: Swatinem/rust-cache@v2 |
| 152 | |
| 153 | - name: Run miri |
| 154 | env: |
| 155 | PROPTEST_CASES: "10" |
| 156 | MIRIFLAGS: "-Zmiri-disable-isolation" |
| 157 | run: cargo miri test --all-features |