feat(nix/bufCheck): ensure .pb.go is up to date
Change-Id: I03e1c3aced266966f6959dbce05c1f1fb1480b5a Reviewed-on: https://cl.tvl.fyi/c/depot/+/7323 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
This commit is contained in:
parent
d0799a7aa4
commit
a2ac8a66c1
2 changed files with 22 additions and 2 deletions
|
@ -1 +1,8 @@
|
|||
version: v1
|
||||
plugins:
|
||||
- name: go
|
||||
out: .
|
||||
opt: paths=source_relative
|
||||
- name: go-grpc
|
||||
out: .
|
||||
opt: paths=source_relative
|
|
@ -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
|
||||
''
|
||||
|
|
Loading…
Reference in a new issue