| 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: [nightly, beta, stable, 1.82.0, 1.80.0, 1.76.0] |
| 28 |
timeout-minutes: 45 |
| 29 |
steps: |
| 30 |
- uses: actions/checkout@v5 |
| 31 |
- uses: dtolnay/rust-toolchain@master |
| 32 |
with: |
| 33 |
toolchain: ${{matrix.rust}} |
| 34 |
components: rust-src |
| 35 |
- name: Enable type layout randomization |
| 36 |
run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout >> $GITHUB_ENV |
| 37 |
if: matrix.rust == 'nightly' |
| 38 |
- name: Enable nightly-only tests |
| 39 |
run: echo RUSTFLAGS=${RUSTFLAGS}\ --cfg=anyhow_nightly_testing >> $GITHUB_ENV |
| 40 |
if: matrix.rust == 'nightly' |
| 41 |
- run: cargo test |
| 42 |
- run: cargo check --no-default-features |
| 43 |
- run: cargo check --features backtrace |
| 44 |
if: matrix.rust != '1.80.0' && matrix.rust != '1.76.0' |
| 45 |
- uses: actions/upload-artifact@v4 |
| 46 |
if: matrix.rust == 'nightly' && always() |
| 47 |
with: |
| 48 |
name: Cargo.lock |
| 49 |
path: Cargo.lock |
| 50 |
continue-on-error: true |
| 51 |
|
| 52 |
build: |
| 53 |
name: Rust ${{matrix.rust}} |
| 54 |
needs: pre_ci |
| 55 |
if: needs.pre_ci.outputs.continue |
| 56 |
runs-on: ubuntu-latest |
| 57 |
strategy: |
| 58 |
fail-fast: false |
| 59 |
matrix: |
| 60 |
rust: [1.67.0, 1.65.0, 1.52.0, 1.51.0, 1.50.0, 1.39.0] |
| 61 |
timeout-minutes: 45 |
| 62 |
steps: |
| 63 |
- uses: actions/checkout@v5 |
| 64 |
- uses: dtolnay/rust-toolchain@master |
| 65 |
with: |
| 66 |
toolchain: ${{matrix.rust}} |
| 67 |
components: rust-src |
| 68 |
- run: cargo check --manifest-path tests/crate/Cargo.toml |
| 69 |
- run: cargo check --manifest-path tests/crate/Cargo.toml --no-default-features |
| 70 |
|
| 71 |
minimal: |
| 72 |
name: Minimal versions |
| 73 |
needs: pre_ci |
| 74 |
if: needs.pre_ci.outputs.continue |
| 75 |
runs-on: ubuntu-latest |
| 76 |
timeout-minutes: 45 |
| 77 |
steps: |
| 78 |
- uses: actions/checkout@v5 |
| 79 |
- uses: dtolnay/rust-toolchain@nightly |
| 80 |
- run: cargo generate-lockfile -Z minimal-versions |
| 81 |
- run: cargo check --locked --features backtrace |
| 82 |
|
| 83 |
windows: |
| 84 |
name: Windows |
| 85 |
needs: pre_ci |
| 86 |
if: needs.pre_ci.outputs.continue |
| 87 |
runs-on: windows-latest |
| 88 |
timeout-minutes: 45 |
| 89 |
steps: |
| 90 |
- uses: actions/checkout@v5 |
| 91 |
- uses: dtolnay/rust-toolchain@stable |
| 92 |
with: |
| 93 |
components: rust-src |
| 94 |
- run: cargo check --features backtrace |
| 95 |
|
| 96 |
doc: |
| 97 |
name: Documentation |
| 98 |
needs: pre_ci |
| 99 |
if: needs.pre_ci.outputs.continue |
| 100 |
runs-on: ubuntu-latest |
| 101 |
timeout-minutes: 45 |
| 102 |
env: |
| 103 |
RUSTDOCFLAGS: -Dwarnings |
| 104 |
steps: |
| 105 |
- uses: actions/checkout@v5 |
| 106 |
- uses: dtolnay/rust-toolchain@nightly |
| 107 |
with: |
| 108 |
components: rust-src |
| 109 |
- uses: dtolnay/install@cargo-docs-rs |
| 110 |
- run: cargo docs-rs |
| 111 |
|
| 112 |
clippy: |
| 113 |
name: Clippy |
| 114 |
runs-on: ubuntu-latest |
| 115 |
if: github.event_name != 'pull_request' |
| 116 |
timeout-minutes: 45 |
| 117 |
steps: |
| 118 |
- uses: actions/checkout@v5 |
| 119 |
- uses: dtolnay/rust-toolchain@nightly |
| 120 |
with: |
| 121 |
components: clippy, rust-src |
| 122 |
- run: cargo clippy --tests -- -Dclippy::all -Dclippy::pedantic |
| 123 |
|
| 124 |
miri: |
| 125 |
name: Miri |
| 126 |
needs: pre_ci |
| 127 |
if: needs.pre_ci.outputs.continue |
| 128 |
runs-on: ubuntu-latest |
| 129 |
timeout-minutes: 45 |
| 130 |
steps: |
| 131 |
- uses: actions/checkout@v5 |
| 132 |
- uses: dtolnay/rust-toolchain@miri |
| 133 |
- run: cargo miri setup |
| 134 |
- run: cargo miri test |
| 135 |
env: |
| 136 |
MIRIFLAGS: -Zmiri-strict-provenance |
| 137 |
|
| 138 |
outdated: |
| 139 |
name: Outdated |
| 140 |
runs-on: ubuntu-latest |
| 141 |
if: github.event_name != 'pull_request' |
| 142 |
timeout-minutes: 45 |
| 143 |
steps: |
| 144 |
- uses: actions/checkout@v5 |
| 145 |
- uses: dtolnay/rust-toolchain@stable |
| 146 |
- uses: dtolnay/install@cargo-outdated |
| 147 |
- run: cargo outdated --workspace --exit-code 1 |