|
30 | 30 | run: cargo fmt --all -- --check |
31 | 31 | - name: Run cargo clippy |
32 | 32 | run: cargo clippy --all-features -- -D warnings -W clippy::pedantic -W clippy::nursery -W rust-2018-idioms |
| 33 | + # A `[Type]` that no longer resolves is a dead link on docs.rs, and |
| 34 | + # nothing was checking: twelve had accumulated from renames. |
| 35 | + - name: Run cargo doc |
| 36 | + run: cargo doc --no-deps --all-features --workspace |
| 37 | + env: |
| 38 | + RUSTDOCFLAGS: >- |
| 39 | + -D rustdoc::broken_intra_doc_links |
| 40 | + -D rustdoc::invalid_html_tags |
| 41 | + -D rustdoc::bare_urls |
33 | 42 |
|
34 | 43 | check: |
35 | 44 | needs: [style] |
@@ -87,3 +96,145 @@ jobs: |
87 | 96 |
|
88 | 97 | - name: Run cargo test |
89 | 98 | run: cargo test --all-features --workspace --exclude loco-gen --exclude loco |
| 99 | + |
| 100 | + # `--all-features` turns `embedded_assets` ON, which `#[cfg]`s out |
| 101 | + # `controller/views/engine.rs` in favour of `engine_embedded.rs`. That file's |
| 102 | + # test module — the on-disk Tera engine, hot reloading, autoescaping, |
| 103 | + # template inheritance — was therefore compiled by no job at all: `cargo hack |
| 104 | + # check --each-feature` above passes no `--tests`, and the job above enables |
| 105 | + # the feature that hides it. This runs everything except that one feature. |
| 106 | + test-without-embedded-assets: |
| 107 | + needs: [check, style] |
| 108 | + runs-on: ubuntu-latest |
| 109 | + |
| 110 | + permissions: |
| 111 | + contents: read |
| 112 | + |
| 113 | + steps: |
| 114 | + - name: Checkout the code |
| 115 | + uses: actions/checkout@v7 |
| 116 | + - uses: dtolnay/rust-toolchain@stable |
| 117 | + with: |
| 118 | + toolchain: ${{ env.RUST_TOOLCHAIN }} |
| 119 | + - name: Setup Rust cache |
| 120 | + uses: Swatinem/rust-cache@v2 |
| 121 | + |
| 122 | + - name: Run cargo test (on-disk view engine) |
| 123 | + run: >- |
| 124 | + cargo test --lib --no-default-features |
| 125 | + --features auth,cli,with-db,testing,all_storage,cache_inmem,cache_redis,worker,worker_redis |
| 126 | +
|
| 127 | + # Vulnerabilities, unmaintained crates, licenses and registry sources — see |
| 128 | + # `deny.toml`, which carries a written reason for every exemption. |
| 129 | + # |
| 130 | + # Note this job can go red without anyone changing the code: a new advisory |
| 131 | + # against an existing dependency lands in the RustSec database and the next |
| 132 | + # PR fails. That is the intended behaviour — the alternative is finding out |
| 133 | + # from a user. |
| 134 | + supply-chain: |
| 135 | + needs: [style] |
| 136 | + runs-on: ubuntu-latest |
| 137 | + |
| 138 | + permissions: |
| 139 | + contents: read |
| 140 | + |
| 141 | + steps: |
| 142 | + - name: Checkout the code |
| 143 | + uses: actions/checkout@v7 |
| 144 | + - uses: dtolnay/rust-toolchain@stable |
| 145 | + with: |
| 146 | + toolchain: ${{ env.RUST_TOOLCHAIN }} |
| 147 | + - uses: taiki-e/install-action@v2 |
| 148 | + with: |
| 149 | + tool: cargo-deny |
| 150 | + - run: cargo deny check |
| 151 | + |
| 152 | + # `examples` is `exclude`d from the workspace, so `cargo test --workspace` |
| 153 | + # never reaches `examples/*/tests` — model, request, task and worker suites |
| 154 | + # that exercise the framework the way an app actually uses it, through a |
| 155 | + # booted `AppContext` and a real router. Nothing ran them: `docs.yml` only |
| 156 | + # `cargo build`s demo, to check the docs still compile. |
| 157 | + # |
| 158 | + # Both examples default to SQLite in `config/test.yaml`, so this needs no |
| 159 | + # services. `reference_spa` is a clientside app whose `static` middleware is |
| 160 | + # `must_exist: true` over `frontend/dist`, so it must be built before the app |
| 161 | + # will boot — exactly what the CI a generated clientside app ships does. |
| 162 | + test-examples: |
| 163 | + needs: [check, style] |
| 164 | + runs-on: ubuntu-latest |
| 165 | + |
| 166 | + permissions: |
| 167 | + contents: read |
| 168 | + |
| 169 | + strategy: |
| 170 | + fail-fast: false |
| 171 | + matrix: |
| 172 | + example: [demo, reference_spa] |
| 173 | + |
| 174 | + steps: |
| 175 | + - name: Checkout the code |
| 176 | + uses: actions/checkout@v7 |
| 177 | + - uses: dtolnay/rust-toolchain@stable |
| 178 | + with: |
| 179 | + toolchain: ${{ env.RUST_TOOLCHAIN }} |
| 180 | + - name: Setup Rust cache |
| 181 | + uses: Swatinem/rust-cache@v2 |
| 182 | + with: |
| 183 | + workspaces: examples/${{ matrix.example }} |
| 184 | + |
| 185 | + # pnpm, not npm: the manifest declares `packageManager: pnpm` and carries |
| 186 | + # `pnpm.overrides`, which npm ignores — it then fails to resolve vite at |
| 187 | + # all. |
| 188 | + - name: Setup node |
| 189 | + if: matrix.example == 'reference_spa' |
| 190 | + uses: actions/setup-node@v4 |
| 191 | + with: |
| 192 | + node-version: 22 |
| 193 | + - name: Setup pnpm |
| 194 | + if: matrix.example == 'reference_spa' |
| 195 | + uses: pnpm/action-setup@v5 |
| 196 | + with: |
| 197 | + # Read the frontend's own packageManager pin; there is no root |
| 198 | + # package.json for the action to fall back on. |
| 199 | + package_json_file: examples/reference_spa/frontend/package.json |
| 200 | + - name: Build frontend |
| 201 | + if: matrix.example == 'reference_spa' |
| 202 | + run: pnpm install --frozen-lockfile && pnpm run build |
| 203 | + working-directory: ./examples/reference_spa/frontend |
| 204 | + |
| 205 | + - name: Run cargo test |
| 206 | + run: cargo test --manifest-path examples/${{ matrix.example }}/Cargo.toml |
| 207 | + |
| 208 | + # `rust-version` in Cargo.toml is a promise to anyone running an older |
| 209 | + # toolchain, and until this job existed nothing checked it: every other job |
| 210 | + # here builds on `stable`. The toolchain is read out of Cargo.toml rather |
| 211 | + # than pinned here, so raising the floor in one place moves the gate with it. |
| 212 | + # |
| 213 | + # `loco-new` is its own workspace, so it needs its own invocation — the root |
| 214 | + # `--workspace` does not reach it. |
| 215 | + msrv: |
| 216 | + needs: [check, style] |
| 217 | + runs-on: ubuntu-latest |
| 218 | + |
| 219 | + permissions: |
| 220 | + contents: read |
| 221 | + |
| 222 | + steps: |
| 223 | + - name: Checkout the code |
| 224 | + uses: actions/checkout@v7 |
| 225 | + - name: Read the declared MSRV |
| 226 | + id: msrv |
| 227 | + run: | |
| 228 | + msrv=$(grep -m1 '^rust-version' Cargo.toml | sed 's/.*"\(.*\)".*/\1/') |
| 229 | + echo "Declared MSRV: $msrv" |
| 230 | + echo "version=$msrv" >> "$GITHUB_OUTPUT" |
| 231 | + - uses: dtolnay/rust-toolchain@stable |
| 232 | + with: |
| 233 | + toolchain: ${{ steps.msrv.outputs.version }} |
| 234 | + - name: Setup Rust cache |
| 235 | + uses: Swatinem/rust-cache@v2 |
| 236 | + |
| 237 | + - name: Check the workspace on the MSRV |
| 238 | + run: cargo check --all-features --workspace |
| 239 | + - name: Check the `loco` CLI on the MSRV |
| 240 | + run: cargo check --all-features --manifest-path loco-new/Cargo.toml |
0 commit comments