-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathTaskfile.yml
More file actions
357 lines (321 loc) · 16 KB
/
Taskfile.yml
File metadata and controls
357 lines (321 loc) · 16 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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
version: "3"
tasks:
dev:vite:
desc: Run the Vite development server
cmds:
- npm run dev
dev:
desc: Run the Outrig monitor in development mode
cmds:
- mkdir -p server/pkg/web/dist
- touch server/pkg/web/dist/.gitkeep
- OUTRIG_DEV=1 OUTRIG_OUTRIGBINPATH="bin/outrig" go run -ldflags "-X main.OutrigBuildTime=$(date +%Y%m%d%H%M%S) -X main.OutrigCommit=$(git rev-parse --short HEAD)" server/main-server.go monitor foreground
devrun:
desc: Run the Outrig monitor in development mode (using `outrig run`)
cmds:
- mkdir -p server/pkg/web/dist
- touch server/pkg/web/dist/.gitkeep
- OUTRIG_DEV=1 OUTRIG_OUTRIGBINPATH="bin/outrig" go run server/main-server.go -v run -ldflags "-X main.OutrigBuildTime=$(date +%Y%m%d%H%M%S) -X main.OutrigCommit=$(git rev-parse --short HEAD)" server/main-server.go monitor foreground
clean:webdist:
desc: Clean the web embed directory for Outrig monitor
cmds:
- rm -rf server/pkg/web/dist
- mkdir -p server/pkg/web/dist
- touch server/pkg/web/dist/.gitkeep
clean:
desc: Clean build artifacts
deps: [clean:webdist]
cmds:
- rm -rf dist dist-fe
build:frontend:
desc: Build the frontend for production
deps: [clean]
cmds:
- npm run build
- cp -r dist-fe/* server/pkg/web/dist/
build:server:
desc: Build the Outrig monitor with embedded frontend
deps: [build:frontend]
cmds:
- mkdir -p bin/
- go build -ldflags "-X main.OutrigBuildTime=$(date +%Y%m%d%H%M%S) -X main.OutrigCommit=$(git rev-parse --short HEAD)" -o bin/outrig server/main-server.go
build:linuxserver:
desc: Build the Outrig monitor for Linux (for Docker testing)
cmds:
- mkdir -p bin/
- GOOS=linux GOARCH=$(go env GOARCH) go build -ldflags "-X main.OutrigBuildTime=$(date +%Y%m%d%H%M%S) -X main.OutrigCommit=$(git rev-parse --short HEAD)" -o bin/outrig-linux server/main-server.go
build:
desc: Build everything for production
cmds:
- task: build:server
build:macos-app:
desc: Build the complete macOS app bundle
cmds:
- task: build:server
- task: build:outrigapp
- task: build:app-bundle
- echo "✅ macOS app bundle built successfully at dist/Outrig.app"
prod:
desc: Run the production monitor
deps:
- build
cmds:
- OUTRIG_NOTELEMETRY=1 ./bin/outrig monitor foreground
generate:
desc: Generate RPC code (Go/TypeScript)
cmds:
- go run server/cmd/generatego/main-generatego.go
- go run server/cmd/generatets/main-generatets.go
check:ts:
desc: Check TypeScript for compile errors
cmds:
- npx tsc --project tsconfig.app.json --noEmit
test:run:
desc: run main-test.go to generate some fake data
cmds:
- OUTRIG_DEVCONFIG=1 go run server/cmd/test/main-test.go
test:docker:small:
desc: internal task used for the test docker container
cmds:
- OUTRIG_DEVCONFIG=1 outrig run server/cmd/testsmall/main-testsmall.go
test:small:
desc: run main-testsmall.go to generate minimal test data
cmds:
- OUTRIG_DEVCONFIG=1 go run server/cmd/testsmall/main-testsmall.go
test:transformgr:
desc: run main-transformgr.go to test goroutine transformation
cmds:
- OUTRIG_DEVCONFIG=1 go run server/main-server.go -v run server/cmd/transformgr/main-transformgr.go
test:docker:
desc: Build and run 'test:small' in a Docker container
deps: [build:linuxserver]
cmds:
- docker build -t outrig-test -f testfiles/docker/Dockerfile .
- docker run --rm outrig-test
test:noop:
desc: build main-testsmall.go with +no_outrig
cmds:
- go run -tags no_outrig server/cmd/testsmall/main-testsmall.go
release:check:
desc: Check if the GoReleaser configuration is valid
cmds:
- goreleaser check
release:local:
desc: Build a local release for testing (no publishing)
cmds:
- goreleaser release --snapshot --clean
release:
desc: Create and publish a new release
cmds:
- goreleaser release --clean
install:
desc: Build and install outrig to ~/.local/bin
deps:
- build
cmds:
- mkdir -p ~/.local/bin
- cp bin/outrig ~/.local/bin/
- chmod 755 ~/.local/bin/outrig
- echo "Outrig installed to ~/.local/bin/outrig"
updateversions:
desc: Set the Outrig version in both server and SDK
vars:
VERSION: "{{.CLI_ARGS}}"
cmds:
# Check if version starts with v0.
- |
if [[ ! "{{.VERSION}}" =~ ^v0\. ]]; then
echo "❌ Error: Version must start with 'v0.' but got '{{.VERSION}}'"
exit 1
fi
- echo "Setting Outrig version to {{.VERSION}}"
- sed -i.bak 's/var OutrigServerVersion = ".*"/var OutrigServerVersion = "{{.VERSION}}"/' server/pkg/serverbase/serverbase.go && rm server/pkg/serverbase/serverbase.go.bak
- sed -i.bak 's/const OutrigSDKVersion = ".*"/const OutrigSDKVersion = "{{.VERSION}}"/' pkg/config/config.go && rm pkg/config/config.go.bak
- sed -i.bak 's/OutrigAppVersion = ".*"/OutrigAppVersion = "{{.VERSION}}"/' macosapp/main-outrigapp.go && rm macosapp/main-outrigapp.go.bak
# Update version in package.json and Info.plist (strip the 'v' prefix if present)
- |
VERSION_NO_V=$(echo "{{.VERSION}}" | sed 's/^v//')
sed -i.bak 's/"version": ".*"/"version": "'$VERSION_NO_V'"/' package.json && rm package.json.bak
sed 's/VERSION_PLACEHOLDER/'$VERSION_NO_V'/g' macosapp/assets/Info.plist.template > macosapp/assets/Info.plist
- echo "✅ Version updated to {{.VERSION}} in server, SDK, package.json, and Info.plist"
build:outrigapp:
desc: Build the macOS systray app
cmds:
- mkdir -p bin/
- cd macosapp && CGO_ENABLED=1 go build -o ../bin/outrigapp main-outrigapp.go
build:app-bundle:
desc: Create a macOS .app bundle with autoupdater
deps: [build:server, build:outrigapp]
cmds:
- mkdir -p dist/Outrig.app/Contents/{MacOS,Resources}
- cp bin/outrigapp dist/Outrig.app/Contents/MacOS/
- cp bin/outrig dist/Outrig.app/Contents/MacOS/
- chmod +x dist/Outrig.app/Contents/MacOS/outrigapp
- chmod +x dist/Outrig.app/Contents/MacOS/outrig
- cp macosapp/assets/Info.plist dist/Outrig.app/Contents/
- cp macosapp/assets/outrig.icns dist/Outrig.app/Contents/Resources/AppIcon.icns
- task: build:autoupdater
- echo "✅ Created app bundle at dist/Outrig.app"
build:autoupdater:
desc: Build the Swift-based autoupdater for macOS and install to app bundle
cmds:
- cd macosapp/autoupdater && swift build -c release
- |
BINARY_PATH=$(cd macosapp/autoupdater && swift build -c release --show-bin-path)/OutrigUpdater
SPARKLE_PATH=$(cd macosapp/autoupdater && swift build -c release --show-bin-path)/Sparkle.framework
if [ -d "dist/Outrig.app/Contents/MacOS" ]; then
# Copy the updater binary
cp "$BINARY_PATH" dist/Outrig.app/Contents/MacOS/OutrigUpdater
chmod +x dist/Outrig.app/Contents/MacOS/OutrigUpdater
# Create Frameworks directory and copy Sparkle.framework
mkdir -p dist/Outrig.app/Contents/Frameworks
cp -R "$SPARKLE_PATH" dist/Outrig.app/Contents/Frameworks/
# Fix the rpath in the OutrigUpdater binary to point to the Frameworks directory
install_name_tool -add_rpath "@executable_path/../Frameworks" dist/Outrig.app/Contents/MacOS/OutrigUpdater
echo "✅ Built and installed autoupdater to dist/Outrig.app/Contents/MacOS/OutrigUpdater"
echo "✅ Copied Sparkle.framework to dist/Outrig.app/Contents/Frameworks/"
echo "✅ Fixed rpath for OutrigUpdater to find Sparkle.framework"
else
echo "✅ Built autoupdater at: $BINARY_PATH"
echo "✅ Built Sparkle.framework at: $SPARKLE_PATH"
echo "Note: App bundle not found. Run 'task build:app-bundle' to create a complete app bundle."
fi
create:icns:
desc: Create an .icns file from the PNG icon
cmds:
- cd macosapp && rm -rf outrig.iconset && mkdir -p outrig.iconset
- cd macosapp && sips -z 16 16 assets/outrigapp-iconbase.png --out outrig.iconset/icon_16x16.png
- cd macosapp && sips -z 32 32 assets/outrigapp-iconbase.png --out outrig.iconset/icon_16x16@2x.png
- cd macosapp && sips -z 32 32 assets/outrigapp-iconbase.png --out outrig.iconset/icon_32x32.png
- cd macosapp && sips -z 64 64 assets/outrigapp-iconbase.png --out outrig.iconset/icon_32x32@2x.png
- cd macosapp && sips -z 128 128 assets/outrigapp-iconbase.png --out outrig.iconset/icon_128x128.png
- cd macosapp && sips -z 256 256 assets/outrigapp-iconbase.png --out outrig.iconset/icon_128x128@2x.png
- cd macosapp && sips -z 256 256 assets/outrigapp-iconbase.png --out outrig.iconset/icon_256x256.png
- cd macosapp && sips -z 512 512 assets/outrigapp-iconbase.png --out outrig.iconset/icon_256x256@2x.png
- cd macosapp && sips -z 512 512 assets/outrigapp-iconbase.png --out outrig.iconset/icon_512x512.png
- cd macosapp && sips -z 1024 1024 assets/outrigapp-iconbase.png --out outrig.iconset/icon_512x512@2x.png
- cd macosapp && iconutil -c icns outrig.iconset -o assets/outrig.icns
- echo "✅ Created outrig.icns"
release:tag:git:
desc: Create a git tag after verifying versions match and git directory is clean
vars:
VERSION: "{{.CLI_ARGS}}"
cmds:
# Check if git directory is clean
- |
if [ -n "$(git status --porcelain)" ]; then
echo "❌ Error: Git directory is not clean. Please commit all changes before tagging."
exit 1
fi
# Check if server version matches
- |
SERVER_VERSION=$(grep 'var OutrigServerVersion = ' server/pkg/serverbase/serverbase.go | cut -d'"' -f2)
if [ "$SERVER_VERSION" != "{{.VERSION}}" ]; then
echo "❌ Error: Server version ($SERVER_VERSION) does not match requested tag version ({{.VERSION}})"
echo "Run 'task updateversions {{.VERSION}}' first to update versions"
exit 1
fi
# Check if SDK version matches
- |
SDK_VERSION=$(grep 'const OutrigSDKVersion = ' pkg/config/config.go | cut -d'"' -f2)
if [ "$SDK_VERSION" != "{{.VERSION}}" ]; then
echo "❌ Error: SDK version ($SDK_VERSION) does not match requested tag version ({{.VERSION}})"
echo "Run 'task updateversions {{.VERSION}}' first to update versions"
exit 1
fi
# Check if macOS app version matches
- |
APP_VERSION=$(grep 'OutrigAppVersion = ' macosapp/main-outrigapp.go | cut -d'"' -f2)
if [ "$APP_VERSION" != "{{.VERSION}}" ]; then
echo "❌ Error: macOS app version ($APP_VERSION) does not match requested tag version ({{.VERSION}})"
echo "Run 'task updateversions {{.VERSION}}' first to update versions"
exit 1
fi
# Check if package.json version matches (without 'v' prefix)
- |
VERSION_NO_V=$(echo "{{.VERSION}}" | sed 's/^v//')
PKG_VERSION=$(grep '"version": "' package.json | cut -d'"' -f4)
if [ "$PKG_VERSION" != "$VERSION_NO_V" ]; then
echo "❌ Error: package.json version ($PKG_VERSION) does not match requested tag version ($VERSION_NO_V)"
echo "Run 'task updateversions {{.VERSION}}' first to update versions"
exit 1
fi
# Create the git tag
- git tag -a {{.VERSION}} -m "Release {{.VERSION}}"
- echo "✅ Created git tag {{.VERSION}}"
- echo "To push the tag, run\n git push origin {{.VERSION}}"
release:tag:
desc: Set version in files and create a git tag in one step
vars:
VERSION: "{{.CLI_ARGS}}"
cmds:
# Check if git directory is clean before making any changes
- |
if [ -n "$(git status --porcelain)" ]; then
echo "❌ Error: Git directory is not clean. Please commit all changes before releasing."
exit 1
fi
# Update versions in files
- task: updateversions
vars: { VERSION: "{{.VERSION}}" }
# Only commit if there are changes
- |
if [ -n "$(git status --porcelain)" ]; then
git add server/pkg/serverbase/serverbase.go pkg/config/config.go package.json macosapp/main-outrigapp.go macosapp/assets/Info.plist
git commit -m "Bump version to {{.VERSION}}"
echo "✅ Committed version changes"
else
echo "ℹ️ No changes to commit, versions already up to date"
fi
# Create the git tag
- task: release:tag:git
vars: { VERSION: "{{.VERSION}}" }
- echo "✅ Version {{.VERSION}} released successfully"
generate:appcast:
desc: Generate appcast.xml file for a specific version
vars:
VERSION: "{{.CLI_ARGS}}"
cmds:
- |
if [ -z "{{.VERSION}}" ]; then
echo "❌ Error: Version is required"
echo "Usage: task generate:appcast -- v0.6.0"
exit 1
fi
- |
if [ -z "$SPARKLE_PRIVATE_KEY" ]; then
echo "❌ Error: SPARKLE_PRIVATE_KEY environment variable not set"
echo "Set it with: export SPARKLE_PRIVATE_KEY=your_base64_key"
exit 1
fi
- mkdir -p dist
- cd server/cmd/generateappcast && go run main-generateappcast.go {{.VERSION}}
- echo "✅ Generated appcast.xml for version {{.VERSION}}"
generate:cask:
desc: Generate Homebrew cask file for a specific version
vars:
VERSION: "{{.CLI_ARGS}}"
cmds:
- |
if [ -z "{{.VERSION}}" ]; then
echo "❌ Error: Version is required"
echo "Usage: task generate:cask -- v0.6.0"
exit 1
fi
- mkdir -p dist
- cd server/cmd/generatecask && go run main-generatecask.go {{.VERSION}}
- echo "✅ Generated Homebrew cask for version {{.VERSION}}"
generate:nix:
desc: Generate Nix package file for a specific version
vars:
VERSION: "{{.CLI_ARGS}}"
cmds:
- |
if [ -z "{{.VERSION}}" ]; then
echo "❌ Error: Version is required"
echo "Usage: task generate:nix -- v0.6.0"
exit 1
fi
- mkdir -p dist
- cd server/cmd/generatenix && go run main-generatenix.go {{.VERSION}}
- echo "✅ Generated Nix package for version {{.VERSION}}"