feat: expand Taskfile with new build tasks for Windows, MacOS, FreeBSD, OpenBSD, and NetBSD, and enhance WebAssembly example with run and test commands
This commit is contained in:
77
Taskfile.yml
77
Taskfile.yml
@@ -150,9 +150,63 @@ tasks:
|
||||
- 'GOOS=linux GOARCH=arm {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-linux-arm {{.MAIN_PACKAGE}}'
|
||||
- 'GOOS=linux GOARCH=riscv64 {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-linux-riscv64 {{.MAIN_PACKAGE}}'
|
||||
|
||||
build-windows:
|
||||
desc: Build for Windows (amd64, arm64)
|
||||
env:
|
||||
CGO_ENABLED: '0'
|
||||
cmds:
|
||||
- mkdir -p {{.BUILD_DIR}}
|
||||
- 'GOOS=windows GOARCH=amd64 {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-windows-amd64.exe {{.MAIN_PACKAGE}}'
|
||||
- 'GOOS=windows GOARCH=arm64 {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-windows-arm64.exe {{.MAIN_PACKAGE}}'
|
||||
|
||||
build-darwin:
|
||||
desc: Build for MacOS (amd64, arm64)
|
||||
env:
|
||||
CGO_ENABLED: '0'
|
||||
cmds:
|
||||
- mkdir -p {{.BUILD_DIR}}
|
||||
- 'GOOS=darwin GOARCH=amd64 {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-darwin-amd64 {{.MAIN_PACKAGE}}'
|
||||
- 'GOOS=darwin GOARCH=arm64 {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-darwin-arm64 {{.MAIN_PACKAGE}}'
|
||||
|
||||
build-freebsd:
|
||||
desc: Build for FreeBSD (amd64, 386, arm64, arm, riscv64)
|
||||
env:
|
||||
CGO_ENABLED: '0'
|
||||
cmds:
|
||||
- mkdir -p {{.BUILD_DIR}}
|
||||
- 'GOOS=freebsd GOARCH=amd64 {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-freebsd-amd64 {{.MAIN_PACKAGE}}'
|
||||
- 'GOOS=freebsd GOARCH=386 {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-freebsd-386 {{.MAIN_PACKAGE}}'
|
||||
- 'GOOS=freebsd GOARCH=arm64 {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-freebsd-arm64 {{.MAIN_PACKAGE}}'
|
||||
- 'GOOS=freebsd GOARCH=arm {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-freebsd-arm {{.MAIN_PACKAGE}}'
|
||||
- 'GOOS=freebsd GOARCH=riscv64 {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-freebsd-riscv64 {{.MAIN_PACKAGE}}'
|
||||
|
||||
build-openbsd:
|
||||
desc: Build for OpenBSD (amd64, 386, arm64, arm, ppc64, riscv64)
|
||||
env:
|
||||
CGO_ENABLED: '0'
|
||||
cmds:
|
||||
- mkdir -p {{.BUILD_DIR}}
|
||||
- 'GOOS=openbsd GOARCH=amd64 {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-openbsd-amd64 {{.MAIN_PACKAGE}}'
|
||||
- 'GOOS=openbsd GOARCH=386 {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-openbsd-386 {{.MAIN_PACKAGE}}'
|
||||
- 'GOOS=openbsd GOARCH=arm64 {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-openbsd-arm64 {{.MAIN_PACKAGE}}'
|
||||
- 'GOOS=openbsd GOARCH=arm {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-openbsd-arm {{.MAIN_PACKAGE}}'
|
||||
- 'GOOS=openbsd GOARCH=ppc64 {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-openbsd-ppc64 {{.MAIN_PACKAGE}}'
|
||||
- 'GOOS=openbsd GOARCH=riscv64 {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-openbsd-riscv64 {{.MAIN_PACKAGE}}'
|
||||
|
||||
build-netbsd:
|
||||
desc: Build for NetBSD (amd64, 386, arm64, arm)
|
||||
env:
|
||||
CGO_ENABLED: '0'
|
||||
cmds:
|
||||
- mkdir -p {{.BUILD_DIR}}
|
||||
- 'GOOS=netbsd GOARCH=amd64 {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-netbsd-amd64 {{.MAIN_PACKAGE}}'
|
||||
- 'GOOS=netbsd GOARCH=386 {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-netbsd-386 {{.MAIN_PACKAGE}}'
|
||||
- 'GOOS=netbsd GOARCH=arm64 {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-netbsd-arm64 {{.MAIN_PACKAGE}}'
|
||||
- 'GOOS=netbsd GOARCH=arm {{.GOCMD}} build -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-netbsd-arm {{.MAIN_PACKAGE}}'
|
||||
|
||||
build-all:
|
||||
desc: Build for all Linux architectures
|
||||
deps: [build-linux]
|
||||
desc: Build for all platforms and architectures
|
||||
deps: [build-linux, build-windows, build-darwin, build-freebsd, build-openbsd, build-netbsd]
|
||||
|
||||
run:
|
||||
desc: Run with go run
|
||||
@@ -180,7 +234,7 @@ tasks:
|
||||
GOOS: js
|
||||
GOARCH: wasm
|
||||
cmds:
|
||||
- PATH="$PATH:{{.WASM_BIN_PATH}}/misc/wasm" {{.GOCMD}} test -v ./pkg/wasm/ ./cmd/reticulum-wasm/
|
||||
- PATH="$PATH:{{.WASM_BIN_PATH}}/misc/wasm" {{.GOCMD}} test -v ./pkg/wasm/ ./cmd/reticulum-wasm/ ./examples/wasm/
|
||||
|
||||
build-wasm:
|
||||
desc: Build WebAssembly binary with standard Go compiler
|
||||
@@ -192,12 +246,12 @@ tasks:
|
||||
- mkdir -p {{.BUILD_DIR}}
|
||||
- '{{.GOCMD}} build -ldflags="-s -w" -o {{.BUILD_DIR}}/{{.BINARY_NAME}}.wasm ./cmd/reticulum-wasm'
|
||||
|
||||
build-wasm-example:
|
||||
example:wasm:build:
|
||||
desc: Build WebAssembly example
|
||||
env:
|
||||
CGO_ENABLED: '0'
|
||||
cmds:
|
||||
- mkdir -p examples/wasm/public/static
|
||||
- mkdir -p examples/wasm/public/static examples/wasm/public/js
|
||||
- 'cd examples/wasm && GOOS=js GOARCH=wasm {{.GOCMD}} build -o public/static/reticulum-go.wasm .'
|
||||
- |
|
||||
GOROOT=$({{.GOCMD}} env GOROOT)
|
||||
@@ -212,6 +266,19 @@ tasks:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
example:wasm:run:
|
||||
desc: Run WebAssembly example using a simple HTTP server
|
||||
deps: [example:wasm:build]
|
||||
cmds:
|
||||
- echo "Starting server at http://localhost:8080"
|
||||
- echo "Press Ctrl+C to stop"
|
||||
- 'cd examples/wasm/public && python3 -m http.server 8080'
|
||||
|
||||
example:wasm:test:
|
||||
desc: Run tests for WASM example
|
||||
cmds:
|
||||
- task: test-wasm
|
||||
|
||||
install:
|
||||
desc: Install dependencies
|
||||
cmds:
|
||||
|
||||
Reference in New Issue
Block a user