From b103d46ce7722d509d907e04059422ba1c1de64e Mon Sep 17 00:00:00 2001 From: = Date: Fri, 5 Jan 2024 10:04:03 +1300 Subject: [PATCH 1/2] Automate installation of yamllint Co-authored-by: James Blair Signed-off-by: = --- Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 939fdaa14..485482888 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ fuzz: # Static analysis verify: verify-gofmt verify-bom verify-lint verify-dep verify-shellcheck verify-goword \ - verify-govet verify-license-header verify-receiver-name verify-mod-tidy verify-shellcheck \ + verify-govet verify-license-header verify-receiver-name verify-mod-tidy \ verify-shellws verify-proto-annotations verify-genproto verify-yamllint \ verify-govet-shadow verify-markdown-marker fix: fix-bom fix-lint fix-yamllint @@ -131,7 +131,15 @@ verify-genproto: .PHONY: verify-yamllint verify-yamllint: +ifeq (, $(shell which yamllint)) + @echo "Installing yamllint..." + python3 -m venv bin/python + bin/python/bin/python3 -m pip install yamllint + ./bin/python/bin/yamllint --config-file tools/.yamllint . +else + @echo "yamllint already installed..." yamllint --config-file tools/.yamllint . +endif .PHONY: verify-govet-shadow verify-govet-shadow: @@ -154,7 +162,6 @@ endif GOLANGCI_LINT_VERSION = $(shell cd tools/mod && go list -m -f {{.Version}} github.com/golangci/golangci-lint) .PHONY: install-golangci-lint - install-golangci-lint: ifeq (, $(shell which golangci-lint)) $(shell curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin $(GOLANGCI_LINT_VERSION)) @@ -162,7 +169,6 @@ endif .PHONY: install-lazyfs install-lazyfs: bin/lazyfs - bin/lazyfs: rm /tmp/lazyfs -rf git clone --depth 1 --branch 0.2.0 https://github.com/dsrhaslab/lazyfs /tmp/lazyfs From dbfacb4260bb51ba58f0284499f4622adba30cf3 Mon Sep 17 00:00:00 2001 From: = Date: Fri, 5 Jan 2024 10:29:34 +1300 Subject: [PATCH 2/2] Ensure bin directory exists for protoc install Co-authored-by: James Blair Signed-off-by: = --- scripts/genproto.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/genproto.sh b/scripts/genproto.sh index 76c457157..52e94a1ba 100755 --- a/scripts/genproto.sh +++ b/scripts/genproto.sh @@ -40,6 +40,7 @@ if [[ $(protoc --version | cut -f2 -d' ') != "3.20.3" ]]; then download_url="https://github.com/protocolbuffers/protobuf/releases/download/v3.20.3/protoc-3.20.3-linux-${file}.zip" echo "Running on ${arch}." + mkdir -p bin wget ${download_url} && unzip -p protoc-3.20.3-linux-${file}.zip bin/protoc > tmpFile && mv tmpFile bin/protoc rm protoc-3.20.3-linux-${file}.zip chmod +x bin/protoc