| 1 |
name: CI |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
pull_request: |
| 6 |
workflow_dispatch: |
| 7 |
schedule: [cron: "40 1 * * *"] |
| 8 |
|
| 9 |
permissions: |
| 10 |
contents: read |
| 11 |
|
| 12 |
env: |
| 13 |
RUSTFLAGS: -Dwarnings |
| 14 |
|
| 15 |
jobs: |
| 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.80.0, stable, beta] |
| 28 |
timeout-minutes: 45 |
| 29 |
steps: |
| 30 |
- uses: actions/checkout@v6 |
| 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@v6 |
| 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@v6 |
| 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@v6 |
| 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.68.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@v6 |
| 111 |
- uses: dtolnay/[email protected] |
| 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@v6 |
| 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@v6 |
| 146 |
- uses: dtolnay/rust-toolchain@nightly |
| 147 |
with: |
| 148 |
target: wasm32-unknown-unknown |
| 149 |
components: rust-src |
| 150 |
- name: Ignore WebAssembly linker warning |
| 151 |
run: echo RUSTFLAGS=${RUSTFLAGS}\ -Alinker_messages >> $GITHUB_ENV |
| 152 |
- run: cargo test --target wasm32-unknown-unknown --no-run |
| 153 |
|
| 154 |
fuzz: |
| 155 |
name: Fuzz |
| 156 |
needs: pre_ci |
| 157 |
if: needs.pre_ci.outputs.continue |
| 158 |
runs-on: ubuntu-latest |
| 159 |
timeout-minutes: 45 |
| 160 |
steps: |
| 161 |
- uses: actions/checkout@v6 |
| 162 |
- uses: dtolnay/rust-toolchain@nightly |
| 163 |
with: |
| 164 |
components: rust-src |
| 165 |
- uses: dtolnay/install@cargo-fuzz |
| 166 |
- run: cargo fuzz check |
| 167 |
- run: cargo check --no-default-features --features afl |
| 168 |
working-directory: fuzz |
| 169 |
- uses: dtolnay/install@honggfuzz |
| 170 |
- name: Run apt install binutils-dev libunwind-dev |
| 171 |
run: | |
| 172 |
sudo sed -i 's/^update_initramfs=yes$/update_initramfs=no/' /etc/initramfs-tools/update-initramfs.conf |
| 173 |
sudo rm -f /var/lib/man-db/auto-update |
| 174 |
sudo apt-get update |
| 175 |
sudo apt-get install binutils-dev libunwind-dev |
| 176 |
- run: cargo hfuzz build --no-default-features --features honggfuzz |
| 177 |
working-directory: fuzz |
| 178 |
|
| 179 |
doc: |
| 180 |
name: Documentation |
| 181 |
needs: pre_ci |
| 182 |
if: needs.pre_ci.outputs.continue |
| 183 |
runs-on: ubuntu-latest |
| 184 |
timeout-minutes: 45 |
| 185 |
env: |
| 186 |
RUSTDOCFLAGS: -Dwarnings |
| 187 |
steps: |
| 188 |
- uses: actions/checkout@v6 |
| 189 |
- uses: dtolnay/rust-toolchain@nightly |
| 190 |
with: |
| 191 |
components: rust-src |
| 192 |
- uses: dtolnay/install@cargo-docs-rs |
| 193 |
- run: cargo docs-rs |
| 194 |
|
| 195 |
clippy: |
| 196 |
name: Clippy |
| 197 |
runs-on: ubuntu-latest |
| 198 |
if: github.event_name != 'pull_request' |
| 199 |
timeout-minutes: 45 |
| 200 |
steps: |
| 201 |
- uses: actions/checkout@v6 |
| 202 |
- uses: dtolnay/rust-toolchain@nightly |
| 203 |
with: |
| 204 |
components: clippy, rust-src |
| 205 |
- run: cargo clippy --tests -- -Dclippy::all -Dclippy::pedantic |
| 206 |
- run: cargo clippy --tests --all-features -- -Dclippy::all -Dclippy::pedantic |
| 207 |
|
| 208 |
miri: |
| 209 |
name: Miri |
| 210 |
needs: pre_ci |
| 211 |
if: needs.pre_ci.outputs.continue |
| 212 |
runs-on: ubuntu-latest |
| 213 |
timeout-minutes: 45 |
| 214 |
steps: |
| 215 |
- uses: actions/checkout@v6 |
| 216 |
- uses: dtolnay/rust-toolchain@miri |
| 217 |
- run: cargo miri setup |
| 218 |
- run: cargo miri test |
| 219 |
env: |
| 220 |
MIRIFLAGS: -Zmiri-strict-provenance |
| 221 |
|
| 222 |
outdated: |
| 223 |
name: Outdated |
| 224 |
runs-on: ubuntu-latest |
| 225 |
if: github.event_name != 'pull_request' |
| 226 |
timeout-minutes: 45 |
| 227 |
steps: |
| 228 |
- uses: actions/checkout@v6 |
| 229 |
- uses: dtolnay/rust-toolchain@stable |
| 230 |
- uses: dtolnay/install@cargo-outdated |
| 231 |
- run: cargo outdated --workspace --exit-code 1 |
| 232 |
- run: cargo outdated --manifest-path fuzz/Cargo.toml --exit-code 1 |