-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
63 lines (53 loc) · 2.12 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
SHELL=/usr/bin/env bash
PROJECTNAME=$(shell basename "$(PWD)")
LDFLAGS="-X 'main.buildTime=$(shell date)' -X 'main.lastCommit=$(shell git rev-parse HEAD)' -X 'main.semanticVersion=$(shell git describe --tags --dirty=-dev)'"
## help: Get more info on make commands.
help: Makefile
@echo " Choose a command run in "$(PROJECTNAME)":"
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
.PHONY: help
## build: Build wordle binary.
build:
@echo "--> Building Wordle"
@go build -o build/ -ldflags ${LDFLAGS} ./cmd/wordle
.PHONY: build
## clean: Clean up wordle binary.
clean:
@echo "--> Cleaning up ./build"
@rm -rf build/*
## install: Build and install the wordle binary into the GOBIN directory.
install:
@echo "--> Installing Wordle"
@go install -ldflags ${LDFLAGS} ./cmd/wordle
.PHONY: install
## fmt: Formats only *.go (excluding *.pb.go *pb_test.go). Runs `gofmt & goimports` internally.
fmt:
@find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs gofmt -w -s
@find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs goimports -w -local github.com/p2p-games
@go mod tidy
.PHONY: fmt
## lint: Linting *.go files using golangci-lint. Look for .golangci.yml for the list of linters.
lint:
@echo "--> Running linter"
@golangci-lint run
.PHONY: lint
## test-unit: Running unit tests
test-unit:
@echo "--> Running unit tests"
@go test -v `go list ./... | grep -v node/tests` -covermode=atomic -coverprofile=coverage.out
.PHONY: test-unit
## test-unit-race: Running unit tests with data race detector
test-unit-race:
@echo "--> Running unit tests with data race detector"
@go test -v -race `go list ./... | grep -v node/tests`
.PHONY: test-unit-race
## test-all: Running both unit and swamp tests
test:
@echo "--> Running all tests without data race detector"
@go test ./...
@echo "--> Running all tests with data race detector"
@go test -race ./...
.PHONY: test
PB_PKGS=$(shell find . -name 'pb' -type d)
PB_CORE=$(shell go list -f {{.Dir}} -m github.com/tendermint/tendermint)
PB_GOGO=$(shell go list -f {{.Dir}} -m github.com/gogo/protobuf)