-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
122 lines (95 loc) · 3.22 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# gopkgs := ./cmd/... ./internal/... ./pkg/...
gopkgs := $(shell go list ./cmd/... ./internal/... ./pkg/... | grep -v internal/testutil)
.PHONY: precommit
precommit: tidy lint test docs-pre
.PHONY: generate
generate:
rm -f ./internal/fargate/sizes_gen.go
go generate ./...
.PHONY: tidy
tidy:
go mod verify
go mod tidy
@if ! git diff --quiet go.mod go.sum; then \
echo "please run go mod tidy and check in changes, you might have to use the same version of Go as the CI"; \
exit 1; \
fi
.PHONY: lint-install
lint-install:
@echo "Installing golangci-lint"
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2
.PHONY: lint
lint:
@which golangci-lint >/dev/null 2>&1 || { \
echo "golangci-lint not found, please run: make lint-install"; \
exit 1; \
}
@golangci-lint version
@golangci-lint run && echo "Code passed lint check!"
.PHONY: test-release
test-release:
@goreleaser release --skip-publish --clean --snapshot
.PHONY: check
check:
go run . check --debug -c cmd/testdata/valid.yml
go run . check --debug -c cmd/testdata/smoke.yml
go run . check --debug -c www/docs/static/examples/generic.yml
go run . check --debug -c www/docs/static/examples/simple_web.yml
.PHONY: schema
schema:
@go run . schema -o ./www/docs/static/schema.json
.PHONY: smokedeploy-debug
smokedeploy-debug:
@env AWS_PROFILE=ecsdeployer-example go run . deploy --debug -c cmd/testdata/smoke.yml --tag test --app-version 1.2.3
.PHONY: smokedeploy
smokedeploy:
@env AWS_PROFILE=ecsdeployer-example go run . deploy -c cmd/testdata/smoke.yml --tag test --app-version 1.2.3
.PHONY: gen-man
gen-man:
@./scripts/manpages.sh
.PHONY: showman
showman: gen-man
@gunzip -c manpages/ecsdeployer.1.gz | nroff -man - | more -s
.PHONY: test
test:
@./scripts/run_with_test_env.sh go test -timeout 180s $(gopkgs)
.PHONY: test-v
test-v:
@./scripts/run_with_test_env.sh go test -v -timeout 180s $(gopkgs)
.PHONY: test-smokedeploy
test-smokedeploy:
@./scripts/run_with_test_env.sh go test -timeout 180s -v ./cmd/ -run TestDeploySmoke -- --dump-cmd-output
.PHONY: test-testutil
test-testutil:
@go test -timeout 180s ./internal/testutil
.PHONY: test-single
test-single:
ifndef name
$(error Rerun as 'make <command> name=<something>')
endif
@./scripts/run_with_test_env.sh go test -v -timeout 180s $(gopkgs) -run $(name)
.PHONY: docs-serve
docs-serve:
cd www && mkdocs serve
.PHONY: docs-deploy
docs-deploy: generate docs-pre
cd www && mkdocs gh-deploy -c -b gh-pages -r newrepo --no-history
.PHONY: docs-pre
docs-pre:
@./scripts/cmd_docs.sh
.PHONY: outdated
outdated:
@go list -u -m -f '{{if not .Indirect}}{{if .Update}}{{.}}{{end}}{{end}}' all
.PHONY: coverage
coverage:
@mkdir -p coverage
# @# This is only within the package itself
# @#./scripts/run_with_test_env.sh go test $(gopkgs) -cover -coverprofile=coverage/c.out -covermode=count
# @# will do coverage over the whole project
@./scripts/run_with_test_env.sh go test $(gopkgs) -coverpkg=./... -coverprofile=coverage/c.out -covermode=count -short
# @# ignore testutil
@cat coverage/c.out | grep -v ecsdeployer/internal/testutil/ > coverage/c_notest.out
@go tool cover -html=coverage/c_notest.out -o coverage/index.html
.PHONY: htmltest
htmltest:
cd www && mkdocs build && htmltest -c htmltest.yml site