-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
126 lines (108 loc) · 2.44 KB
/
Copy pathTaskfile.yml
File metadata and controls
126 lines (108 loc) · 2.44 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
version: '3'
tasks:
build:
desc: Build the Go application
cmds:
- go build -tags "sqlite_fts5" -o traces-server .
build-ts:
desc: Build TypeScript
cmds:
- npx tsc
typecheck:
desc: Type check TypeScript
cmds:
- npx tsc --noEmit
run:
desc: Run the application locally
deps:
- build
- build-ts
cmds:
- ./traces-server
env:
PORT: "6270"
dev:
desc: Run with hot reloading (requires air)
cmds:
- air -c .air.toml
env:
PORT: "6270"
test:
desc: Run Go unit tests
cmds:
- go test -tags "sqlite_fts5" -v ./...
test:e2e:
desc: Run Playwright e2e tests
deps:
- build-ts
cmds:
- npx playwright test
test-all:
desc: Run all tests
cmds:
- task: test
- task: test:e2e
lint:
desc: Run go vet
cmds:
- go vet ./...
tidy:
desc: Format and tidy Go modules
cmds:
- go fmt ./...
- go mod tidy
docker-build:
desc: Build Docker image
cmds:
- docker build -t traces .
docker-run:
desc: Run Docker container
cmds:
- docker run -p 6270:6270 traces
docker-push:
desc: Push Docker image to registry
cmds:
- docker tag traces:latest ghcr.io/{{.USER}}/traces:latest
- docker push ghcr.io/{{.USER}}/traces:latest
clean:
desc: Clean build artifacts
cmds:
- rm -f traces-server
- rm -f traces.db
generate-swagger:
desc: Generate Swagger/OpenAPI documentation
cmds:
- swag init --parseDependency --parseInternal
prepush:
desc: Run all checks required before pushing (lint, build, test)
cmds:
- task: tidy
- task: generate-swagger
- task: lint
- task: build-ts
- task: build
- task: test
install-hooks:
desc: Install git pre-push hook that runs prepush checks
cmds:
- |
mkdir -p .git/hooks
cat > .git/hooks/pre-push << 'HOOK'
#!/bin/sh
echo "==> Running pre-push checks..."
task prepush 2>&1
if [ $? -ne 0 ]; then
echo "==> Pre-push checks FAILED. Fix errors before pushing."
exit 1
fi
echo "==> Pre-push checks PASSED."
HOOK
chmod +x .git/hooks/pre-push
echo "Pre-push hook installed at .git/hooks/pre-push"
all:
desc: Run build, test, and lint
cmds:
- task: tidy
- task: build
- task: test
- task: lint