-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
238 lines (213 loc) · 6.26 KB
/
Taskfile.yml
File metadata and controls
238 lines (213 loc) · 6.26 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
237
version: '3'
vars:
BINARY_NAME: codeplugs
BUILD_DIR: .
FRONTEND_DIR: frontend
env:
GO111MODULE: "on"
CGO_ENABLED: "0"
tasks:
default:
desc: Run lint and tests (default)
deps: [vet, test]
build:
desc: Build the Go binary (includes frontend)
deps: [frontend-build]
sources:
- "**/*.go"
- "go.mod"
- "go.sum"
generates:
- "{{.BINARY_NAME}}"
cmds:
- go build -o {{.BINARY_NAME}} main.go
fast-build:
desc: Quick build without rebuilding frontend
sources:
- "**/*.go"
- "go.mod"
- "go.sum"
generates:
- "{{.BINARY_NAME}}"
cmds:
- go build -o {{.BINARY_NAME}} main.go
frontend-install:
desc: Install frontend dependencies
dir: "{{.FRONTEND_DIR}}"
sources:
- package.json
- bun.lockb
generates:
- node_modules/**/**
cmds:
- bun install
frontend-build:
desc: Build the frontend
deps: [frontend-install]
dir: "{{.FRONTEND_DIR}}"
sources:
- src/**/**
- public/**/**
- index.html
- vite.config.ts
- package.json
generates:
- dist/**/**
cmds:
- bun run build
test:
desc: Run all tests
cmds:
- go test ./...
test-verbose:
desc: Run all tests with verbose output
cmds:
- go test -v ./...
test-race:
desc: Run all tests with race detector
cmds:
- go test -race ./...
clean:
desc: Remove build artifacts
cmds:
- go clean
- rm -f {{.BINARY_NAME}}
- rm -f codeplugs.db*
- rm -f *.csv
- rm -f *.txt
- rm -rf {{.FRONTEND_DIR}}/dist
run:
desc: Build and run the server
deps: [build]
cmds:
- ./{{.BINARY_NAME}} --serve
vet:
desc: Run go vet
cmds:
- go vet ./...
fmt:
desc: Run go fmt
cmds:
- go fmt ./...
fmt-check:
desc: Check if code is formatted
cmds:
- |
if [ -n "$(gofmt -l .)" ]; then
echo "Code is not formatted. Run 'task fmt' to fix."
gofmt -l .
exit 1
fi
lint:
desc: Run linter (golangci-lint if available, else vet)
cmds:
- |
if command -v golangci-lint &> /dev/null; then
golangci-lint run ./...
else
echo "golangci-lint not found, running go vet instead"
go vet ./...
fi
generate-contacts:
desc: Generate filtered contact list from filters/example-filter.csv
deps: [fast-build]
vars:
FILTER_FILE: '{{.FILTER_FILE | default "filters/example-filter.csv"}}'
SOURCE_FILE: '{{.SOURCE_FILE | default "user.csv"}}'
OUTPUT_FILE: '{{.OUTPUT_FILE | default "generated/contacts.csv"}}'
FORMAT: '{{.FORMAT | default "radioid"}}'
cmds:
- |
if [ ! -f '{{.SOURCE_FILE}}' ]; then
echo "Downloading RadioID.net contacts..."
curl -L -o '{{.SOURCE_FILE}}' 'https://radioid.net/static/user.csv'
fi
- ./{{.BINARY_NAME}} --generate-contacts --filter-file '{{.FILTER_FILE}}' --source-file '{{.SOURCE_FILE}}' --output-file '{{.OUTPUT_FILE}}' --contact-format '{{.FORMAT}}'
ci:
desc: Run all CI checks
deps: [fmt-check, vet, lint, test]
check:
desc: Run all checks (fmt, vet, lint, test, build)
deps: [fmt-check, vet, lint, test, build]
generate-brandmeister:
desc: Generate BrandMeister filtered contacts in all formats
deps: [fast-build]
vars:
FILTER_FILE: 'filters/filter-brandmeister.csv'
SOURCE_FILE: 'outputs/radioid-net-user.csv'
TIMESTAMP:
sh: date +%Y%m%d_%H%M%S
cmds:
- |
if [ ! -f '{{.SOURCE_FILE}}' ]; then
echo "Downloading RadioID.net contacts..."
curl -L -o '{{.SOURCE_FILE}}' 'https://radioid.net/static/user.csv'
echo "Downloaded to {{.SOURCE_FILE}}"
else
echo "Using existing source file: {{.SOURCE_FILE}}"
echo "Delete it to force re-download"
fi
- echo "Generating BrandMeister filtered contacts..."
- |
echo "Filter: {{.FILTER_FILE}} ($(wc -l < {{.FILTER_FILE}} | xargs) lines)"
- >
./{{.BINARY_NAME}} --generate-contacts
--filter-file '{{.FILTER_FILE}}'
--source-file '{{.SOURCE_FILE}}'
--output-file 'outputs/brandmeister-radioid-{{.TIMESTAMP}}.csv'
--contact-format 'radioid'
- >
./{{.BINARY_NAME}} --generate-contacts
--filter-file '{{.FILTER_FILE}}'
--source-file '{{.SOURCE_FILE}}'
--output-file 'outputs/brandmeister-dm32uv-{{.TIMESTAMP}}.csv'
--contact-format 'dm32uv'
- >
./{{.BINARY_NAME}} --generate-contacts
--filter-file '{{.FILTER_FILE}}'
--source-file '{{.SOURCE_FILE}}'
--output-file 'outputs/brandmeister-at890-{{.TIMESTAMP}}.csv'
--contact-format 'at890'
- echo ""
- echo "Generated files:"
- ls -lh outputs/brandmeister-*.csv | awk '{print $9, "(" $5 ")"}'
generate-brandmeister-clean:
desc: Clean and regenerate BrandMeister contacts (force re-download)
cmds:
- rm -f outputs/radioid-net-user.csv
- task generate-brandmeister
release:
desc: Build release binaries locally with GoReleaser (dry-run)
deps: [frontend-build]
cmds:
- |
if ! command -v goreleaser &> /dev/null; then
echo "Installing goreleaser..."
go install github.com/goreleaser/goreleaser/v2@latest
fi
- goreleaser release --snapshot --clean
release-local:
desc: Build release binaries for current platform only
deps: [frontend-build]
cmds:
- |
if ! command -v goreleaser &> /dev/null; then
echo "Installing goreleaser..."
go install github.com/goreleaser/goreleaser/v2@latest
fi
- goreleaser build --single-target --snapshot --clean
- echo "Binary built in dist/"
- ls -lh dist/
tag-release:
desc: Create a new version tag and push to trigger release
vars:
VERSION: '{{.VERSION | default ""}}'
cmds:
- |
if [ -z "{{.VERSION}}" ]; then
echo "Usage: VERSION=v1.2.3 task tag-release"
exit 1
fi
- git tag -a "{{.VERSION}}" -m "Release {{.VERSION}}"
- git push origin "{{.VERSION}}"
- echo "Pushed tag {{.VERSION}} - GitHub Actions will build and release"