-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yaml
157 lines (135 loc) · 4.34 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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
version: "3"
tasks:
# General Commands
proto:
cmds:
- rm -rf pb/*
- protoc --proto_path=proto --go_out=pb --go_opt=paths=source_relative
--go-grpc_out=pb --go-grpc_opt=paths=source_relative proto/*.proto
cert:
dir: certs
cmds:
- ./gen.sh
test:
cmds:
- go test $(go list ./... | grep -Ewv "(mock$|pb$|sqlc$)") -coverprofile=coverage.out
mock:
cmds:
- task: auth-mock
- task: wallet-mock
- task: contact-mock
- task: token-mock
env-cp:
cmds:
- cp ./auth/.env.example ./auth/app.env
- cp ./wallet/.env.example ./wallet/app.env
- cp ./contact/.env.example ./contact/app.env
- cp ./token/.env.example ./token/app.env
# Auth Command
auth-sqlc:
cmds:
- task: sqlc-gen
vars:
SQLC_CONFIG_PATH: ./auth/sqlc.yaml
auth-mig-new: # takes SCHEMA_NAME as argument
cmds:
- task: mig-new
vars:
MIGRATION_DIR_PATH: ./auth/internal/adapters/db/postgres/migrations
SCHEMA_NAME: ${SCHEMA_NAME}
auth-mig-up:
cmds:
- task: mig-up
vars:
MIGRATION_DIR_PATH: ./auth/internal/adapters/db/postgres/migrations
DATABASE_URL: postgres://postgres:postgres@localhost:5432/fingo_auth?sslmode=disable
auth-mig-down:
cmds:
- task: mig-down
vars:
MIGRATION_DIR_PATH: ./auth/internal/adapters/db/postgres/migrations
DATABASE_URL: postgres://postgres:postgres@localhost:5432/fingo_auth?sslmode=disable
auth-mock:
cmds:
- task: mock-gen # logic
vars:
SOURCE_FILE_PATH: ./auth/internal/application/ports.go
DESTINATION_MOCK_PATH: ./auth/internal/mock/mock.go
- task: mock-gen # db
vars:
SOURCE_FILE_PATH: ./auth/internal/adapters/db/postgres/sqlc/querier.go
DESTINATION_MOCK_PATH: ./auth/internal/mock/db.go
# Wallet Command
wallet-sqlc:
cmds:
- task: sqlc-gen
vars:
SQLC_CONFIG_PATH: ./wallet/sqlc.yaml
wallet-mig-new: # takes SCHEMA_NAME as argument
cmds:
- task: mig-new
vars:
MIGRATION_DIR_PATH: ./wallet/internal/adapters/db/sql/migrations
SCHEMA_NAME: ${SCHEMA_NAME}
wallet-mig-up:
cmds:
- task: mig-up
vars:
MIGRATION_DIR_PATH: ./wallet/internal/adapters/db/sql/migrations
DATABASE_URL: cockroach://root@localhost:26257/fingo_wallet?sslmode=disable
wallet-mig-down:
cmds:
- task: mig-down
vars:
MIGRATION_DIR_PATH: ./wallet/internal/adapters/db/sql/migrations
DATABASE_URL: cockroach://root@localhost:26257/fingo_wallet?sslmode=disable
wallet-mock:
cmds:
- task: mock-gen # logic
vars:
SOURCE_FILE_PATH: ./wallet/internal/application/ports.go
DESTINATION_MOCK_PATH: ./wallet/internal/mock/mock.go
- task: mock-gen # db
vars:
SOURCE_FILE_PATH: wallet/internal/adapters/db/sql/sqlc/querier.go
DESTINATION_MOCK_PATH: ./wallet/internal/mock/db.go
# Token Command
token-mock:
cmds:
- task: mock-gen # logic
vars:
SOURCE_FILE_PATH: ./token/internal/application/ports.go
DESTINATION_MOCK_PATH: ./token/internal/mock/mock.go
# Contact
contact-mock:
cmds:
- task: mock-gen # logic
vars:
SOURCE_FILE_PATH: ./contact/internal/application/ports.go
DESTINATION_MOCK_PATH: ./contact/internal/mock/mock.go
# Migration Command
sqlc-gen:
internal: true
desc: "generate sqlc code from sqlc.yaml"
cmds:
- sqlc generate -f {{.SQLC_CONFIG_PATH}}
mock-gen:
internal: true
desc: "generate mock files for testing"
cmds:
- mockgen -source {{.SOURCE_FILE_PATH}} -destination {{.DESTINATION_MOCK_PATH}} -package mock
mig-new:
internal: true
desc: "create a new migration file in the given directory with the given schema name"
cmds:
- migrate create -ext sql -dir {{.MIGRATION_DIR_PATH}} -seq ${SCHEMA_NAME}
mig-up:
internal: true
desc: "migrate up the whole database schema"
cmds:
- migrate -source "file://{{.MIGRATION_DIR_PATH}}" -database {{.DATABASE_URL}} up
mig-down:
internal: true
desc: "migrate down the whole database schema"
cmds:
- migrate -source "file://{{.MIGRATION_DIR_PATH}}" -database {{.DATABASE_URL}} down