-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
124 lines (104 loc) · 3.08 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
veil = cmd/veil/veil
veil_verify = cmd/veil-verify/veil-verify
veil_proxy = cmd/veil-proxy/veil-proxy
godeps = go.mod go.sum \
$(shell find cmd internal vendor -name "*.go" -type f)
image_tag = veil
image_dockerfile = docker/Dockerfile
image_tar := $(image_tag).tar
image_eif := $(image_tag).eif
image_test_tag = veil-unit-test
image_test_dockerfile = docker/Dockerfile-unit-test
image_test_tar := $(image_test_tag).tar
image_test_eif := $(image_test_tag).eif
cover_out = cover.out
cover_html = cover.html
all: $(veil) $(veil_verify) $(veil_proxy)
.PHONY: lint
lint: $(godeps)
go vet ./...
govulncheck ./...
golangci-lint run ./...
.PHONY: test
test: $(godeps)
go test -race -cover ./...
$(image_tar): $(godeps) $(image_dockerfile)
@echo "Building $(image_tar)..."
@docker run --volume $(PWD):/workspace \
gcr.io/kaniko-project/executor:v1.9.2 \
--dockerfile $(image_dockerfile) \
--reproducible \
--no-push \
--verbosity warn \
--tarPath $(image_tar) \
--destination $(image_tag) \
--custom-platform linux/amd64
$(image_eif): $(image_tar)
@echo "Building $(image_eif)..."
@docker load --quiet --input $<
@nitro-cli build-enclave \
--docker-uri $(image_tag) \
--output-file $(image_eif)
.PHONY: enclave
enclave: $(godeps) $(image_eif) terminate
@echo "Running enclave..."
@nitro-cli run-enclave \
--enclave-name veil \
--eif-path $(image_eif) \
--cpu-count 2 \
--memory 3850
$(image_test_tar): $(godeps) $(image_test_dockerfile)
@echo "Building $(image_test_tar)..."
@docker run --volume $(PWD):/workspace \
gcr.io/kaniko-project/executor:v1.9.2 \
--dockerfile $(image_test_dockerfile) \
--reproducible \
--no-push \
--verbosity warn \
--tarPath $(image_test_tar) \
--destination $(image_test_tag) \
--custom-platform linux/amd64
$(image_test_eif): $(image_test_tar)
@echo "Building $(image_test_eif)..."
@docker load --quiet --input $<
@nitro-cli build-enclave \
--docker-uri $(image_test_tag) \
--output-file $(image_test_eif)
.PHONY: enclave-test
enclave-test: $(godeps) $(image_test_eif) terminate
@echo "Running enclave tests..."
@nitro-cli run-enclave \
--enclave-name veil-unit-tests \
--eif-path $(image_test_eif) \
--attach-console \
--cpu-count 2 \
--memory 3850
.PHONY: terminate
terminate:
@nitro-cli terminate-enclave \
--all
.PHONY: coverage
coverage: $(cover_html)
open $(cover_html)
$(cover_out): $(godeps)
go test -coverprofile=$(cover_out) ./...
$(cover_html): $(cover_out)
go tool cover -html=$(cover_out) -o $(cover_html)
$(veil): $(godeps)
@CGO_ENABLED=0 go build \
-C $(shell dirname $(veil)) \
-trimpath \
-ldflags="-s -w" \
-buildvcs=false
@-sha1sum "$(veil)"
$(veil_verify): $(godeps)
@go build -C $(shell dirname $(veil_verify))
@-sha1sum "$(veil_verify)"
$(veil_proxy): $(godeps)
@go build -C $(shell dirname $(veil_proxy))
@-sha1sum "$(veil_proxy)"
.PHONY: clean
clean:
@rm -f $(veil) $(veil_verify) $(veil_proxy)
@rm -f $(cover_out) $(cover_html)
@rm -f $(image_tar) $(image_eif) $(image_test_tar) $(image_test_eif)