-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
40 lines (35 loc) · 1.35 KB
/
Taskfile.yml
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
version: '3'
# for local development
# TODO: CI/CD設計時に根本から見直し
vars:
DB_NETWORK_NAME:
sh: echo $DB_NETWORK_NAME
DB_NAME:
sh: echo $DB_NAME
DB_SCHEMA_PATH:
sh: echo $(pwd)/tools/mysql/schema.sql
DB_SERVICE_NAME: db-local-sv
SQLDEF_IMAGE_TAG: mysqldef-runner
tasks:
test:run:
desc: pytest-xdist でテストを並列実行
cmds:
- python -m pytest -n auto
sqldef:build:
cmds:
- docker build -t {{.SQLDEF_IMAGE_TAG}} --no-cache ./tools/sqldef
db:up:
cmds:
- docker compose -f "./tools/mysql/docker-compose-local.yml" up -d --build
db:down:
cmds:
- docker compose -f "./tools/mysql/docker-compose-local.yml" down
db:dump:
cmds:
- docker run --rm -it --network {{.DB_NETWORK_NAME}} {{.SQLDEF_IMAGE_TAG}} sh -c "mysqldef -u root -p root -h {{.DB_SERVICE_NAME}} {{.DB_NAME}} --export"
db:dryrun:
cmds:
- docker run --rm -it --network {{.DB_NETWORK_NAME}} -v {{.DB_SCHEMA_PATH}}:/schema.sql {{.SQLDEF_IMAGE_TAG}} sh -c "mysqldef -u root -p root -h {{.DB_SERVICE_NAME}} {{.DB_NAME}} --dry-run --enable-drop-table < schema.sql"
db:apply:
cmds:
- docker run --rm -it --network {{.DB_NETWORK_NAME}} -v {{.DB_SCHEMA_PATH}}:/schema.sql {{.SQLDEF_IMAGE_TAG}} sh -c "mysqldef -u root -p root -h {{.DB_SERVICE_NAME}} {{.DB_NAME}} --enable-drop-table < schema.sql"