-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
124 lines (96 loc) · 3.42 KB
/
Copy pathMakefile
File metadata and controls
124 lines (96 loc) · 3.42 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
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
DEV_NW := clails_dev_nw
DEV_BUILDER := .dev_image_build
DEV_DEPS := Dockerfile docker-compose.dev.yml qlfile clails.asd
DEV_NW_EXISTS := $(shell docker network ls --filter name=$(DEV_NW) --format '{{ .ID }}')
TEST_BUILDER := .test_image_built
TEST_DEPS := Dockerfile docker-compose.test.yml docker-compose.test-runner.yml clails.asd
E2E_BUILDER := .e2e_image_build
E2E_DEPS := Dockerfile.e2e docker-compose.e2e.yml clails.asd
.PHONY: setup
setup: dev.setup
@echo "Setting up..."
docker build -t clails-dev .
.PHONY: clean
clean:
rm -f $(DEV_BUILDER) $(TEST_BUILDER) $(E2E_BUILDER)
# ----------------------------------------
# for developing
# ----------------------------------------
.PHONY: dev.setup dev.up dev.down
dev.setup:
@if [ -z $(DEV_NW_EXISTS) ]; then \
docker network create -d bridge $(DEV_NW) ; \
fi
.PHONY: dev.build
dev.build: $(DEV_BUILDER)
$(DEV_BUILDER): $(DEV_DEPS)
docker compose -f docker-compose.dev.yml build --no-cache
touch $(DEV_BUILDER)
.PHONY: dev.up
dev.up: $(DEV_BUILDER)
@echo "Booting up..."
docker compose -f docker-compose.dev.yml up
.PHONY: dev.down
dev.down:
@echo "Shutting down..."
docker compose -f docker-compose.dev.yml down
.PHONY: dev.clean
dev.clean:
docker compose -f docker-compose.dev.down -v
rm -f $(DEV_BUILDER)
# ----------------------------------------
# for testing
# ----------------------------------------
.PHONY: test.build test.rebuild test.clean
test.build: $(TEST_BUILDER)
$(TEST_BUILDER): $(TEST_DEPS)
docker compose -f docker-compose.test-runner.yml build
touch $(TEST_BUILDER)
test.rebuild:
docker compose -f docker-compose.test-runner.yml build --no-cache
touch $(TEST_BUILDER)
.PHONY: test.prev
test.prev:
docker compose -f docker-compose.test.yml down || true
sleep 1
docker compose -f docker-compose.test.yml up -d
echo wait...
sleep 10
.PHONY: test
test: $(TEST_BUILDER) test.prev
@echo "Running tests..."
docker compose -f docker-compose.test-runner.yml run --rm --entrypoint rove clails-test /app/clails-test.asd
.PHONY: test.down
test.down:
@echo "Shutting down..."
docker compose -f docker-compose.test.yml down
.PHONY: test.console test.postgresql test.mysql test.sqlite3
test.console:
docker compose -f docker-compose.test-runner.yml run -it --rm --entrypoint /bin/bash clails-test
test.postgresql:
docker compose -f docker-compose.test-runner.yml run -it --rm --entrypoint /bin/bash clails-test /app/script/conn-postgresql.sh
test.mysql:
docker compose -f docker-compose.test-runner.yml run -it --rm --entrypoint /bin/bash clails-test /app/script/conn-mysql.sh
test.sqlite3:
docker compose -f docker-compose.test-runner.yml run -it --rm --entrypoint sqlite3 clails-test /qlot/volumes/clails_test.sqlite3
.PHONY: test.clean
test.clean:
docker compose -f docker-compose.test-runner.yml down -v
rm -f $(TEST_BUILDER)
# ----------------------------------------
# E2E testing
# ----------------------------------------
.PHONY: e2e.build e2e.test e2e.clean e2e.console
e2e.build: $(E2E_BUILDER)
$(E2E_BUILDER): $(E2E_DEPS)
docker compose -f docker-compose.e2e.yml build --no-cache
touch $(E2E_BUILDER)
e2e.test: $(E2E_BUILDER)
@echo "Running E2E tests..."
docker compose -f docker-compose.e2e.yml run --rm --entrypoint /bin/bash e2e-test /app/test/e2e/todo-app-e2e.sh
e2e.clean:
rm -f $(E2E_BUILDER)
docker compose -f docker-compose.e2e.yml down -v
e2e.console:
@echo "Starting E2E test console..."
docker compose -f docker-compose.e2e.yml run --rm e2e-test bash