Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 0 additions & 90 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,93 +6,3 @@ VERSION := $(shell git describe --tags --always --dirty="-dev")

##@ Help

.PHONY: help
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

.PHONY: v
v: ## Show the version
@echo "Version: ${VERSION}"

##@ Build

.PHONY: clean
clean: ## Clean the build directory
rm -rf build/

.PHONY: build-cli
build-cli: ## Build the CLI
@mkdir -p ./build
go build -trimpath -ldflags "-X github.com/flashbots/go-template/common.Version=${VERSION}" -v -o ./build/cli cmd/cli/main.go

.PHONY: build-httpserver
build-httpserver: ## Build the HTTP server
@mkdir -p ./build
go build -trimpath -ldflags "-X github.com/flashbots/go-template/common.Version=${VERSION}" -v -o ./build/httpserver cmd/httpserver/main.go

.PHONY: build
build: build-cli build-httpserver ## Build all binaries
@echo "Binaries built in ./build/"

##@ Test & Development

.PHONY: test
test: ## Run tests
go test ./...

.PHONY: test-race
test-race: ## Run tests with race detector
go test -race ./...

.PHONY: lint
lint: ## Run linters
gofmt -d -s .
gofumpt -d -extra .
go vet ./...
staticcheck ./...
golangci-lint run
# nilaway ./...

.PHONY: fmt
fmt: ## Format the code
gofmt -s -w .
gci write .
gofumpt -w -extra .
go mod tidy

.PHONY: gofumpt
gofumpt: ## Run gofumpt
gofumpt -l -w -extra .

.PHONY: lt
lt: lint test ## Run linters and tests

.PHONY: cover
cover: ## Run tests with coverage
go test -coverprofile=/tmp/go-sim-lb.cover.tmp ./...
go tool cover -func /tmp/go-sim-lb.cover.tmp
unlink /tmp/go-sim-lb.cover.tmp

.PHONY: cover-html
cover-html: ## Run tests with coverage and open the HTML report
go test -coverprofile=/tmp/go-sim-lb.cover.tmp ./...
go tool cover -html=/tmp/go-sim-lb.cover.tmp
unlink /tmp/go-sim-lb.cover.tmp

.PHONY: docker-cli
docker-cli: ## Build the CLI Docker image
DOCKER_BUILDKIT=1 docker build \
--platform linux/amd64 \
--build-arg VERSION=${VERSION} \
--file cli.dockerfile \
--tag your-project \
.

.PHONY: docker-httpserver
docker-httpserver: ## Build the HTTP server Docker image
DOCKER_BUILDKIT=1 docker build \
--platform linux/amd64 \
--build-arg VERSION=${VERSION} \
--file httpserver.dockerfile \
--tag your-project \
.