-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yaml
90 lines (87 loc) · 2.73 KB
/
Taskfile.yaml
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
version: '3'
dotenv:
- ".env"
vars:
CONTAINER_NAME: go-unittest-architecture-db
MIGRATIONS_PATH: migrations
tasks:
hello:
cmds:
- echo 'Hello World from Task!'
silent: true
desc: 'Hello Test Task.'
db:run:
cmds:
- docker run --rm --name {{.CONTAINER_NAME}}
-p $MYSQL_PORT:$MYSQL_PORT
-e MYSQL_ROOT_PASSWORD=$MYSQL_PASS
-e MYSQL_DATABASE=$MYSQL_DBNAME
-d mysql:latest
silent: true
desc: 'Run MySQL container.'
db:connect:
cmds:
- docker exec -it {{.CONTAINER_NAME}} mysql -uroot -p$MYSQL_PASS $MYSQL_DBNAME
silent: true
desc: 'Connect MySQL container.'
db:stop:
cmds:
- docker stop {{.CONTAINER_NAME}}
silent: true
desc: 'Stop MySQL container.When stop, container remove.'
migrate:create:
cmds:
- migrate create -ext sql -dir {{.MIGRATIONS_PATH}} -seq {{.CLI_ARGS}}
desc: 'Create migration file.Migration name must be specified as an argument.ex) task migrate:create -- create_user_table'
migrate:up:
cmds:
- migrate --path {{.MIGRATIONS_PATH}}
--database "mysql://$MYSQL_USER:$MYSQL_PASS@tcp($MYSQL_HOST:$MYSQL_PORT)/$MYSQL_DBNAME"
-verbose up
desc: 'Execution migration up.'
migrate:down:
cmds:
- migrate --path {{.MIGRATIONS_PATH}}
--database "mysql://$MYSQL_USER:$MYSQL_PASS@tcp($MYSQL_HOST:$MYSQL_PORT)/$MYSQL_DBNAME"
-verbose down
desc: 'Execution migration down.'
migrate:version:
cmds:
- migrate --path {{.MIGRATIONS_PATH}}
--database "mysql://$MYSQL_USER:$MYSQL_PASS@tcp($MYSQL_HOST:$MYSQL_PORT)/$MYSQL_DBNAME"
-verbose version
desc: 'Check current migration version.'
migrate:force:
cmds:
- migrate --path {{.MIGRATIONS_PATH}}
--database "mysql://$MYSQL_USER:$MYSQL_PASS@tcp($MYSQL_HOST:$MYSQL_PORT)/$MYSQL_DBNAME"
-verbose force {{.CLI_ARGS}}
desc: 'Execute force migration version.Migration version must be specified as an argument.ex)task migrate:force -- 2'
generate:
cmds:
- go generate ./...
desc: 'execute `go generate` command. generate mock by `gomock` and di by `wire`.'
generate:di:
cmds:
- wire gen
desc: 'execute `wire gen` command.'
update:golden:
cmds:
- go test -tags=e2e -v ./... -update -clean
desc: 'update golden file.'
test:unit:
cmds:
- go test -tags=unit -v -count=1 ./...
desc: 'execute unit tests.'
test:integration:
cmds:
- go test -tags=integration -v -count=1 ./...
desc: 'execute integration tests.'
test:e2e:
cmds:
- go test -tags=e2e -v -count=1 ./...
desc: 'execute e2e tests.'
test:all:
cmds:
- go test -tags=unit,integration,e2e -v -count=1 ./...
desc: 'execute all tests.'