mirror of
https://github.com/oxalica/rust-overlay.git
synced 2025-10-06 00:02:40 +02:00
Add CI test for clippy
This commit is contained in:
10
.github/workflows/ci.yaml
vendored
10
.github/workflows/ci.yaml
vendored
@@ -104,7 +104,7 @@ jobs:
|
||||
id: cache-drv-status
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
key: successful-drv-rust-${{ steps.instantiate.outputs.drv_path }}
|
||||
key: drv-check-build-0-${{ steps.instantiate.outputs.drv_path }}
|
||||
path: successful
|
||||
- name: Build Rust
|
||||
if: steps.cache-drv-status.outputs.cache-hit != 'true'
|
||||
@@ -114,13 +114,19 @@ jobs:
|
||||
- name: Prepare nix-shell
|
||||
if: steps.cache-drv-status.outputs.cache-hit != 'true'
|
||||
run: nix-shell -p "$build_expr" --pure --command "exit"
|
||||
- name: Check compile
|
||||
- name: Check `rustc` works
|
||||
if: steps.cache-drv-status.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
echo 'fn main() { println!("hello, world"); }' >./test.rs
|
||||
# Use nix-shell to bring propagatedBuildInputs into scope.
|
||||
nix-shell -p "$build_expr" --pure --command "rustc test.rs -o test"
|
||||
[[ "$(./test)" == "hello, world" ]]
|
||||
- name: Check `clippy` works
|
||||
if: steps.cache-drv-status.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
echo 'fn main() { loop { break; } }' >./test.rs
|
||||
nix-shell -p "$build_expr" --pure --command 'clippy-driver test.rs -W clippy::never-loop' 2>&1 | tee msg
|
||||
[[ ${PIPESTATUS[0]} -eq 0 && "$(cat msg)" == *"warning: this loop never actually loops"* ]]
|
||||
- name: Mark a successful build for cache
|
||||
if: steps.cache-drv-status.outputs.cache-hit != 'true'
|
||||
run: echo "1" >./successful
|
||||
|
Reference in New Issue
Block a user