diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc905cb1bc..96e905f478 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,8 @@ # (each prints "SKIPPED : ", counted at the end of scripts/test.ps1) and the # tests on game data pass without running. What it checks on every push and pull request: # the workspace builds, the unit / integration tests pass, and the recompiler's HLSL compiles -# with the runner's DXC (Windows SDK). +# with the runner's DXC (Windows SDK). A second job runs clippy on all targets: its warnings +# are listed in the job's log and do not fail it, because the tree is not lint-clean. # # Left out: the test title's end-to-end run (`test_title_runs_and_game_folder_is_untouched`). # The runner has no System32\xgameruntime.dll (Gaming Services) and only the Microsoft Basic @@ -52,3 +53,28 @@ jobs: - name: Build and test shell: pwsh run: ./scripts/test.ps1 --skip test_title_runs_and_game_folder_is_untouched + + clippy: + name: Clippy (Windows) + runs-on: windows-2025 + timeout-minutes: 30 + env: + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 + steps: + - uses: actions/checkout@v4 + + - name: Rust (stable, MSVC, clippy) + run: | + rustup toolchain install stable --profile minimal + rustup default stable + rustup component add clippy + rustc --version + cargo clippy --version + + - uses: Swatinem/rust-cache@v2 + with: + save-if: ${{ github.ref == 'refs/heads/main' }} + + - name: Clippy + run: cargo clippy --workspace --all-targets diff --git a/AGENTS.md b/AGENTS.md index 88ef1e71b0..527b1029b1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -23,12 +23,16 @@ Windows 10/11 x64 only, `stable-x86_64-pc-windows-msvc`, Windows SDK (DXC), a D3 .\scripts\test.ps1 # build + all tests cargo build --workspace && cargo test --workspace -- --test-threads=4 # same, from bash / in the background cargo test -p xcl --lib # one area while iterating +cargo clippy --workspace --all-targets # lints, as the CI clippy job runs them ``` - GPU tests print `SKIPPED : ` when the adapter cannot run them and still pass. Report skips; do not count them as coverage. - On macOS / Linux the crate does not build or run. Do not claim it does: say "not built / not tested" in the PR. +- Run clippy before you commit and fix the warnings it reports **in the lines you wrote or + changed**. The tree is not lint-clean and CI's clippy job only warns, so it will not stop you: the + check is yours. Leave the warnings in code you did not touch (no drive-by fixes, see Scope). - Editing files through PowerShell `Get-Content` / `Set-Content` corrupts UTF-8: use your file tools. - Some steps (DXC compiles of many shaders, whole-pack runs) take many minutes: run them on small samples first.