From c71bb636388d9b2a6dae33dc09565e52f3ba3a42 Mon Sep 17 00:00:00 2001 From: hard-nett Date: Thu, 21 Nov 2024 16:31:13 -0500 Subject: [PATCH] bump make files --- Makefile | 29 ++---------------- scripts/makefiles/build.mk | 59 +++--------------------------------- scripts/makefiles/lint.mk | 15 ++++----- scripts/makefiles/release.mk | 4 ++- 4 files changed, 17 insertions(+), 90 deletions(-) diff --git a/Makefile b/Makefile index 87a03be..8ae13bf 100644 --- a/Makefile +++ b/Makefile @@ -17,12 +17,12 @@ help: @echo "Usage:" @echo " make [command]" @echo "" + @echo " make install Install terpd binary" @echo " make build Build terpd binary" - @echo " make build-help Show available build commands" + @echo " make build-help Show advanced available build commands" @echo " make deps Show available deps commands" @echo " make heighliner Show available docker commands" @echo " make e2e Show available e2e commands" - @echo " make install Install terpd binary" @echo " make lint Show available lint commands" @echo " make proto Show available proto commands" @echo " make release Show available release commands" @@ -149,27 +149,4 @@ build: build-check-version go.sum GOWORK=off go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR)/ $(GO_MODULE)/cmd/terpd install: build-check-version go.sum - GOWORK=off go install -mod=readonly $(BUILD_FLAGS) $(GO_MODULE)/cmd/terpd - -############################################################################### -### Release ### -############################################################################### -GORELEASER_IMAGE := ghcr.io/goreleaser/goreleaser-cross:v$(GO_VERSION) -COSMWASM_VERSION := $(shell go list -m github.com/CosmWasm/wasmvm | sed 's/.* //') - -ifdef GITHUB_TOKEN -release: - docker run \ - --rm \ - -e GITHUB_TOKEN=$(GITHUB_TOKEN) \ - -e COSMWASM_VERSION=$(COSMWASM_VERSION) \ - -v /var/run/docker.sock:/var/run/docker.sock \ - -v `pwd`:/go/src/terpd \ - -w /go/src/terpd \ - $(GORELEASER_IMAGE) \ - release \ - --clean -else -release: - @echo "Error: GITHUB_TOKEN is not defined. Please define it before running 'make release'." -endif \ No newline at end of file + GOWORK=off go install -mod=readonly $(BUILD_FLAGS) $(GO_MODULE)/cmd/terpd \ No newline at end of file diff --git a/scripts/makefiles/build.mk b/scripts/makefiles/build.mk index f5007aa..bc80a62 100644 --- a/scripts/makefiles/build.mk +++ b/scripts/makefiles/build.mk @@ -38,16 +38,8 @@ all: install @echo "--> project root: linting --fix" @GOGC=1 golangci-lint run --fix --timeout=8m -install: go.sum - go install -mod=readonly $(BUILD_FLAGS) ./cmd/terpd - -build: go.sum -ifeq ($(OS),Windows_NT) - $(error terpd server not supported. Use "make build-windows" for client) - exit 1 -else - go build -mod=readonly $(BUILD_FLAGS) -o build/terpd ./cmd/terpd -endif +build-linux: go.sum + LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build build-windows: go.sum GOOS=windows GOARCH=amd64 go build -mod=readonly $(BUILD_FLAGS) -o build/terpd.exe ./cmd/terpd @@ -79,8 +71,8 @@ build-reproducible-amd64: go.sum --load \ -f Dockerfile . $(DOCKER) rm -f terpbinary || true - $(DOCKER) create -ti --name terpbinary terpn-core:local-amd64 - $(DOCKER) cp terpbinary:/bin/terpd $(BUILDDIR)/terpd-linux-amd64 + $(DOCKER) create -ti --name terpbinary terp-core:local-amd64 + $(DOCKER) cp terpbinary:/usr/bin/terpd $(BUILDDIR)/terpd-linux-amd64 $(DOCKER) rm -f terpbinary build-reproducible-arm64: go.sum @@ -98,47 +90,6 @@ build-reproducible-arm64: go.sum -f Dockerfile . $(DOCKER) rm -f terpbinary || true $(DOCKER) create -ti --name terpbinary terp-core:local-arm64 - $(DOCKER) cp osmobinary:/bin/terpd $(BUILDDIR)/terpd-linux-arm64 + $(DOCKER) cp terpbinary:/usr/bin/terpd $(BUILDDIR)/terpd-linux-arm64 $(DOCKER) rm -f terpbinary -build-linux: go.sum - LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build - - -# build-install-with-autocomplete: build-check-version go.sum -# GOWORK=off go install -mod=readonly $(BUILD_FLAGS) $(GO_MODULE)/cmd/terpd -# @PARENT_SHELL=$$(ps -o ppid= -p $$PPID | xargs ps -o comm= -p); \ -# if echo "$$PARENT_SHELL" | grep -q "zsh"; then \ -# if ! grep -q ". <(terpd enable-cli-autocomplete zsh)" ~/.zshrc; then \ -# echo ". <(terpd enable-cli-autocomplete zsh)" >> ~/.zshrc; \ -# echo; \ -# echo "Autocomplete enabled. Run 'source ~/.zshrc' to complete installation."; \ -# else \ -# echo; \ -# echo "Autocomplete already enabled in ~/.zshrc"; \ -# fi \ -# elif echo "$$PARENT_SHELL" | grep -q "bash" && [ "$$(uname)" = "Darwin" ]; then \ -# if ! grep -q -e "\. <(terpd enable-cli-autocomplete bash)" -e '\[\[ -r "/opt/homebrew/etc/profile.d/bash_completion.sh" \]\] && \. "/opt/homebrew/etc/profile.d/bash_completion.sh"' ~/.bash_profile; then \ -# brew install bash-completion; \ -# echo '[ -r "/opt/homebrew/etc/profile.d/bash_completion.sh" ] && . "/opt/homebrew/etc/profile.d/bash_completion.sh"' >> ~/.bash_profile; \ -# echo ". <(terpd enable-cli-autocomplete bash)" >> ~/.bash_profile; \ -# echo; \ -# echo; \ -# echo "Autocomplete enabled. Run 'source ~/.bash_profile' to complete installation."; \ -# else \ -# echo "Autocomplete already enabled in ~/.bash_profile"; \ -# fi \ -# elif echo "$$PARENT_SHELL" | grep -q "bash" && [ "$$(uname)" = "Linux" ]; then \ -# if ! grep -q ". <(terpd enable-cli-autocomplete bash)" ~/.bash_profile; then \ -# sudo apt-get install -y bash-completion; \ -# echo '[ -r "/etc/bash_completion" ] && . "/etc/bash_completion"' >> ~/.bash_profile; \ -# echo ". <(terpd enable-cli-autocomplete bash)" >> ~/.bash_profile; \ -# echo; \ -# echo "Autocomplete enabled. Run 'source ~/.bash_profile' to complete installation."; \ -# else \ -# echo; \ -# echo "Autocomplete already enabled in ~/.bash_profile"; \ -# fi \ -# else \ -# echo "Shell or OS not recognized. Skipping autocomplete setup."; \ -# fi \ No newline at end of file diff --git a/scripts/makefiles/lint.mk b/scripts/makefiles/lint.mk index 85d200f..96d52ad 100644 --- a/scripts/makefiles/lint.mk +++ b/scripts/makefiles/lint.mk @@ -12,17 +12,17 @@ lint-help: @echo "" @echo "Available Commands:" @echo " format-tools Run linters with auto-fix" - @echo " markdown Run markdown linter with auto-fix" - @echo " mdlint Run markdown linter" + @echo " lint-markdown Run markdown linter with auto-fix" + @echo " lint-run Run golangci-lint" @echo "" -# lint: lint-help +lint: lint-help lint-format-tools: go install mvdan.cc/gofumpt@v0.4.0 go install github.com/client9/misspell/cmd/misspell@v0.3.4 go install golang.org/x/tools/cmd/goimports@latest -lint: lint-format-tools +lint-run: lint-format-tools golangci-lint run --tests=false find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*_test.go" | xargs gofumpt -d format: format-tools @@ -30,9 +30,6 @@ format: format-tools find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofumpt -w find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs goimports -w -local github.com/terpnetwork/terp-core -lint-mdlint: - @echo "--> Running markdown linter" - @docker run -v $(PWD):/workdir ghcr.io/igorshubovych/markdownlint-cli:latest "**/*.md" - lint-markdown: - @docker run -v $(PWD):/workdir ghcr.io/igorshubovych/markdownlint-cli:latest "**/*.md" --fix \ No newline at end of file + @echo "--> Running markdown linter" + @docker run -v $(PWD):/workdir ghcr.io/igorshubovych/markdownlint-cli:latest "**/*.md" \ No newline at end of file diff --git a/scripts/makefiles/release.mk b/scripts/makefiles/release.mk index 89ee836..82e1453 100644 --- a/scripts/makefiles/release.mk +++ b/scripts/makefiles/release.mk @@ -16,8 +16,10 @@ release-help: GORELEASER_IMAGE := ghcr.io/goreleaser/goreleaser-cross:v$(GO_VERSION) COSMWASM_VERSION := $(shell go list -m github.com/CosmWasm/wasmvm | sed 's/.* //') +release: release-help + ifdef GITHUB_TOKEN -release: +release-run: docker run \ --rm \ -e GITHUB_TOKEN=$(GITHUB_TOKEN) \