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: [nightly, beta, stable, 1.65.0] 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 - 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 45 build: 46 name: Rust ${{matrix.rust}} 47 needs: pre_ci 48 if: needs.pre_ci.outputs.continue 49 runs-on: ubuntu-latest 50 strategy: 51 fail-fast: false 52 matrix: 53 rust: [1.52.0, 1.51.0, 1.50.0, 1.42.0, 1.39.0] 54 timeout-minutes: 45 55 steps: 56 - uses: actions/checkout@v4 57 - uses: dtolnay/rust-toolchain@master 58 with: 59 toolchain: ${{matrix.rust}} 60 components: rust-src 61 - run: cargo check 62 - run: cargo check --no-default-features 63 64 minimal: 65 name: Minimal versions 66 needs: pre_ci 67 if: needs.pre_ci.outputs.continue 68 runs-on: ubuntu-latest 69 timeout-minutes: 45 70 steps: 71 - uses: actions/checkout@v4 72 - uses: dtolnay/rust-toolchain@nightly 73 - run: cargo generate-lockfile -Z minimal-versions 74 - run: cargo check --locked --features backtrace 75 76 windows: 77 name: Windows 78 needs: pre_ci 79 if: needs.pre_ci.outputs.continue 80 runs-on: windows-latest 81 timeout-minutes: 45 82 steps: 83 - uses: actions/checkout@v4 84 - uses: dtolnay/rust-toolchain@stable 85 with: 86 components: rust-src 87 - run: cargo check --features backtrace 88 89 doc: 90 name: Documentation 91 needs: pre_ci 92 if: needs.pre_ci.outputs.continue 93 runs-on: ubuntu-latest 94 timeout-minutes: 45 95 env: 96 RUSTDOCFLAGS: -Dwarnings 97 steps: 98 - uses: actions/checkout@v4 99 - uses: dtolnay/rust-toolchain@nightly 100 with: 101 components: rust-src 102 - uses: dtolnay/install@cargo-docs-rs 103 - run: cargo docs-rs 104 105 clippy: 106 name: Clippy 107 runs-on: ubuntu-latest 108 if: github.event_name != 'pull_request' 109 timeout-minutes: 45 110 steps: 111 - uses: actions/checkout@v4 112 - uses: dtolnay/rust-toolchain@nightly 113 with: 114 components: clippy, rust-src 115 - run: cargo clippy --tests -- -Dclippy::all -Dclippy::pedantic 116 117 miri: 118 name: Miri 119 needs: pre_ci 120 if: needs.pre_ci.outputs.continue 121 runs-on: ubuntu-latest 122 timeout-minutes: 45 123 steps: 124 - uses: actions/checkout@v4 125 - uses: dtolnay/rust-toolchain@miri 126 - run: cargo miri setup 127 - run: cargo miri test 128 env: 129 MIRIFLAGS: -Zmiri-strict-provenance 130 131 outdated: 132 name: Outdated 133 runs-on: ubuntu-latest 134 if: github.event_name != 'pull_request' 135 timeout-minutes: 45 136 steps: 137 - uses: actions/checkout@v4 138 - uses: dtolnay/install@cargo-outdated 139 - run: cargo outdated --workspace --exit-code 1 140