-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
63 lines (57 loc) · 2.18 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
version: 3
env:
LOCAL_DB_URL: "postgres://sample_user:sample_password@localhost:5438/debefix-sample-app?sslmode=disable"
tasks:
run:
cmds:
- SERVER_CONFIG_FILE=./config/config.local.yaml go run ./cmd/server
gen:
cmds:
- "go run github.com/vektra/mockery/v2"
test:
cmds:
- "go test -race ./..."
test-db:
cmds:
- "go test -count=1 -race --tags=dbtest ./internal/infrastructure/database/integration_test/..."
test-db-migrations:
cmds:
- "go test -count=1 -race --tags=dbmigrationtest ./internal/infrastructure/database/integration_test/..."
local-deps-start:
cmds:
- "docker-compose -p debefix-sample-app-deps -f ./scripts/local-deps/docker-compose.yml up -d"
local-deps-stop:
cmds:
- "docker-compose -p debefix-sample-app-deps -f ./scripts/local-deps/docker-compose.yml down"
local-deps-logs:
cmds:
- "docker-compose -p debefix-sample-app-deps -f ./scripts/local-deps/docker-compose.yml logs"
local-deps-setup:
cmds:
- task: local-deps-destroy
- task: local-deps-start
- "sleep 3" # wait db initialization
- task: db-migration-up
- task: db-seed
local-deps-destroy:
cmds:
- "docker-compose -p debefix-sample-app-deps -f ./scripts/local-deps/docker-compose.yml down -v"
db-seed:
cmds:
- "DATABASE_URL=$LOCAL_DB_URL go run ./scripts/db-seed"
db-migration-create:
cmds:
- "docker run --rm -i -v ./scripts/db-migrations:/migrations --network host migrate/migrate:4 -path=/migrations/ create -ext sql -dir /migrations -seq {{.NAME}}"
requires:
vars: ["NAME"]
db-migration-up:
cmds:
- "docker run --rm -i -v ./scripts/db-migrations:/migrations --network host migrate/migrate:4 -path=/migrations/ -database $LOCAL_DB_URL up"
db-migration-down:
cmds:
- "docker run --rm -i -v ./scripts/db-migrations:/migrations --network host migrate/migrate:4 -path=/migrations/ -database $LOCAL_DB_URL down 1"
db-migration-force:
cmds:
- "docker run --rm -i -v ./scripts/db-migrations:/migrations --network host migrate/migrate:4 -path=/migrations/ -database $LOCAL_DB_URL force {{.VERSION}}"
requires:
vars: ["VERSION"]