-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (63 loc) · 2.31 KB
/
Makefile
File metadata and controls
79 lines (63 loc) · 2.31 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
.DEFAULT_GOAL := help
.PHONY: run
run: ## 実行する。スクショのキーを指定している
RUINS_PROFILE=development \
go run . play
.PHONY: test
test: ## テストを実行する
RUINS_LOG_LEVEL=ignore \
go test -v -cover -shuffle=on ./...
.PHONY: report
report: ## AIが読みやすい形でカバレッジレポートを表示する
RUINS_LOG_LEVEL=ignore \
go test -coverprofile=cover.out ./...
go tool cover -func=cover.out
.PHONY: build
build: ## ビルドする
./scripts/build.sh
.PHONY: vrt
vrt: ## 各ステートでスクショを取得する
./scripts/vrt.sh
.PHONY: fmt
fmt: ## フォーマットする
goimports -w .
npx @taplo/cli format
.PHONY: lint
lint: ## Linterを実行する
@go build -o /dev/null . # buildが通らない状態でlinter実行するとミスリードなエラーが出るので先に試す
@golangci-lint run -v ./...
@if deadcode -test ./... 2>&1 | grep -q "unreachable func"; then \
exit 1; \
fi
.PHONY: gendata
gendata: ## 現在の設定でデータファイルを生成する
go run . generate-item-doc
go run . generate-enemy-doc
UPDATE_GOLDEN=1 RUINS_LOG_LEVEL=ignore \
go test ./... -run Golden -v
.PHONY: aseprite
aseprite: ## asepriteでパッキングする。画像の変更を反映したら実行する
@./scripts/pack.sh
.PHONY: toolsinstall
toolsinstall: ## 開発ツールをインストールする
@go install golang.org/x/tools/cmd/goimports@latest
@go install golang.org/x/tools/cmd/deadcode@latest
@which golangci-lint > /dev/null || (echo "Installing golangci-lint..." && \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v2.2.2)
@npm install
@./scripts/setup-hooks.sh
.PHONY: check
check: fmt build test lint ## 一気にチェックする
# ================
.PHONY: memp
memp: ## 実行毎に保存しているプロファイルを見る
go tool pprof mem.pprof
.PHONY: pprof
pprof: ## サーバ経由で取得したプロファイルを見る。起動中でなければならない
go build .
go tool pprof ruins "http://localhost:6060/debug/pprof/profile?seconds=10"
# ================
.PHONY: help
help: ## ヘルプを表示する
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'