-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTaskfile.yml
More file actions
237 lines (200 loc) · 4.75 KB
/
Taskfile.yml
File metadata and controls
237 lines (200 loc) · 4.75 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
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
version: '3'
vars:
APP_NAME: tracker
DOCKER_IMAGE: bananaops/tracker
DOCKER_TAG: latest
GO_FILES:
sh: find . -name '*.go' -not -path "./vendor/*" -not -path "./web/*"
tasks:
default:
desc: Show available tasks
cmds:
- task --list
# Development tasks
generate:
desc: Generate protobuf files
cmds:
- buf dep update
- buf generate
sources:
- proto/**/*.proto
- buf.gen.yaml
generates:
- generated/**/*.go
fmt:
desc: Format protobuf and go files
cmds:
- buf format -w
- go fmt ./...
lint:
desc: Lint protobuf and go files
cmds:
- buf lint
- golangci-lint run ./...
lint:proto:
desc: Lint protobuf files only
cmds:
- buf lint
lint:go:
desc: Lint go files only
cmds:
- golangci-lint run ./...
test:
desc: Run Go tests
cmds:
- go test -v -race -coverprofile=coverage.out ./...
test:coverage:
desc: Run tests and show coverage
cmds:
- task: test
- go tool cover -html=coverage.out
# Build tasks
build:
desc: Build the Go application
cmds:
- go build -o bin/{{.APP_NAME}} .
sources:
- '**/*.go'
generates:
- bin/{{.APP_NAME}}
build:frontend:
desc: Build frontend
dir: web
cmds:
- npm install
- npm run build
sources:
- web/src/**/*
- web/package.json
generates:
- web/dist/**/*
build:all:
desc: Build frontend and backend
cmds:
- task: build:frontend
- task: build
# Run tasks
run:
desc: Run the application locally
deps: [build]
cmds:
- ./bin/{{.APP_NAME}} serv
dev:backend:
desc: Run backend with hot-reload (requires air)
cmds:
- air
dev:frontend:
desc: Run frontend dev server
dir: web
cmds:
- npm run dev
dev:all:
desc: Run backend and frontend in development mode
cmds:
- echo "🚀 Démarrage de l'application en mode développement..."
- echo "📦 Backend (Go) sur http://localhost:8080"
- echo "🎨 Frontend (Vite) sur http://localhost:5173"
- echo "📊 Metrics sur http://localhost:8081/metrics"
- echo "🔧 gRPC sur localhost:8765"
- echo ""
- echo "⚠️ Assurez-vous que MongoDB est en cours d'exécution"
- echo ""
- |
trap 'kill 0' EXIT
go run . serv &
cd web && npm run dev &
wait
# Docker tasks
docker:build:
desc: Build Docker image with frontend and backend
cmds:
- docker build -t {{.DOCKER_IMAGE}}:{{.DOCKER_TAG}} .
docker:run:
desc: Run Docker container locally
cmds:
- docker run -p 8080:8080 -p 8081:8081 -p 8765:8765 {{.DOCKER_IMAGE}}:{{.DOCKER_TAG}}
docker:build-run:
desc: Build and run Docker container
cmds:
- task: docker:build
- task: docker:run
docker:push:
desc: Push Docker image to registry
cmds:
- docker push {{.DOCKER_IMAGE}}:{{.DOCKER_TAG}}
# Kubernetes tasks
k8s:run:
desc: Deploy app on k8s with skaffold
cmds:
- skaffold run
k8s:dev:
desc: Run skaffold dev for local development with hot-reload
cmds:
- skaffold dev -f skaffold.dev.yaml
k8s:deploy:
desc: Deploy to kubernetes with skaffold
cmds:
- skaffold deploy
k8s:delete:
desc: Delete deployment from kubernetes
cmds:
- skaffold delete
k6:generate:
desc: Generate test data with k6
cmds:
- k6 run tests/k6/generate-test-data.js
k6:test-locks:
desc: Test locks API with k6
cmds:
- k6 run tests/k6/test-locks.js
test:locks:
desc: Test locks API with curl
cmds:
- ./scripts/test-locks.sh
# Clean tasks
clean:
desc: Clean build artifacts
cmds:
- rm -rf bin/
- rm -rf web/dist/
- rm -f coverage.out
clean:all:
desc: Clean all generated files
cmds:
- task: clean
- rm -rf generated/
- rm -rf web/node_modules/
# Install tasks
install:tools:
desc: Install development tools
cmds:
- go install github.com/bufbuild/buf/cmd/buf@latest
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- go install github.com/cosmtrek/air@latest
install:frontend:
desc: Install frontend dependencies
dir: web
cmds:
- npm install
install:all:
desc: Install all dependencies
cmds:
- task: install:tools
- task: install:frontend
# CI/CD tasks
ci:
desc: Run CI checks (lint, test, build)
cmds:
- task: lint
- task: test
- task: build:all
deps:
desc: Download Go dependencies
cmds:
- go mod download
- go mod tidy
deps:update:
desc: Update Go dependencies
cmds:
- go get -u ./...
- go mod tidy