-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
49 lines (37 loc) · 1.63 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
GO_FILES=$(wildcard *.go */*.go */*/*.go */*/*/*.go)
# Can be overriden by for example: make test GO_TEST_CMD='gotestsum --'
GO_TEST_CMD=go test
help: ## Print usage
@sed -r '/^(\w[^:]+):[^#]*##/!d;s/^([^:]+):[^#]*##\s*(.*)/\x1b[36m\1\t:\x1b[m \2/g' ${MAKEFILE_LIST} | column -t -s $$'\t'
.PHONY: help
build: ## build package
go build -v .
.PHONY: build
test: ## run test and generate coverage report
${GO_TEST_CMD} -race -coverprofile=coverage.txt -covermode=atomic -v ./... && \
go tool cover -html=coverage.txt -o cover.html
.PHONY: test
corpus: ## run corpus tests on files in ./test/corpus
go run ./internal/cmd/testcorpus
.PHONY: corpus
corpus-update: ## update test files in ./test/corpus with the current kubecolor output
go run ./internal/cmd/testcorpus -update
.PHONY: corpus-update
testshort: ## run test and generate short report
${GO_TEST_CMD} -timeout 30s -count=1 ./... -test.short
.PHONY: testshort
fmt: ## format code
go fmt ./...
.PHONY: fmt
lint: ## lint code
staticcheck ./...
.PHONY: lint
config-schema.json: $(wildcard **/*.go) ## regenerate config-schema.json based on config package
go run ./internal/cmd/configschema -out config-schema.json
docs: $(patsubst %.txt,%.svg,$(wildcard docs/*.txt)) ## generate docs images
.PHONY: docs
# View available themes in charmbracelet/freeze: https://xyproto.github.io/splash/docs/index.html
docs/%.svg: ./docs/%.txt Makefile ./docs/freeze-config.json ${GO_FILES}
go run ./internal/cmd/imagegen $<
docs/%-light.svg: ./docs/%-light.txt Makefile ./docs/freeze-config-light.json ${GO_FILES}
go run ./internal/cmd/imagegen -freeze-config=./docs/freeze-config-light.json -flag-color=blue $<