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.56.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 >> $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 81 minimal: 82 name: Minimal versions 83 needs: pre_ci 84 if: needs.pre_ci.outputs.continue 85 runs-on: ubuntu-latest 86 timeout-minutes: 45 87 steps: 88 - uses: actions/checkout@v4 89 - uses: dtolnay/rust-toolchain@nightly 90 - run: cargo generate-lockfile -Z minimal-versions 91 - run: cargo check --locked 92 93 webassembly: 94 name: WebAssembly 95 needs: pre_ci 96 if: needs.pre_ci.outputs.continue 97 runs-on: ubuntu-latest 98 timeout-minutes: 45 99 steps: 100 - uses: actions/checkout@v4 101 - uses: dtolnay/rust-toolchain@nightly 102 with: 103 target: wasm32-unknown-unknown 104 components: rust-src 105 - run: cargo test --target wasm32-unknown-unknown --no-run 106 107 fuzz: 108 name: Fuzz 109 needs: pre_ci 110 if: needs.pre_ci.outputs.continue 111 runs-on: ubuntu-latest 112 timeout-minutes: 45 113 steps: 114 - uses: actions/checkout@v4 115 - uses: dtolnay/rust-toolchain@nightly 116 with: 117 components: rust-src 118 - uses: dtolnay/install@cargo-fuzz 119 - run: cargo fuzz check 120 - run: cargo check --no-default-features --features afl 121 working-directory: fuzz 122 - uses: dtolnay/install@honggfuzz 123 - run: sudo apt-get update # https://github.com/actions/runner-images/issues/8953 124 - run: sudo apt-get install binutils-dev libunwind-dev 125 - run: cargo hfuzz build --no-default-features --features honggfuzz 126 working-directory: fuzz 127 128 doc: 129 name: Documentation 130 needs: pre_ci 131 if: needs.pre_ci.outputs.continue 132 runs-on: ubuntu-latest 133 timeout-minutes: 45 134 env: 135 RUSTDOCFLAGS: -Dwarnings 136 steps: 137 - uses: actions/checkout@v4 138 - uses: dtolnay/rust-toolchain@nightly 139 with: 140 components: rust-src 141 - uses: dtolnay/install@cargo-docs-rs 142 - run: cargo docs-rs 143 144 clippy: 145 name: Clippy 146 runs-on: ubuntu-latest 147 if: github.event_name != 'pull_request' 148 timeout-minutes: 45 149 steps: 150 - uses: actions/checkout@v4 151 - uses: dtolnay/rust-toolchain@nightly 152 with: 153 components: clippy, rust-src 154 - run: cargo clippy --tests -- -Dclippy::all -Dclippy::pedantic 155 - run: cargo clippy --tests --all-features -- -Dclippy::all -Dclippy::pedantic 156 157 miri: 158 name: Miri 159 needs: pre_ci 160 if: needs.pre_ci.outputs.continue 161 runs-on: ubuntu-latest 162 timeout-minutes: 45 163 steps: 164 - uses: actions/checkout@v4 165 - uses: dtolnay/rust-toolchain@miri 166 - run: cargo miri setup 167 - run: cargo miri test 168 env: 169 MIRIFLAGS: -Zmiri-strict-provenance 170 171 outdated: 172 name: Outdated 173 runs-on: ubuntu-latest 174 if: github.event_name != 'pull_request' 175 timeout-minutes: 45 176 steps: 177 - uses: actions/checkout@v4 178 - uses: dtolnay/install@cargo-outdated 179 - run: cargo outdated --workspace --exit-code 1 180 - run: cargo outdated --manifest-path fuzz/Cargo.toml --exit-code 1 181