-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
153 lines (121 loc) · 3.54 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
DBG_MAKEFILE ?=
ifeq ($(DBG_MAKEFILE),1)
$(warning ***** starting Makefile for goal(s) "$(MAKECMDGOALS)")
$(warning ***** $(shell date))
else
MAKEFLAGS += -s
endif
APP_NAME ?= gokiburi
ifeq ($(VERSION),)
# VERSION := $(shell git log -1 --format="%ad-%h" --date=format-local:"%Y%m%d%H%M%S" --abbrev=12)
VERSION := $(shell svu --strip-prefix --pre-release=dev)
endif
DBG ?=
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --warn-undefined-variables
.SUFFIXES:
OS := $(if $(GOOS),$(GOOS),$(shell go env GOOS))
ARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH))
GOFLAGS ?=
HTTP_PROXY ?=
HTTPS_PROXY ?=
export APP_NAME
export VERSION
export DBG
export OS
export ARCH
export GOFLAGS
export HTTP_PROXY
export HTTPS_PROXY
build: # @HELP builds snapshot binary for $OS/$ARCH to ./bin
build:
go run ci/main.go -run build
build-fe: # @HELP builds frontend to ./web/app/build
build-fe:
go run ci/main.go -run build-fe
verify: # @HELP runs backend and frontend tests, lints, audits, and verification builds
verify:
go run ci/main.go -run verify-all
verify-be: # @HELP runs backend tests, lints, audits, and verification build
verify-be:
go run ci/main.go -run verify-be
verify-fe: # @HELP runs frontend tests, lints, audits, and verification build
verify-fe:
go run ci/main.go -run verify-fe
version: # @HELP outputs the version string
version:
echo $(VERSION)
version-next: # @HELP outputs the next version string based on commits
version-next:
svu next
test: # @HELP runs backend and frontend tests
test:
go run ci/main.go -run test-all
test-be: # @HELP runs backend tests
test-be:
go run ci/main.go -run test-be
test-fe: # @HELP runs frontend tests
test-fe:
go run ci/main.go -run test-fe
lint: # @HELP lints backend, frontend, and GitHub Actions code
lint:
go run ci/main.go -run lint-all
lint-be: # @HELP lints backend code
lint-be:
go run ci/main.go -run lint-be
lint-fe: # @HELP lints frontend code
lint-fe:
go run ci/main.go -run lint-fe
lint-gha: # @HELP lints GitHub Actions
lint-gha:
go run ci/main.go -run lint-gha
lint-yaml: # @HELP lints all YAML files
lint-yaml:
go run ci/main.go -run lint-yaml
lint-goreleaser: # @HELP lints GoReleaser configuration
lint-goreleaser:
go run ci/main.go -run lint-goreleaser
lint-commits: # @HELP lints commit messages
lint-commits:
go run ci/main.go -run lint-commits
audit: # @HELP audits backend and frontend code for security issues
audit:
go run ci/main.go -run audit-all
audit-be: # @HELP audits backend code for security issues
audit-be:
go run ci/main.go -run audit-be
audit-fe: # @HELP audits frontend code for security issues
audit-fe:
go run ci/main.go -run audit-fe
clean: # @HELP removes build artifacts
clean:
rm -rf ./bin
rm -rf ./dist
rm -rf ./web/app/build
rm -f ./dependencies.csv
rm -f ./gokiburi.spdx.sbom
clean-ci: # @HELP removes Docker containers, volumes, and images for Dagger CI
clean-ci:
scripts/clean-ci.sh
gen-deps-csv: # @HELP generates CSV of dependencies to ./dependencies.csv
gen-deps-csv:
go run ci/main.go -run gen-deps-csv
gen-sbom: # @HELP generates SBOM file to ./$APP_NAME.spdx.sbom
gen-sbom:
go run ci/main.go -run gen-sbom
help: # @HELP prints this message
help:
echo "VARIABLES:"
echo " APP_NAME = $(APP_NAME)"
echo " VERSION = $(VERSION)"
echo " OS = $(OS)"
echo " ARCH = $(ARCH)"
echo " DBG = $(DBG)"
echo " GOFLAGS = $(GOFLAGS)"
echo
echo "TARGETS:"
grep -E '^.*: *# *@HELP' $(MAKEFILE_LIST) \
| awk ' \
BEGIN {FS = ": *# *@HELP"}; \
{ printf " %-30s %s\n", $$1, $$2 }; \
'