Skip to content

Commit 73fb466

Browse files
authored
Merge pull request #14 from heitorrsdev/chore/migrate-makefile-to-taskfile
chore: migrate from Makefile to Taskfile
2 parents 9718c72 + a31b610 commit 73fb466

3 files changed

Lines changed: 134 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ jobs:
2727
- run: pnpm install --frozen-lockfile
2828

2929
- name: Lint
30-
run: make lint
30+
run: task lint
3131

3232
- name: Typecheck
33-
run: make typecheck
33+
run: task typecheck
3434

3535
- name: Integration Tests
36-
run: make ci-test
36+
run: task ci-test

Taskfile.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
version: '3'
2+
3+
vars:
4+
DEV_COMPOSE: docker/docker-compose.dev.yml
5+
PROD_COMPOSE: docker/docker-compose.prod.yml
6+
TEST_COMPOSE: docker/docker-compose.test.yml
7+
TREE_IGNORE: node_modules|.git|dist|*.env*
8+
9+
tasks:
10+
11+
# ─────────────────────────────────────────────
12+
# Environment
13+
# ─────────────────────────────────────────────
14+
15+
check-env:
16+
cmds:
17+
- |
18+
if [ -z "$DATABASE_URL" ]; then
19+
echo "❌ DATABASE_URL não definida"
20+
exit 1
21+
fi
22+
23+
# ─────────────────────────────────────────────
24+
# Quality
25+
# ─────────────────────────────────────────────
26+
27+
lint:
28+
cmds:
29+
- pnpm lint
30+
31+
typecheck:
32+
cmds:
33+
- pnpm tsc --noEmit
34+
35+
# ─────────────────────────────────────────────
36+
# CI
37+
# ─────────────────────────────────────────────
38+
39+
ci-test:
40+
cmds:
41+
- task test-reset
42+
- task test-up
43+
- task test-migrate
44+
- pnpm jest
45+
- task test-down
46+
47+
# ─────────────────────────────────────────────
48+
# DEV
49+
# ─────────────────────────────────────────────
50+
51+
dev-up:
52+
cmds:
53+
- echo "🚧 Subindo Postgres DEV"
54+
- docker compose -f {{.DEV_COMPOSE}} up -d
55+
56+
dev-stop:
57+
cmds:
58+
- echo "⏹️ Parando containers DEV"
59+
- docker compose -f {{.DEV_COMPOSE}} stop
60+
61+
dev-start:
62+
cmds:
63+
- echo "▶️ Iniciando containers DEV"
64+
- docker compose -f {{.DEV_COMPOSE}} start
65+
66+
dev-down:
67+
cmds:
68+
- echo "⬇️ Removendo containers DEV (mantendo volumes)"
69+
- docker compose -f {{.DEV_COMPOSE}} down
70+
71+
dev-reset:
72+
cmds:
73+
- echo "💥 Resetando ambiente DEV (containers + volumes)"
74+
- docker compose -f {{.DEV_COMPOSE}} down -v
75+
76+
dev-migrate:
77+
deps: [check-env]
78+
cmds:
79+
- npx ts-node src/infrastructure/scripts/migrate.ts
80+
81+
# ─────────────────────────────────────────────
82+
# PROD
83+
# ─────────────────────────────────────────────
84+
85+
prod-up:
86+
cmds:
87+
- echo "🚀 Subindo Postgres PROD"
88+
- docker compose -f {{.PROD_COMPOSE}} up -d
89+
90+
prod-migrate:
91+
deps: [check-env]
92+
cmds:
93+
- npx ts-node src/infrastructure/scripts/migrate.ts
94+
95+
# ─────────────────────────────────────────────
96+
# TEST
97+
# ─────────────────────────────────────────────
98+
99+
test-up:
100+
cmds:
101+
- echo "🧪 Subindo Postgres TEST"
102+
- docker compose -f {{.TEST_COMPOSE}} up -d --wait
103+
104+
test-down:
105+
cmds:
106+
- echo "⬇️ Removendo containers TEST (mantendo volumes)"
107+
- docker compose -f {{.TEST_COMPOSE}} down
108+
109+
test-reset:
110+
cmds:
111+
- echo "💥 Resetando ambiente TEST (containers + volumes)"
112+
- docker compose -f {{.TEST_COMPOSE}} down -v
113+
114+
test-migrate:
115+
deps: [check-env]
116+
cmds:
117+
- npx ts-node src/infrastructure/scripts/migrate.ts
118+
119+
# ─────────────────────────────────────────────
120+
# Utils
121+
# ─────────────────────────────────────────────
122+
123+
tree:
124+
cmds:
125+
- echo "🌳 Estrutura de pastas"
126+
- tree -a -L 6 -I "{{.TREE_IGNORE}}" --prune

docs/testing.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ This guarantees test isolation and reproducibility.
112112

113113
---
114114

115-
## Makefile Test Commands
115+
## Taskfile Test Commands
116116

117117
| Command | Description |
118118
| ------------------- | ------------------------------- |
119-
| `make test-up` | Start PostgreSQL test container |
120-
| `make test-reset` | Drop and recreate schema |
121-
| `make test-migrate` | Execute SQL migrations |
122-
| `make test` | Run Jest test suite |
119+
| `task test-reset` | Drop and recreate schema |
120+
| `task test-up` | Start PostgreSQL test container |
121+
| `task test-migrate` | Execute SQL migrations |
122+
| `task test` | Run Jest test suite |
123123

124124
---
125125

0 commit comments

Comments
 (0)