feat(nix/bufCheck): always run from repo root

This doesn't work when run from subdirectories, and going there manually before
running `mg run //nix/bufCheck` is annoying.

Change-Id: Icd30a7596ff0dfe2781f7cfa1b4085cbfdebd6ac
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7324
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
Florian Klink 2022-11-19 21:24:42 +00:00 committed by flokli
parent a2ac8a66c1
commit 7df27dad12

View file

@ -4,10 +4,10 @@
pkgs.writeShellScriptBin "ci-buf-check" '' pkgs.writeShellScriptBin "ci-buf-check" ''
export PATH="$PATH:${pkgs.lib.makeBinPath [ pkgs.buf pkgs.protoc-gen-go pkgs.protoc-gen-go-grpc ]}" export PATH="$PATH:${pkgs.lib.makeBinPath [ pkgs.buf pkgs.protoc-gen-go pkgs.protoc-gen-go-grpc ]}"
buf lint . (cd $(git rev-parse --show-toplevel) && buf lint .)
# Run buf generate, and bail out if generated files are changed. # Run buf generate, and bail out if generated files are changed.
buf generate --path tvix/store/protos (cd $(git rev-parse --show-toplevel) && buf generate --path tvix/store/protos)
# Check if any files have changed # Check if any files have changed
if [[ -n "$(git status --porcelain -unormal)" ]]; then if [[ -n "$(git status --porcelain -unormal)" ]]; then
echo "-----------------------------" echo "-----------------------------"
@ -18,5 +18,5 @@ pkgs.writeShellScriptBin "ci-buf-check" ''
fi fi
# Report-only # Report-only
buf breaking . --against "./.git#ref=HEAD~1" || true (cd $(git rev-parse --show-toplevel) && (buf breaking . --against "./.git#ref=HEAD~1" || true))
'' ''