about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--buf.gen.yaml7
-rw-r--r--nix/bufCheck/default.nix17
2 files changed, 22 insertions, 2 deletions
diff --git a/buf.gen.yaml b/buf.gen.yaml
index c126332f30..4ed18be22e 100644
--- a/buf.gen.yaml
+++ b/buf.gen.yaml
@@ -1 +1,8 @@
 version: v1
+plugins:
+ - name: go
+   out: .
+   opt: paths=source_relative
+ - name: go-grpc
+   out: .
+   opt: paths=source_relative
\ No newline at end of file
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
 ''