1name: CI 2 3on: 4 push: 5 pull_request: 6 workflow_dispatch: 7 schedule: [cron: "40 1 * * *"] 8 9permissions: 10 contents: read 11 12env: 13 RUSTFLAGS: -Dwarnings 14 15jobs: 16 pre_ci: 17 uses: dtolnay/.github/.github/workflows/pre_ci.yml@master 18 19 test: 20 name: Rust ${{matrix.rust}} 21 needs: pre_ci 22 if: needs.pre_ci.outputs.continue 23 runs-on: ubuntu-latest 24 strategy: 25 fail-fast: false 26 matrix: 27 rust: [1.63.0, stable, beta] 28 timeout-minutes: 45 29 steps: 30 - uses: actions/checkout@v4 31 - uses: dtolnay/rust-toolchain@master 32 with: 33 toolchain: ${{matrix.rust}} 34 components: rust-src 35 - run: cargo test 36 - run: cargo test --no-default-features 37 - run: cargo test --features span-locations 38 - name: RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo test 39 run: cargo test 40 env: 41 RUSTFLAGS: --cfg procmacro2_semver_exempt ${{env.RUSTFLAGS}} 42 - name: RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo test --no-default-features 43 run: cargo test --no-default-features 44 env: 45 RUSTFLAGS: --cfg procmacro2_semver_exempt ${{env.RUSTFLAGS}} 46 47 nightly: 48 name: Rust nightly 49 needs: pre_ci 50 if: needs.pre_ci.outputs.continue 51 runs-on: ubuntu-latest 52 timeout-minutes: 45 53 steps: 54 - uses: actions/checkout@v4 55 - uses: dtolnay/rust-toolchain@nightly 56 with: 57 components: rust-src 58 - name: Enable type layout randomization 59 run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout\ --cfg=randomize_layout >> $GITHUB_ENV 60 - run: cargo check 61 env: 62 RUSTFLAGS: --cfg procmacro2_nightly_testing ${{env.RUSTFLAGS}} 63 - run: cargo test 64 - run: cargo test --no-default-features 65 - run: cargo test --no-default-features --test features -- --ignored make_sure_no_proc_macro # run the ignored test to make sure the `proc-macro` feature is disabled 66 - run: cargo test --features span-locations 67 - run: cargo test --manifest-path tests/ui/Cargo.toml 68 - name: RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo test 69 run: cargo test 70 env: 71 RUSTFLAGS: --cfg procmacro2_semver_exempt ${{env.RUSTFLAGS}} 72 - name: RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo test --no-default-features 73 run: cargo test --no-default-features 74 env: 75 RUSTFLAGS: --cfg procmacro2_semver_exempt ${{env.RUSTFLAGS}} 76 - name: RUSTFLAGS='-Z allow-features=' cargo test 77 run: cargo test 78 env: 79 RUSTFLAGS: -Z allow-features= --cfg procmacro2_backtrace ${{env.RUSTFLAGS}} 80 - uses: actions/upload-artifact@v4 81 if: always() 82 with: 83 name: Cargo.lock 84 path: Cargo.lock 85 continue-on-error: true 86 87 layout: 88 name: Layout 89 needs: pre_ci 90 if: needs.pre_ci.outputs.continue 91 runs-on: ubuntu-latest 92 timeout-minutes: 45 93 steps: 94 - uses: actions/checkout@v4 95 - uses: dtolnay/rust-toolchain@nightly 96 with: 97 components: rust-src 98 - run: cargo test --test test_size 99 - run: cargo test --test test_size --features span-locations 100 - run: cargo test --test test_size --no-default-features 101 - run: cargo test --test test_size --no-default-features --features span-locations 102 103 msrv: 104 name: Rust 1.56.0 105 needs: pre_ci 106 if: needs.pre_ci.outputs.continue 107 runs-on: ubuntu-latest 108 timeout-minutes: 45 109 steps: 110 - uses: actions/checkout@v4 111 - uses: dtolnay/rust-toolchain@1.56.0 112 with: 113 components: rust-src 114 - run: cargo check 115 - run: cargo check --no-default-features 116 - run: cargo check --features span-locations 117 - name: RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo check 118 run: cargo check 119 env: 120 RUSTFLAGS: --cfg procmacro2_semver_exempt ${{env.RUSTFLAGS}} 121 - name: RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo check --no-default-features 122 run: cargo check --no-default-features 123 env: 124 RUSTFLAGS: --cfg procmacro2_semver_exempt ${{env.RUSTFLAGS}} 125 126 minimal: 127 name: Minimal versions 128 needs: pre_ci 129 if: needs.pre_ci.outputs.continue 130 runs-on: ubuntu-latest 131 timeout-minutes: 45 132 steps: 133 - uses: actions/checkout@v4 134 - uses: dtolnay/rust-toolchain@nightly 135 - run: cargo generate-lockfile -Z minimal-versions 136 - run: cargo check --locked 137 138 webassembly: 139 name: WebAssembly 140 needs: pre_ci 141 if: needs.pre_ci.outputs.continue 142 runs-on: ubuntu-latest 143 timeout-minutes: 45 144 steps: 145 - uses: actions/checkout@v4 146 - uses: dtolnay/rust-toolchain@nightly 147 with: 148 target: wasm32-unknown-unknown 149 components: rust-src 150 - run: cargo test --target wasm32-unknown-unknown --no-run 151 152 fuzz: 153 name: Fuzz 154 needs: pre_ci 155 if: needs.pre_ci.outputs.continue 156 runs-on: ubuntu-latest 157 timeout-minutes: 45 158 steps: 159 - uses: actions/checkout@v4 160 - uses: dtolnay/rust-toolchain@nightly 161 with: 162 components: rust-src 163 - uses: dtolnay/install@cargo-fuzz 164 - run: cargo fuzz check 165 - run: cargo check --no-default-features --features afl 166 working-directory: fuzz 167 - uses: dtolnay/install@honggfuzz 168 - run: sudo apt-get update # https://github.com/actions/runner-images/issues/8953 169 - run: sudo apt-get install binutils-dev libunwind-dev 170 - run: cargo hfuzz build --no-default-features --features honggfuzz 171 working-directory: fuzz 172 173 doc: 174 name: Documentation 175 needs: pre_ci 176 if: needs.pre_ci.outputs.continue 177 runs-on: ubuntu-latest 178 timeout-minutes: 45 179 env: 180 RUSTDOCFLAGS: -Dwarnings 181 steps: 182 - uses: actions/checkout@v4 183 - uses: dtolnay/rust-toolchain@nightly 184 with: 185 components: rust-src 186 - uses: dtolnay/install@cargo-docs-rs 187 - run: cargo docs-rs 188 189 clippy: 190 name: Clippy 191 runs-on: ubuntu-latest 192 if: github.event_name != 'pull_request' 193 timeout-minutes: 45 194 steps: 195 - uses: actions/checkout@v4 196 - uses: dtolnay/rust-toolchain@nightly 197 with: 198 components: clippy, rust-src 199 - run: cargo clippy --tests -- -Dclippy::all -Dclippy::pedantic 200 - run: cargo clippy --tests --all-features -- -Dclippy::all -Dclippy::pedantic 201 202 miri: 203 name: Miri 204 needs: pre_ci 205 if: needs.pre_ci.outputs.continue 206 runs-on: ubuntu-latest 207 timeout-minutes: 45 208 steps: 209 - uses: actions/checkout@v4 210 - uses: dtolnay/rust-toolchain@miri 211 - run: cargo miri setup 212 - run: cargo miri test 213 env: 214 MIRIFLAGS: -Zmiri-strict-provenance 215 216 outdated: 217 name: Outdated 218 runs-on: ubuntu-latest 219 if: github.event_name != 'pull_request' 220 timeout-minutes: 45 221 steps: 222 - uses: actions/checkout@v4 223 - uses: dtolnay/rust-toolchain@stable 224 - uses: dtolnay/install@cargo-outdated 225 - run: cargo outdated --workspace --exit-code 1 226 - run: cargo outdated --manifest-path fuzz/Cargo.toml --exit-code 1 227