-
Notifications
You must be signed in to change notification settings - Fork 37
/
Makefile
86 lines (69 loc) · 2.03 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
SERVER_FEATURES = --features cli
SERVER_BIN := bindle-server
CLIENT_FEATURES ?= --features=cli
CLIENT_BIN := bindle
BINDLE_DIRECTORY ?= ${HOME}/.bindle/bindles
BINDLE_LOG_LEVEL ?= debug
BINDLE_ID ?= enterprise.com/warpcore/1.0.0
BINDLE_IFACE ?= 127.0.0.1:8080
MIME ?= "application/toml"
CERT_NAME ?= ssl-example
TLS_OPTS ?= --tls-cert $(CERT_NAME).crt.pem --tls-key $(CERT_NAME).key.pem
AUTH_MODE ?= --unauthenticated
# Example of HTTP basic auth with the testing fixture data.
#AUTH_MODE ?= --htpasswd-file test/data/htpasswd
EMBEDDED_FLAG ?= --use-embedded-db
export RUST_LOG=error,warp=info,bindle=$(BINDLE_LOG_LEVEL)
.PHONY: test
test: build
test: test-fmt
test: test-e2e
test: test-docs
.PHONY: test-fmt
test-fmt:
cargo fmt --all -- --check
# Not called by `make test` because `test-e2e` does all the things already.
.PHONY: test-unit
test-unit:
cargo test --lib
.PHONY: test-docs
test-docs:
cargo test --doc --all
.PHONY: test-e2e
test-e2e:
cargo test --tests
.PHONY: serve-tls
serve-tls: $(CERT_NAME).crt.pem
serve-tls: EMBEDDED_FLAG =
serve-tls: _run
.PHONY: serve
serve: TLS_OPTS =
serve: EMBEDDED_FLAG =
serve: _run
.PHONY: serve-embedded
serve-embedded: TLS_OPTS =
serve-embedded: _run
.PHONY: serve-embedded-tls
serve-embedded-tls: $(CERT_NAME).crt.pem
serve-embedded-tls: _run
.PHONY: _run
_run:
cargo run $(SERVER_FEATURES) --bin $(SERVER_BIN) -- --directory $(BINDLE_DIRECTORY) --address $(BINDLE_IFACE) $(TLS_OPTS) $(EMBEDDED_FLAG) $(AUTH_MODE)
# Sort of a wacky hack if you want to do `$(make client) --help`
.PHONY: client
client:
@echo cargo run $(CLIENT_FEATURES) --bin $(CLIENT_BIN) --
.PHONY: build
build: build-server
build: build-client
.PHONY: build-server
build-server:
cargo build $(SERVER_FEATURES) --bin $(SERVER_BIN)
.PHONY: build-client
build-client:
cargo build $(CLIENT_FEATURES) --bin $(CLIENT_BIN)
$(CERT_NAME).crt.pem:
openssl req -newkey rsa:2048 -nodes -keyout $(CERT_NAME).key.pem -x509 -days 365 -out $(CERT_NAME).crt.pem
.PHONY: build-docker-image
build-docker-image:
docker build -t deislabs/bindle:dev .