-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Makefile
78 lines (74 loc) · 2.53 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
DB_PG_PORT=5000
DB_MYSQL_PORT=5001
DB_USER=root
DB_PWD=pwd
DB_NAME=nessie
NESSIE_VERSION=2.0.11
DENO_VERSION?=1.24.1
DOCKER_IMAGE=halvardm/nessie
test_all: test_fmt test_unit db_all_restart test_integration_cli db_all_restart test_integration_update_timestamps image_build image_test_clean image_test image_test_clean
test: test_all
test_fmt:
deno lint
deno fmt --check
test_unit:
deno task test:unit
test_integration_cli:
deno task test:integration:cli
test_integration_update_timestamps:
deno task test:integration:update_timestamp
db_all_restart: db_all_stop db_all_start
db_all_start: db_pg_start db_mysql_start db_sqlite_start
db_all_stop: db_pg_stop db_mysql_stop db_sqlite_stop
db_pg_start:
docker run -d --rm \
-p $(DB_PG_PORT):5432 \
-e POSTGRES_USER=$(DB_USER) \
-e POSTGRES_PASSWORD=$(DB_PWD) \
-e POSTGRES_DB=${DB_NAME} \
-v `pwd`/tests/data/pg:/var/lib/postgresql/data \
--name $(DB_NAME)-pg \
--health-cmd pg_isready \
--health-interval 10s \
--health-timeout 5s \
--health-retries 5 \
postgres:latest
while [ "`docker inspect -f {{.State.Health.Status}} $(DB_NAME)-pg`" != "healthy" ]; do sleep 10; done
sleep 5
db_pg_stop:
docker kill ${DB_NAME}-pg | true
rm -rf tests/data/pg
db_mysql_start:
# docker run -d -p $(DB_MYSQL_PORT):3306 -e MYSQL_ROOT_PASSWORD=$(DB_PWD) -e MYSQL_DATABASE=${DB_NAME} -v `pwd`/tests/data/mysql:/var/lib/mysql --rm --name $(DB_NAME)-mysql mysql:5
docker run -d --rm \
-p $(DB_MYSQL_PORT):3306 \
-e MYSQL_ALLOW_EMPTY_PASSWORD=true \
-e MYSQL_DATABASE=${DB_NAME} \
-v `pwd`/tests/data/mysql:/var/lib/mysql \
--name $(DB_NAME)-mysql \
--health-cmd "mysqladmin ping" \
--health-interval 10s \
--health-timeout 5s \
--health-retries 5 \
mysql:latest
while [ "`docker inspect -f {{.State.Health.Status}} $(DB_NAME)-mysql`" != "healthy" ]; do sleep 10; done
sleep 5
db_mysql_stop:
docker kill ${DB_NAME}-mysql | true
rm -rf tests/data/mysql
db_sqlite_start:
mkdir -p tests/data && touch tests/data/sqlite.db
db_sqlite_stop:
rm -rf tests/data/sqlite.db
image_build:
docker build --pull --build-arg DENO_VERSION=$(DENO_VERSION) -f ./image/Dockerfile -t $(DOCKER_IMAGE):latest -t $(DOCKER_IMAGE):$(NESSIE_VERSION) .
image_push:
docker push -a $(DOCKER_IMAGE)
image_test:
docker run --rm -v `pwd`/tests/image:/nessie $(DOCKER_IMAGE) init --dialect sqlite
docker run --rm -v `pwd`/tests/image:/nessie $(DOCKER_IMAGE) make test
docker run --rm -v `pwd`/tests/image:/nessie $(DOCKER_IMAGE) migrate
image_test_clean:
rm -rf tests/image/*
image_run:
docker run --rm -v `pwd`/tests/image:/nessie $(DOCKER_IMAGE) help