about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-08-19T15·09+0200
committerflokli <flokli@flokli.de>2023-11-05T20·28+0000
commita9329ff811551cf8712f42c0a9c8ac9d1ce2897e (patch)
tree4126bbe705b80a654ce550c0697c21370b524cb7
parentf325456cba24c037415ac36502bfb900b19fbee5 (diff)
feat(tvix): add clippy target in CI r/6960
This will invoke `cargo clippy` on the codebase, ensuring we spot things
early on.

Relates to b/321.

Change-Id: Ifba13e5bef995d33b24346c6cee134e84d6566c4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9106
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
-rw-r--r--tvix/default.nix24
1 files changed, 24 insertions, 0 deletions
diff --git a/tvix/default.nix b/tvix/default.nix
index 43b942cef096..339a657efd5f 100644
--- a/tvix/default.nix
+++ b/tvix/default.nix
@@ -131,7 +131,31 @@ in
     '';
   };
 
+  # Run cargo clippy. We run it with -Dwarnings, so warnings cause a nonzero
+  # exit code.
+  clippy = pkgs.stdenv.mkDerivation {
+    inherit cargoDeps;
+    name = "tvix-clippy";
+    src = depot.third_party.gitignoreSource ./.;
+    PROTO_ROOT = depot.tvix.proto;
+
+    buildInputs = [
+      pkgs.fuse
+    ];
+    nativeBuildInputs = with pkgs; [
+      cargo
+      clippy
+      pkg-config
+      protobuf
+      rustc
+      rustPlatform.cargoSetupHook
+    ];
+
+    buildPhase = "cargo clippy -- -Dwarnings | tee $out";
+  };
+
   meta.ci.targets = [
+    "clippy"
     "shell"
     "rust-docs"
   ];