-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (43 loc) · 1.7 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
.PHONY: run debug infra test test_cbor test_generic run_optimized fmt openapi migrate check-migrations verify-migration-versioning
export RUST_LOG := shva=info
SERVICE_BASE_URL := "localhost:8042"
CURL := curl -sS -H 'x-auth-api-key:apikey1' --compressed -w "%{stderr}\nstatus=%{http_code} %{redirect_url} size=%{size_download} time=%{time_total} content-type=\"%{content_type}\"\n"
infra:
docker-compose up -d
run: infra
RUST_LOG=info cargo run
run_optimized: infra
RUST_LOG=info cargo run --release
debug:
RUST_LOG=debug cargo run
test: test_generic test_cbor
test_generic:
# 404
$(CURL) $(SERVICE_BASE_URL)/no-such-page
$(CURL) $(SERVICE_BASE_URL)/monitoring/metrics
$(CURL) $(SERVICE_BASE_URL)/
$(CURL) $(SERVICE_BASE_URL)/error
$(CURL) $(SERVICE_BASE_URL)/random-error
$(CURL) $(SERVICE_BASE_URL)/query/short
$(CURL) $(SERVICE_BASE_URL)/query/long
test_cbor:
@# CBOR
@# requires the rq command for decoding CBOR, install it with `cargo install record-query`.
@echo CBOR response
$(CURL) $(SERVICE_BASE_URL)/cbor-message/777 | rq -c
@echo cbor request
$(CURL) $(SERVICE_BASE_URL)/cbor-message/777 | $(CURL) $(SERVICE_BASE_URL)/cbor-ping/111 -X POST --data-binary @- -H 'Content-Type: application/cbor' | rq -c
fmt:
# Workaround for using unstable rustfmt features.
# When features are available in stable, move the options into rustfmt.toml and remove this.
cargo fmt -- --config imports_granularity=Crate,group_imports=StdExternalCrate
openapi:
cargo --quiet run -- openapi
migrate:
cargo --quiet run -- migrate
check-migrations:
cargo --quiet run -- check-migrations
verify-migration-versioning:
cargo --quiet run -- verify-migration-versioning
doc:
cargo doc -p shva --no-deps --open