2020-07-17 06:27:05 +02:00
|
|
|
# Check protobuf syntax and breaking.
|
|
|
|
#
|
|
|
|
{ depot, pkgs, ... }:
|
|
|
|
|
|
|
|
pkgs.writeShellScriptBin "ci-buf-check" ''
|
2022-11-19 22:14:22 +01:00
|
|
|
export PATH="$PATH:${pkgs.lib.makeBinPath [ pkgs.buf pkgs.protoc-gen-go pkgs.protoc-gen-go-grpc ]}"
|
2022-11-19 22:24:42 +01:00
|
|
|
(cd $(git rev-parse --show-toplevel) && buf lint .)
|
2022-11-19 22:14:22 +01:00
|
|
|
|
|
|
|
# Run buf generate, and bail out if generated files are changed.
|
2023-09-21 21:32:44 +02:00
|
|
|
(cd $(git rev-parse --show-toplevel) && buf generate --path tvix/castore/protos)
|
2022-11-19 22:24:42 +01:00
|
|
|
(cd $(git rev-parse --show-toplevel) && buf generate --path tvix/store/protos)
|
2022-11-19 22:14:22 +01:00
|
|
|
# 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
|
|
|
|
|
2020-07-17 06:27:05 +02:00
|
|
|
# Report-only
|
2022-11-19 22:24:42 +01:00
|
|
|
(cd $(git rev-parse --show-toplevel) && (buf breaking . --against "./.git#ref=HEAD~1" || true))
|
2020-07-17 06:27:05 +02:00
|
|
|
''
|