Skip to content

Commit

Permalink
bump make files
Browse files Browse the repository at this point in the history
  • Loading branch information
hard-nett committed Nov 21, 2024
1 parent 587f6f4 commit c71bb63
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 90 deletions.
29 changes: 3 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
GOWORK=off go install -mod=readonly $(BUILD_FLAGS) $(GO_MODULE)/cmd/terpd
59 changes: 5 additions & 54 deletions scripts/makefiles/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
15 changes: 6 additions & 9 deletions scripts/makefiles/lint.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,24 @@ 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
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofumpt -w -s
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
@echo "--> Running markdown linter"
@docker run -v $(PWD):/workdir ghcr.io/igorshubovych/markdownlint-cli:latest "**/*.md"
4 changes: 3 additions & 1 deletion scripts/makefiles/release.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down

0 comments on commit c71bb63

Please sign in to comment.