2024-06-13 16:49:25 -07:00
# Copyright 2024, Command Line Inc.
# SPDX-License-Identifier: Apache-2.0
2024-05-09 20:24:24 -07:00
version : "3"
vars :
2024-09-19 14:04:47 -07:00
APP_NAME : "Wave"
2024-05-09 20:24:24 -07:00
BIN_DIR : "bin"
2024-06-13 18:11:21 -07:00
VERSION :
sh : node version.cjs
2024-08-15 21:32:08 -07:00
RM : '{{if eq OS "windows"}}cmd --% /c del /S{{else}}rm {{end}}'
2024-08-12 23:37:08 -07:00
RMRF : '{{if eq OS "windows"}}powershell Remove-Item -Force -Recurse{{else}}rm -rf{{end}}'
2024-08-30 10:13:40 -07:00
DATE : '{{if eq OS "windows"}}powershell Get-Date -UFormat{{else}}date{{end}}'
2024-09-18 12:29:47 -07:00
ARTIFACTS_BUCKET : waveterm-github-artifacts/staging-w2
RELEASES_BUCKET : dl.waveterm.dev/releases-w2
2024-06-11 17:42:10 -07:00
2024-05-09 20:24:24 -07:00
tasks :
2024-07-17 18:42:49 -07:00
electron:dev :
2024-07-19 14:27:31 -07:00
desc : Run the Electron application via the Vite dev server (enables hot reloading).
2024-09-20 13:39:06 -07:00
cmd : yarn dev
2024-07-17 18:42:49 -07:00
deps :
2024-08-26 13:17:35 -07:00
- yarn
2024-08-20 16:48:38 -07:00
- build:backend
2024-08-08 18:24:54 -07:00
env :
WCLOUD_ENDPOINT : "https://ot2e112zx5.execute-api.us-west-2.amazonaws.com/dev"
WCLOUD_WS_ENDPOINT : "wss://5lfzlg5crl.execute-api.us-west-2.amazonaws.com/dev/"
2024-07-17 18:42:49 -07:00
electron:start :
2024-07-19 14:27:31 -07:00
desc : Run the Electron application directly.
2024-09-20 13:39:06 -07:00
cmd : yarn start
2024-07-17 18:42:49 -07:00
deps :
2024-08-26 13:17:35 -07:00
- yarn
2024-08-20 16:48:38 -07:00
- build:backend
2024-07-17 18:42:49 -07:00
2024-09-20 13:39:06 -07:00
storybook :
desc : Start the Storybook server.
cmd : yarn storybook
2024-07-17 22:39:22 -07:00
package :
desc : Package the application for the current platform.
cmds :
2024-08-12 23:37:08 -07:00
- cmd : '{{.RMRF}} "make"'
2024-07-18 15:16:49 -07:00
ignore_error : true
2024-07-17 22:39:22 -07:00
- yarn build:prod && yarn electron-builder -c electron-builder.config.cjs -p never
deps :
2024-08-26 13:17:35 -07:00
- yarn
2024-08-20 16:48:38 -07:00
- build:backend
build:backend :
desc : Build the wavesrv and wsh components.
cmds :
- task : build:server
- task : build:wsh
2024-07-17 22:39:22 -07:00
2024-06-11 17:42:10 -07:00
build:server :
2024-07-17 22:39:22 -07:00
desc : Build the wavesrv component.
2024-07-17 18:42:49 -07:00
deps :
2024-08-20 16:48:38 -07:00
- generate
2024-08-30 10:13:40 -07:00
- build:server:linux
- build:server:macos
- build:server:windows
2024-07-17 22:39:22 -07:00
2024-08-30 10:13:40 -07:00
build:server:macos :
desc : Build the wavesrv component for macOS (Darwin) platforms (generates artifacts for both arm64 and amd64).
2024-07-17 22:39:22 -07:00
status :
2024-07-18 15:53:20 -07:00
- exit {{if eq OS "darwin"}}1{{else}}0{{end}}
2024-07-17 22:39:22 -07:00
cmds :
2024-08-15 21:32:08 -07:00
- cmd : "{{.RM}} dist/bin/wavesrv*"
2024-07-18 15:16:49 -07:00
ignore_error : true
2024-07-17 18:42:49 -07:00
- task : build:server:internal
vars :
2024-08-30 10:13:40 -07:00
ARCHS : arm64,amd64
2024-07-17 22:39:22 -07:00
2024-08-30 10:13:40 -07:00
build:server:windows :
desc : Build the wavesrv component for Windows platforms (only generates artifacts for the current architecture).
2024-07-17 22:39:22 -07:00
status :
2024-08-30 10:13:40 -07:00
- exit {{if eq OS "windows"}}1{{else}}0{{end}}
2024-07-17 22:39:22 -07:00
cmds :
2024-08-15 21:32:08 -07:00
- cmd : "{{.RM}} dist/bin/wavesrv*"
2024-07-18 15:16:49 -07:00
ignore_error : true
2024-07-17 22:39:22 -07:00
- task : build:server:internal
vars :
2024-08-30 10:13:40 -07:00
ARCHS :
sh : echo {{if eq "arm" ARCH}}arm64{{else}}{{ARCH}}{{end}}
build:server:linux :
desc : Build the wavesrv component for Linux platforms (only generates artifacts for the current architecture).
status :
- exit {{if eq OS "linux"}}1{{else}}0{{end}}
cmds :
- cmd : "{{.RM}} dist/bin/wavesrv*"
ignore_error : true
- task : build:server:internal
vars :
ARCHS :
2024-07-18 15:53:20 -07:00
sh : echo {{if eq "arm" ARCH}}arm64{{else}}{{ARCH}}{{end}}
2024-07-17 18:42:49 -07:00
build:server:internal :
requires :
vars :
2024-08-30 10:13:40 -07:00
- ARCHS
2024-09-20 13:39:06 -07:00
cmd :
2024-09-24 10:57:17 -07:00
cmd : CGO_ENABLED=1 GOARCH={{.GOARCH}} go build -tags "osusergo,sqlite_omit_load_extension" -ldflags "{{.GO_LDFLAGS}} -X main.BuildTime=$({{.DATE}} +'%Y%m%d%H%M') -X main.WaveVersion={{.VERSION}}" -o dist/bin/wavesrv.{{if eq .GOARCH "amd64"}}x64{{else}}{{.GOARCH}}{{end}}{{exeExt}} cmd/server/main-server.go
2024-09-20 13:39:06 -07:00
for :
var : ARCHS
split : ","
as : GOARCH
2024-05-09 20:24:24 -07:00
sources :
2024-06-11 17:42:10 -07:00
- "cmd/server/*.go"
- "pkg/**/*.go"
2024-05-09 20:24:24 -07:00
generates :
2024-08-30 10:13:40 -07:00
- dist/bin/wavesrv.*{{exeExt}}
2024-05-09 20:24:24 -07:00
deps :
2024-06-11 17:42:10 -07:00
- go:mod:tidy
2024-07-17 18:42:49 -07:00
internal : true
2024-05-09 20:24:24 -07:00
2024-06-21 14:44:11 -07:00
build:wsh :
2024-07-17 22:39:22 -07:00
desc : Build the wsh component for all possible targets.
2024-07-18 15:16:49 -07:00
cmds :
2024-08-15 21:32:08 -07:00
- cmd : "{{.RM}} dist/bin/wsh*"
2024-07-18 15:16:49 -07:00
ignore_error : true
2024-07-17 18:42:49 -07:00
- task : build:wsh:internal
vars :
2024-07-18 15:53:20 -07:00
GOOS : darwin
GOARCH : arm64
2024-07-17 18:42:49 -07:00
- task : build:wsh:internal
vars :
2024-07-18 15:53:20 -07:00
GOOS : darwin
GOARCH : amd64
2024-07-17 18:42:49 -07:00
- task : build:wsh:internal
vars :
2024-07-18 15:53:20 -07:00
GOOS : linux
GOARCH : arm64
2024-07-17 18:42:49 -07:00
- task : build:wsh:internal
vars :
2024-07-18 15:53:20 -07:00
GOOS : linux
GOARCH : amd64
2024-07-17 18:42:49 -07:00
- task : build:wsh:internal
vars :
2024-07-18 15:53:20 -07:00
GOOS : windows
GOARCH : amd64
2024-07-17 18:42:49 -07:00
- task : build:wsh:internal
vars :
2024-07-18 15:53:20 -07:00
GOOS : windows
GOARCH : arm64
2024-08-20 16:48:38 -07:00
deps :
- generate
2024-07-17 18:42:49 -07:00
2024-08-12 10:58:39 -07:00
dev:installwsh :
desc : quick shortcut to rebuild wsh and install for macos arm64
requires :
vars :
- VERSION
cmds :
- task : build:wsh:internal
vars :
GOOS : darwin
GOARCH : arm64
2024-09-05 15:01:28 -07:00
- cp dist/bin/wsh-{{.VERSION}}-darwin.arm64 ~/.waveterm-dev/bin/wsh
2024-08-12 10:58:39 -07:00
2024-07-17 18:42:49 -07:00
build:wsh:internal :
vars :
2024-07-18 15:53:20 -07:00
EXT :
2024-07-17 18:42:49 -07:00
sh : echo {{if eq .GOOS "windows"}}.exe{{end}}
2024-09-04 11:23:39 -07:00
NORMALIZEDARCH :
sh : echo {{if eq .GOARCH "amd64"}}x64{{else}}{{.GOARCH}}{{end}}
2024-07-17 18:42:49 -07:00
requires :
vars :
- GOOS
- GOARCH
- VERSION
2024-06-21 14:44:11 -07:00
sources :
- "cmd/wsh/**/*.go"
- "pkg/**/*.go"
generates :
2024-09-04 11:23:39 -07:00
- dist/bin/wsh-{{.VERSION}}-{{.GOOS}}.{{.NORMALIZEDARCH}}{{.EXT}}
2024-09-20 13:39:06 -07:00
cmd : (CGO_ENABLED=0 GOOS={{.GOOS}} GOARCH={{.GOARCH}} go build -ldflags="-s -w -X main.BuildTime=$({{.DATE}} +'%Y%m%d%H%M') -X main.WaveVersion={{.VERSION}}" -o dist/bin/wsh-{{.VERSION}}-{{.GOOS}}.{{.NORMALIZEDARCH}}{{.EXT}} cmd/wsh/main-wsh.go)
2024-06-21 14:44:11 -07:00
deps :
- go:mod:tidy
2024-07-17 18:42:49 -07:00
internal : true
2024-06-21 14:44:11 -07:00
2024-07-19 16:11:08 -07:00
generate :
desc : Generate Typescript bindings for the Go backend.
cmds :
2024-08-27 18:49:49 -07:00
- go run cmd/generatets/main-generatets.go
- go run cmd/generatego/main-generatego.go
2024-07-19 16:11:08 -07:00
sources :
2024-08-27 18:49:49 -07:00
- "cmd/generatego/*.go"
- "cmd/generatets/*.go"
2024-07-19 16:11:08 -07:00
- "pkg/service/**/*.go"
2024-08-30 11:33:04 -07:00
- "pkg/waveobj/*.go"
2024-07-29 22:35:21 -07:00
- "pkg/wconfig/**/*.go"
2024-07-19 16:11:08 -07:00
- "pkg/wstore/*.go"
- "pkg/wshrpc/**/*.go"
- "pkg/tsgen/**/*.go"
2024-08-27 18:49:49 -07:00
- "pkg/gogen/**/*.go"
- "pkg/wconfig/**/*.go"
2024-07-31 21:27:46 -07:00
- "pkg/eventbus/eventbus.go"
2024-07-19 16:11:08 -07:00
generates :
- frontend/types/gotypes.d.ts
- pkg/wshrpc/wshclient/wshclient.go
- frontend/app/store/services.ts
- frontend/app/store/wshserver.ts
2024-09-17 13:10:35 -07:00
version :
2024-09-18 13:12:34 -07:00
desc : Get the current package version, or bump version if args are present. To pass args to `version.cjs`, add them after `--`. See `version.cjs` for usage definitions for the arguments.
2024-09-17 13:10:35 -07:00
cmd : node version.cjs {{.CLI_ARGS}}
2024-09-18 12:29:47 -07:00
artifacts:upload :
desc : Uploads build artifacts to the staging bucket in S3. To add additional AWS CLI arguments, add them after `--`.
vars :
ORIGIN : "make/"
DESTINATION : "{{.ARTIFACTS_BUCKET}}/{{.VERSION}}"
cmd : aws s3 cp {{.ORIGIN}}/ s3://{{.DESTINATION}}/ --recursive --exclude "*/*" --exclude "builder-*.yml" {{.CLI_ARGS}}
artifacts:download:* :
desc : Downloads the specified artifacts version from the staging bucket. To add additional AWS CLI arguments, add them after `--`.
vars :
DL_VERSION : '{{ replace "v" "" (index .MATCH 0)}}'
ORIGIN : "{{.ARTIFACTS_BUCKET}}/{{.DL_VERSION}}"
DESTINATION : "artifacts/{{.DL_VERSION}}"
cmds :
- '{{.RMRF}} "{{.DESTINATION}}"'
- aws s3 cp s3://{{.ORIGIN}}/ {{.DESTINATION}}/ --recursive {{.CLI_ARGS}}
artifacts:publish:* :
desc : Publishes the specified artifacts version from the staging bucket to the releases bucket. To add additional AWS CLI arguments, add them after `--`.
vars :
UP_VERSION : '{{ replace "v" "" (index .MATCH 0)}}'
ORIGIN : "{{.ARTIFACTS_BUCKET}}/{{.UP_VERSION}}"
DESTINATION : "{{.RELEASES_BUCKET}}"
cmd : |
OUTPUT=$(aws s3 cp s3://{{.ORIGIN}}/ s3://{{.DESTINATION}}/ --recursive {{.CLI_ARGS}})
for line in $OUTPUT; do
PREFIX=${line%%{{.DESTINATION}}*}
SUFFIX=${line:${#PREFIX}}
if [[ -n "$SUFFIX" ]]; then
echo "https://$SUFFIX"
fi
done
2024-08-26 13:17:35 -07:00
yarn :
desc : Runs `yarn`
internal : true
generates :
- node_modules/**/*
- yarn.lock
- .yarn/*
sources :
- yarn.lock
- package.json
2024-08-26 13:35:10 -07:00
- .yarnrc.yml
2024-09-20 13:39:06 -07:00
cmd : yarn
2024-08-26 13:17:35 -07:00
2024-05-09 20:24:24 -07:00
go:mod:tidy :
2024-07-17 22:39:22 -07:00
desc : Runs `go mod tidy`
2024-05-09 20:24:24 -07:00
internal : true
generates :
- go.sum
sources :
- go.mod
2024-09-20 13:39:06 -07:00
cmd : go mod tidy