-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
115 lines (91 loc) · 4.08 KB
/
Copy pathMakefile
File metadata and controls
115 lines (91 loc) · 4.08 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
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
GO ?= go
ifeq ($(strip $(GOROOT)),)
else ifeq ($(wildcard $(GOROOT)),)
GO := env -u GOROOT $(GO)
endif
VERSION ?= dev
REPOSITORY ?= devr-tools/cleanr
SOURCE_SHA256 ?=
HOMEBREW_LICENSE ?=
GOCACHE ?= $(CURDIR)/.gocache
REPORT_FORMAT ?= text
REPORT_PRESET ?= fail
REPORT_INPUT ?=
CI_BASE_REF ?=
CODEGUARD_VERSION ?= v0.2.0
UI_GOROOT ?= /opt/homebrew/opt/go/libexec
UI_GOPATH ?= $(HOME)/go
.DEFAULT_GOAL := menu
export GOCACHE
DASHBOARD_OUTPUT ?= dist/dashboard/report.html
.PHONY: menu help fmt fmt-check lint test test-dashboard dashboard test-review-ui preview-review-ui gofiles check ci commit build release homebrew-formula deploy report clean
menu:
@printf "\ncleanr make menu\n\n"
@printf " make fmt Format Go files\n"
@printf " make fmt-check Verify Go files are formatted\n"
@printf " make lint Run go vet\n"
@printf " make test Run the Go test suite\n"
@printf " make test-dashboard Run focused HTML dashboard tests\n"
@printf " make dashboard Render a sample HTML dashboard to dist/dashboard/\n"
@printf " make test-review-ui Run focused interactive dataset review tests\n"
@printf " make preview-review-ui Launch the live interactive dataset review preview\n"
@printf " make gofiles Validate and list Go file layout\n"
@printf " make check Run gofiles, fmt-check, lint, and test\n"
@printf " make ci Run the local CI parity gate used before commit\n"
@printf " make commit Stage, commit, and push the current branch with a conventional commit message\n"
@printf " make build Build the cleanr CLI to dist/cleanr\n"
@printf " make release Package release artifacts to dist/releases (use VERSION=...)\n"
@printf " make homebrew-formula Generate a Homebrew formula for a release (use VERSION=...)\n"
@printf " make deploy Alias for make release\n"
@printf " make report Preview the terminal report UI\n"
@printf " make clean Remove dist/ and .gocache/\n"
@printf "\nVariables:\n"
@printf " VERSION=%s\n" "$(VERSION)"
@printf " GO=%s\n" "$(GO)"
@printf " SOURCE_SHA256=%s\n" "$(SOURCE_SHA256)"
@printf " HOMEBREW_LICENSE=%s\n" "$(HOMEBREW_LICENSE)"
@printf " REPORT_FORMAT=%s\n" "$(REPORT_FORMAT)"
@printf " REPORT_PRESET=%s\n" "$(REPORT_PRESET)"
@printf " REPORT_INPUT=%s\n" "$(REPORT_INPUT)"
@printf " CI_BASE_REF=%s\n" "$(CI_BASE_REF)"
@printf " CODEGUARD_VERSION=%s\n" "$(CODEGUARD_VERSION)"
@printf " GOCACHE=%s\n" "$(GOCACHE)"
@printf " UI_GOROOT=%s\n" "$(UI_GOROOT)"
@printf " UI_GOPATH=%s\n\n" "$(UI_GOPATH)"
help: menu
fmt:
$(GO) run ./cmd/cleanr-dev fmt
fmt-check:
$(GO) run ./cmd/cleanr-dev fmt-check
lint:
$(GO) run ./cmd/cleanr-dev lint
test:
$(GO) run ./cmd/cleanr-dev test
test-dashboard:
env -u GOROOT GOCACHE=$(GOCACHE) go test ./tests/report ./tests/cli -run 'Test(WriteReportSupportsAllFormats|ReportPackageSupportsPlainAndColorText|CLIRunWritesHTMLReport|TrendsCommandWritesHTMLSummary)$$'
dashboard:
mkdir -p $(dir $(DASHBOARD_OUTPUT))
$(GO) run ./cmd/cleanr-dev report -format html -preset $(REPORT_PRESET) -output $(DASHBOARD_OUTPUT)
test-review-ui:
@GOROOT=$(UI_GOROOT) GOPATH=$(UI_GOPATH) GOCACHE=$(GOCACHE) go run ./cmd/cleanr-dev test-review-ui
preview-review-ui:
@GOROOT=$(UI_GOROOT) GOPATH=$(UI_GOPATH) GOCACHE=$(GOCACHE) go run ./cmd/cleanr-dev preview-review-ui
gofiles:
$(GO) run ./cmd/cleanr-dev gofiles
check:
$(GO) run ./cmd/cleanr-dev check
ci:
$(GO) run ./cmd/cleanr-dev ci $(if $(CI_BASE_REF),-base-ref $(CI_BASE_REF),) -codeguard-version $(CODEGUARD_VERSION)
commit:
@./scripts/commit.sh
build:
$(GO) run ./cmd/cleanr-dev build -output dist/cleanr
release:
$(GO) run ./cmd/cleanr-dev release -version $(VERSION) -output dist/releases
homebrew-formula:
$(GO) run ./cmd/cleanr-dev homebrew-formula -version $(VERSION) -repository $(REPOSITORY) -source-sha256 $(SOURCE_SHA256) $(if $(HOMEBREW_LICENSE),-license $(HOMEBREW_LICENSE),) -output dist/releases/$(VERSION)/cleanr.rb
deploy: release
report:
$(GO) run ./cmd/cleanr-dev report -format $(REPORT_FORMAT) -preset $(REPORT_PRESET) $(if $(REPORT_INPUT),-input $(REPORT_INPUT),)
clean:
rm -rf dist .gocache