Skip to content

Commit d474b07

Browse files
committed
docs: streamline README and split Taskfile into modules
Simplify README to essential quick-start info with links to detailed docs. Split Taskfile.yml into focused sub-files under .taskfiles/ for better maintainability (dev, prod, db, test tasks).
1 parent 82b95b9 commit d474b07

File tree

6 files changed

+132
-114
lines changed

6 files changed

+132
-114
lines changed

.taskfiles/db.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Database tasks
2+
version: '3'
3+
4+
tasks:
5+
migrate:
6+
desc: Run pending database migrations
7+
cmds:
8+
- "{{.COMPOSE_DEV}} --profile dev_backend run --rm devbin uv run alembic upgrade head"
9+
10+
migrate:new:
11+
desc: "Create new migration (usage: task db:migrate:new -- 'description')"
12+
cmds:
13+
- "{{.COMPOSE_DEV}} --profile dev_backend run --rm devbin uv run alembic revision --autogenerate -m '{{.CLI_ARGS}}'"
14+
15+
shell:
16+
desc: Open PostgreSQL shell
17+
cmds:
18+
- "{{.COMPOSE_DEV}} exec devbin_db psql -U postgres -d devbin"

.taskfiles/dev.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Development tasks
2+
version: '3'
3+
4+
tasks:
5+
up:
6+
desc: Start all development services
7+
cmds:
8+
- "{{.COMPOSE_DEV}} --profile dev_frontend --profile dev_backend up -d --build"
9+
10+
backend:
11+
desc: Start backend only (with database)
12+
env:
13+
APP_DEBUG: "true"
14+
cmds:
15+
- "{{.COMPOSE_DEV}} --profile dev_backend up -d --build"
16+
17+
db:
18+
desc: Start database only
19+
env:
20+
APP_DEBUG: "true"
21+
cmds:
22+
- "{{.COMPOSE_DEV}} up -d"
23+
24+
frontend:
25+
desc: Start frontend only
26+
env:
27+
APP_DEBUG: "true"
28+
cmds:
29+
- "{{.COMPOSE_DEV}} --profile dev_frontend up -d --build"
30+
31+
down:
32+
desc: Stop all development services
33+
cmds:
34+
- "{{.COMPOSE_DEV}} --profile dev_frontend --profile dev_backend down"
35+
36+
reset:
37+
desc: Reset development environment (removes volumes)
38+
cmds:
39+
- "{{.COMPOSE_DEV}} --profile dev_frontend --profile dev_backend down --volumes"
40+
- "{{.COMPOSE_DEV}} --profile dev_frontend --profile dev_backend up -d --build"
41+
42+
logs:
43+
desc: Tail logs from all development services
44+
cmds:
45+
- "{{.COMPOSE_DEV}} --profile dev_frontend --profile dev_backend logs -f"
46+
47+
logs:backend:
48+
desc: Tail backend logs only
49+
cmds:
50+
- "{{.COMPOSE_DEV}} --profile dev_backend logs -f devbin"

.taskfiles/prod.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Production tasks
2+
version: '3'
3+
4+
tasks:
5+
up:
6+
desc: Start production services
7+
cmds:
8+
- "{{.COMPOSE_PROD}} up -d"
9+
10+
down:
11+
desc: Stop production services
12+
cmds:
13+
- "{{.COMPOSE_PROD}} down"
14+
15+
logs:
16+
desc: Tail production logs
17+
cmds:
18+
- "{{.COMPOSE_PROD}} logs -f"

.taskfiles/test.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Testing tasks
2+
version: '3'
3+
4+
tasks:
5+
all:
6+
desc: Run all backend tests
7+
dir: backend
8+
cmds:
9+
- uv run pytest
10+
11+
unit:
12+
desc: Run unit tests only
13+
dir: backend
14+
cmds:
15+
- uv run pytest tests/unit
16+
17+
integration:
18+
desc: Run integration tests only
19+
dir: backend
20+
cmds:
21+
- uv run pytest tests/integration
22+
23+
cov:
24+
desc: Run tests with coverage report
25+
dir: backend
26+
cmds:
27+
- uv run pytest --cov=app --cov-report=term-missing

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Run `task --list` for all available commands.
2929
| `task dev:reset` | Reset with fresh volumes |
3030
| `task db:migrate` | Run migrations |
3131
| `task db:shell` | PostgreSQL shell |
32-
| `task test` | Run all tests |
32+
| `task test:all` | Run all tests |
3333
| `task prod:up` | Start production |
3434
| `task prod:down` | Stop production |
3535
| `task clean` | Remove containers and volumes |

Taskfile.yml

Lines changed: 18 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -6,123 +6,28 @@ vars:
66
COMPOSE_DEV: docker compose
77
COMPOSE_PROD: docker compose -f docker-compose.prod.yml
88

9-
tasks:
10-
# ====================
11-
# Development
12-
# ====================
13-
dev:up:
14-
desc: Start all development services
15-
cmds:
16-
- "{{.COMPOSE_DEV}} --profile dev_frontend --profile dev_backend up -d --build"
17-
18-
dev:backend:
19-
desc: Start backend only (with database)
20-
env:
21-
APP_DEBUG: "true"
22-
cmds:
23-
- "{{.COMPOSE_DEV}} --profile dev_backend up -d --build"
24-
25-
dev:db:
26-
desc: Start backend only (with database)
27-
env:
28-
APP_DEBUG: "true"
29-
cmds:
30-
- "{{.COMPOSE_DEV}} up -d"
31-
32-
dev:frontend:
33-
desc: Start frontend only
34-
env:
35-
APP_DEBUG: "true"
36-
cmds:
37-
- "{{.COMPOSE_DEV}} --profile dev_frontend up -d --build"
38-
39-
dev:down:
40-
desc: Stop all development services
41-
cmds:
42-
- "{{.COMPOSE_DEV}} --profile dev_frontend --profile dev_backend down"
43-
44-
dev:reset:
45-
desc: Reset development environment (removes volumes)
46-
cmds:
47-
- "{{.COMPOSE_DEV}} --profile dev_frontend --profile dev_backend down --volumes"
48-
- "{{.COMPOSE_DEV}} --profile dev_frontend --profile dev_backend up -d --build"
49-
50-
dev:logs:
51-
desc: Tail logs from all development services
52-
cmds:
53-
- "{{.COMPOSE_DEV}} --profile dev_frontend --profile dev_backend logs -f"
54-
55-
dev:logs:backend:
56-
desc: Tail backend logs only
57-
cmds:
58-
- "{{.COMPOSE_DEV}} --profile dev_backend logs -f devbin"
59-
60-
# ====================
61-
# Production
62-
# ====================
63-
prod:up:
64-
desc: Start production services
65-
cmds:
66-
- "{{.COMPOSE_PROD}} up -d"
67-
68-
prod:down:
69-
desc: Stop production services
70-
cmds:
71-
- "{{.COMPOSE_PROD}} down"
72-
73-
prod:logs:
74-
desc: Tail production logs
75-
cmds:
76-
- "{{.COMPOSE_PROD}} logs -f"
77-
78-
# ====================
79-
# Database
80-
# ====================
81-
db:migrate:
82-
desc: Run pending database migrations
83-
cmds:
84-
- "{{.COMPOSE_DEV}} --profile dev_backend run --rm devbin uv run alembic upgrade head"
85-
86-
db:migrate:new:
87-
desc: "Create new migration (usage: task db:migrate:new -- 'description')"
88-
cmds:
89-
- "{{.COMPOSE_DEV}} --profile dev_backend run --rm devbin uv run alembic revision --autogenerate -m '{{.CLI_ARGS}}'"
90-
91-
db:shell:
92-
desc: Open PostgreSQL shell
93-
cmds:
94-
- "{{.COMPOSE_DEV}} exec devbin_db psql -U postgres -d devbin"
95-
96-
# ====================
97-
# Testing
98-
# ====================
9+
includes:
10+
dev:
11+
taskfile: .taskfiles/dev.yml
12+
vars:
13+
COMPOSE_DEV: "{{.COMPOSE_DEV}}"
14+
prod:
15+
taskfile: .taskfiles/prod.yml
16+
vars:
17+
COMPOSE_PROD: "{{.COMPOSE_PROD}}"
18+
db:
19+
taskfile: .taskfiles/db.yml
20+
vars:
21+
COMPOSE_DEV: "{{.COMPOSE_DEV}}"
9922
test:
100-
desc: Run all backend tests
101-
dir: backend
102-
cmds:
103-
- uv run pytest
104-
105-
test:unit:
106-
desc: Run unit tests only
107-
dir: backend
108-
cmds:
109-
- uv run pytest tests/unit
110-
111-
test:integration:
112-
desc: Run integration tests only
113-
dir: backend
114-
cmds:
115-
- uv run pytest tests/integration
23+
taskfile: .taskfiles/test.yml
11624

117-
test:cov:
118-
desc: Run tests with coverage report
119-
dir: backend
25+
tasks:
26+
default:
27+
desc: Show available tasks
12028
cmds:
121-
- uv run pytest --cov=app --cov-report=term-missing
29+
- task --list
12230

123-
# ====================
124-
# Utilities
125-
# ====================
12631
build:
12732
desc: Build all containers
12833
cmds:

0 commit comments

Comments
 (0)