-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
87 lines (70 loc) · 2.04 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
ALLDOC := $(shell find . \( -name "*.md" -o -name "*.yaml" \) \
-type f | sort)
.PHONY: build
build:
goreleaser build --single-target --snapshot --rm-dist
# tool-related commands
.PHONY: install-tools
install-tools:
go install github.com/mgechev/[email protected]
go install github.com/google/[email protected]
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/client9/misspell/cmd/[email protected]
go install github.com/sigstore/cosign/cmd/[email protected]
go install github.com/goreleaser/[email protected]
go install github.com/securego/gosec/v2/cmd/[email protected]
.PHONY: lint
lint:
revive -config .revive.toml -formatter friendly ./...
.PHONY: misspell
misspell:
misspell -error $(ALLDOC)
.PHONY: misspell-fix
misspell-fix:
misspell -w $(ALLDOC)
.PHONY: test
test:
go test -cover -race ./...
.PHONY: test-with-cover
test-with-cover:
go test -race -coverprofile=cover.out ./...
go tool cover -html=cover.out -o cover.html
.PHONY: check-fmt
check-fmt:
goimports -d ./ | diff -u /dev/null -
.PHONY: fmt
fmt:
goimports -w .
.PHONY: tidy
tidy:
go mod tidy -compat=1.18
.PHONY: gomoddownload
gomoddownload:
go mod download
.PHONY: gosec
gosec:
gosec ./...
# This target performs all checks that CI will do (excluding the build itself)
.PHONY: ci-checks
ci-checks: check-fmt misspell lint gosec test
.PHONY: release
release:
goreleaser release --parallelism 4 --rm-dist
.PHONY: release-test
release-test:
goreleaser release --parallelism 4 --skip-validate --skip-publish --skip-sign --rm-dist --snapshot
.PHONY: start-test-integration-server
start-test-integration-server:
bash example/scripts/generate-dev-certificates.sh
$(MAKE) build
sudo dist/registry_linux_amd64/registry \
--providers-dir server/testdata/providers \
--certificate example/scripts/tls/test.crt \
--private-key example/scripts/tls/test.key \
--port 443
.PHONY: run-test-integration
run-test-integration:
cd example && docker build . -t registry-client:latest
docker run -it \
--network host \
registry-client:latest init