@@ -12,13 +12,39 @@ default: help
12
12
help : # # Display this help
13
13
@awk ' BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST )
14
14
15
+ # #@ Development
16
+
17
+ .PHONY : up
18
+ up : # # Start development environment
19
+ docker compose -f dev/vault/docker-compose.yml up -d
20
+
21
+ .PHONY : stop
22
+ stop : # # Stop development environment
23
+ docker compose -v -f dev/vault/docker-compose.yml stop
24
+
25
+ .PHONY : down
26
+ down : # # Destroy development environment
27
+ docker compose -v -f dev/vault/docker-compose.yml down
28
+
15
29
# #@ Build
16
30
17
31
.PHONY : build
18
32
build : # # Build binary
19
33
@mkdir -p build
20
34
go build -race -o build/
21
35
36
+ .PHONY : container-image
37
+ container-image : # # Build container image
38
+ docker build .
39
+
40
+ .PHONY : binary-snapshot
41
+ binary-snapshot : # # Build binary snapshot
42
+ VERSION=v${GORELEASER_VERSION} ${GORELEASER_BIN} release --clean --skip=publish --snapshot
43
+
44
+ .PHONY : artifacts
45
+ artifacts : container-image binary-snapshot
46
+ artifacts : # # Build artifacts
47
+
22
48
# #@ Checks
23
49
24
50
.PHONY : check
@@ -29,38 +55,45 @@ test: ## Run tests
29
55
go test -race -v ./...
30
56
31
57
.PHONY : lint
32
- lint : lint-go lint-yaml # lint-docker
58
+ lint : lint-go lint-docker lint-yaml
33
59
lint : # # Run linters
34
60
35
61
.PHONY : lint-go
36
62
lint-go :
37
63
$(GOLANGCI_LINT_BIN ) run $(if ${CI},--out-format github-actions,)
38
64
65
+ .PHONY : lint-docker
66
+ lint-docker :
67
+ hadolint Dockerfile
68
+
39
69
.PHONY : lint-yaml
40
70
lint-yaml :
41
71
yamllint $(if ${CI},-f github,) --no-warnings .
42
72
73
+ .PHONY : fmt
74
+ fmt : # # Format code
75
+ $(GOLANGCI_LINT_BIN ) run --fix
76
+
43
77
.PHONY : license-check
44
78
license-check : # # Run license check
45
79
$(LICENSEI_BIN ) check
46
80
$(LICENSEI_BIN ) header
47
81
48
- .PHONY : fmt
49
- fmt : # # Format code
50
- $(GOLANGCI_LINT_BIN ) run --fix
51
-
52
82
# #@ Dependencies
53
83
54
- deps : bin/golangci-lint bin/licensei
84
+ deps : bin/golangci-lint bin/licensei bin/cosign bin/goreleaser
55
85
deps : # # Install dependencies
56
86
57
87
# Dependency versions
58
- GOLANGCI_VERSION = 1.53.3
59
- LICENSEI_VERSION = 0.8.0
88
+ GOLANGCI_VERSION = 1.59.0
89
+ LICENSEI_VERSION = 0.9.0
90
+ COSIGN_VERSION = 2.2.4
91
+ GORELEASER_VERSION = 2.0.0
60
92
61
93
# Dependency binaries
62
94
GOLANGCI_LINT_BIN := golangci-lint
63
95
LICENSEI_BIN := licensei
96
+ GORELEASER_BIN := goreleaser
64
97
65
98
# If we have "bin" dir, use those binaries instead
66
99
ifneq ($(wildcard ./bin/.) ,)
@@ -75,3 +108,25 @@ bin/golangci-lint:
75
108
bin/licensei :
76
109
@mkdir -p bin
77
110
curl -sfL https://raw.githubusercontent.com/goph/licensei/master/install.sh | bash -s -- v${LICENSEI_VERSION}
111
+
112
+ bin/cosign :
113
+ @mkdir -p bin
114
+ @OS=$$(uname -s ) ; \
115
+ case $$ OS in \
116
+ " Linux" ) \
117
+ curl -sSfL https://github.com/sigstore/cosign/releases/download/v${COSIGN_VERSION} /cosign-linux-amd64 -o bin/cosign; \
118
+ ;; \
119
+ " Darwin" ) \
120
+ curl -sSfL https://github.com/sigstore/cosign/releases/download/v${COSIGN_VERSION} /cosign-darwin-arm64 -o bin/cosign; \
121
+ ;; \
122
+ * ) \
123
+ echo " Unsupported OS: $$ OS" ; \
124
+ exit 1; \
125
+ ;; \
126
+ esac
127
+ @chmod +x bin/cosign
128
+
129
+ bin/goreleaser :
130
+ @mkdir -p bin
131
+ curl -sfL https://goreleaser.com/static/run -o bin/goreleaser
132
+ @chmod +x bin/goreleaser
0 commit comments