-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
94 lines (75 loc) · 2.88 KB
/
Taskfile.yml
File metadata and controls
94 lines (75 loc) · 2.88 KB
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
version: '3'
dotenv:
- .env.{{.ENV | default "test"}}
vars:
TREE_IGNORE: node_modules|.git|dist|*.env*
NODE_VERSION:
sh: cat .node-version
env:
PATH: "{{.HOME}}/.local/share/fnm/node-versions/{{.NODE_VERSION}}/installation/bin:{{.PATH}}"
tasks:
# ─────────────────────────────────────────────
# Core helpers
# ─────────────────────────────────────────────
compose:
desc: Run docker compose for an environment
cmds:
- docker compose --env-file .env.{{.ENV}} -f docker/docker-compose.{{.ENV}}.yml {{.CMD}}
check-env:
desc: Ensure required env vars exist
cmds:
- |
if [ -z "$DATABASE_URL" ]; then
echo "❌ DATABASE_URL missing in .env.{{.ENV}}"
exit 1
fi
migrate:
deps: [check-env]
cmds:
- pnpm migrate
# ─────────────────────────────────────────────
# Docker environments
# ─────────────────────────────────────────────
up:
desc: Start environment containers
cmds:
- task compose ENV={{.ENV | default "test"}} CMD="up -d {{.ARGS}}"
down:
desc: Stop environment containers
cmds:
- task compose ENV={{.ENV | default "test"}} CMD="down {{.ARGS}}"
stop:
desc: Stop containers without removing
cmds:
- task compose ENV={{.ENV | default "test"}} CMD="stop"
start:
desc: Start existing containers
cmds:
- task compose ENV={{.ENV | default "test"}} CMD="start"
reset:
desc: Reset environment (remove volumes)
cmds:
- task compose ENV={{.ENV | default "test"}} CMD="down -v"
# ─────────────────────────────────────────────
# Testing
# ─────────────────────────────────────────────
test:
desc: Run test suite
cmds:
- task reset ENV=test
- task up ENV=test ARGS="--wait"
- task migrate ENV=test
- |
pnpm jest || (task down ENV=test && exit 1)
- task down ENV=test
test-watch:
desc: Run tests in watch mode
cmds:
- pnpm jest {{.FILES}} --runInBand
# ─────────────────────────────────────────────
# Utils
# ─────────────────────────────────────────────
tree:
cmds:
- echo "🌳 Folder structure"
- tree -a -L 6 -I "{{.TREE_IGNORE}}" --prune