Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (54 loc) · 1.97 KB
/
Copy pathMakefile
File metadata and controls
75 lines (54 loc) · 1.97 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
APP := cmesh
GO ?= go
DIST_DIR ?= dist
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
COMMIT ?= $(shell git rev-parse --short=12 HEAD 2>/dev/null || echo unknown)
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
COSIGN_VERSION ?= v2.6.3
SYFT_VERSION ?= v1.45.1
LDFLAGS := -X cmesh/internal/version.Version=$(VERSION) -X cmesh/internal/version.Commit=$(COMMIT) -X cmesh/internal/version.Date=$(DATE)
.PHONY: test precommit unit vet fmt fmt-check mod-check supply-chain dup vuln workflow-lint install-check build-local build sbom release-notes sign deploy clean install-hooks
test: fmt-check mod-check supply-chain workflow-lint dup vuln install-check vet unit build-local
precommit: fmt-check mod-check supply-chain workflow-lint dup unit
unit:
$(GO) test ./...
vet:
$(GO) vet ./...
fmt:
$(GO) fmt ./...
fmt-check:
@scripts/check-gofmt.sh
mod-check:
@scripts/check-go-modules.sh
supply-chain:
@scripts/check-supply-chain.sh
dup:
@scripts/check-duplication.sh
vuln:
@scripts/check-vuln.sh
workflow-lint:
@scripts/check-workflows.sh
install-check:
@scripts/check-install-integrity.sh
build-local:
$(GO) build -trimpath -o /tmp/$(APP) ./cmd/cmesh
build:
@scripts/build-release.sh "$(APP)" "$(VERSION)" "$(COMMIT)" "$(DATE)" "$(DIST_DIR)"
sbom:
@scripts/generate-sboms.sh "$(DIST_DIR)" "$(SYFT_VERSION)"
release-notes:
@scripts/generate-release-notes.sh "$(VERSION)" "$(DIST_DIR)"
sign:
@scripts/sign-release.sh "$(DIST_DIR)" "$(COSIGN_VERSION)"
deploy: test
@if [ -z "$(VERSION)" ] || ! printf '%s' "$(VERSION)" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+([-+][0-9A-Za-z.-]+)?$$'; then \
echo "VERSION must be a semver tag such as v0.1.0"; exit 1; \
fi
@git diff --quiet || { echo "working tree has unstaged changes"; exit 1; }
@git diff --cached --quiet || { echo "index has staged changes"; exit 1; }
git tag -s "$(VERSION)" -m "$(APP) $(VERSION)"
git push origin "$(VERSION)"
clean:
rm -rf "$(DIST_DIR)"
install-hooks:
@scripts/install-hooks.sh