-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (40 loc) · 1.54 KB
/
Copy pathMakefile
File metadata and controls
54 lines (40 loc) · 1.54 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
.PHONY: build test lint fmt check docker docker-agent docker-node up down e2e release clean
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
build:
cargo build --release -p towonel-agent -p towonel-node
test:
cargo test --all-targets
lint:
cargo clippy --all-targets -- -D warnings
fmt:
cargo fmt --check
check: fmt lint test
docker:
docker build -t towonel:$(VERSION) .
docker-agent:
docker build -f Dockerfile.agent -t towonel-agent:$(VERSION) .
docker-node:
docker build -f Dockerfile.node -t towonel-node:$(VERSION) .
up:
docker compose up --build -d
down:
docker compose down
# NB: run detached and `docker wait` on the runner instead of
# --abort-on-container-exit; the route_recovery case restarts the hub, which
# would otherwise trip the abort and kill the runner mid-test.
e2e:
./tests/e2e/fixtures/make-fixtures.sh
docker compose --env-file .env.e2e -f docker-compose.e2e.yml down -v
docker compose --env-file .env.e2e -f docker-compose.e2e.yml up --build --detach
@code=$$(docker wait towonel-e2e-runner); \
docker compose --env-file .env.e2e -f docker-compose.e2e.yml logs --no-color test-runner; \
echo "test-runner exit code: $$code"; \
docker compose --env-file .env.e2e -f docker-compose.e2e.yml down -v; \
exit $$code
release:
@test -n "$(V)" || (echo "usage: make release V=0.1.0" && exit 1)
git tag -a "v$(V)" -m "v$(V)"
@echo "Tagged v$(V). Push with: git push origin v$(V)"
clean:
cargo clean
docker compose --env-file .env.e2e -f docker-compose.e2e.yml down -v 2>/dev/null || true