about summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2022-11-19T21·14+0000
committerflokli <flokli@flokli.de>2022-12-27T13·27+0000
commita2ac8a66c1bf151a9d70704b23ec2bd2dd3b99a6 (patch)
treee5acc31fa9a7f0920f2dda535edf30e6b3ffd095 /nix
parentd0799a7aa489cd6c3340ab347302fed86fe978f3 (diff)
feat(nix/bufCheck): ensure .pb.go is up to date r/5500
Change-Id: I03e1c3aced266966f6959dbce05c1f1fb1480b5a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7323
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'nix')
-rw-r--r--nix/bufCheck/default.nix17
1 files changed, 15 insertions, 2 deletions
diff --git a/nix/bufCheck/default.nix b/nix/bufCheck/default.nix
index 25a8865d8d..97b4124d45 100644
--- a/nix/bufCheck/default.nix
+++ b/nix/bufCheck/default.nix
@@ -3,7 +3,20 @@
 { depot, pkgs, ... }:
 
 pkgs.writeShellScriptBin "ci-buf-check" ''
-  ${depot.third_party.nixpkgs.buf}/bin/buf lint .
+  export PATH="$PATH:${pkgs.lib.makeBinPath [ pkgs.buf pkgs.protoc-gen-go pkgs.protoc-gen-go-grpc ]}"
+  buf lint .
+
+  # Run buf generate, and bail out if generated files are changed.
+  buf generate --path tvix/store/protos
+  # Check if any files have changed
+  if [[ -n "$(git status --porcelain -unormal)" ]]; then
+      echo "-----------------------------"
+      echo ".pb.go files need to be updated"
+      echo "-----------------------------"
+      git status -unormal
+      exit 1
+  fi
+
   # Report-only
-  ${depot.third_party.nixpkgs.buf}/bin/buf breaking . --against "./.git#ref=HEAD~1" || true
+  buf breaking . --against "./.git#ref=HEAD~1" || true
 ''