refactor: update Taskfile to change output paths for WASM build and add example tasks for various functionalities
Some checks failed
Bearer / scan (push) Successful in 28s
Go Build Multi-Platform / build (amd64, freebsd) (push) Successful in 28s
Go Build Multi-Platform / build (arm, linux) (push) Successful in 31s
Go Build Multi-Platform / build (amd64, windows) (push) Successful in 33s
Go Build Multi-Platform / build (arm64, linux) (push) Successful in 47s
Go Build Multi-Platform / build (arm64, windows) (push) Successful in 45s
Go Test Multi-Platform / Test (ubuntu-latest, arm64) (push) Successful in 48s
Go Revive Lint / lint (push) Successful in 53s
Go Test Multi-Platform / Test (ubuntu-latest, amd64) (push) Successful in 1m38s
Run Gosec / tests (push) Failing after 1m6s
Go Build Multi-Platform / build (amd64, darwin) (push) Successful in 9m23s
Go Build Multi-Platform / build (arm, freebsd) (push) Successful in 9m23s
Go Build Multi-Platform / build (amd64, linux) (push) Successful in 9m25s
Go Build Multi-Platform / build (arm64, darwin) (push) Successful in 9m23s
Go Build Multi-Platform / build (arm, windows) (push) Successful in 9m25s
Go Build Multi-Platform / build (arm64, freebsd) (push) Successful in 9m25s
Go Build Multi-Platform / Create Release (push) Has been skipped

This commit is contained in:
2025-12-30 11:14:37 -06:00
parent ac0407c954
commit 53d418d753

View File

@@ -186,19 +186,19 @@ tasks:
env:
CGO_ENABLED: '0'
cmds:
- mkdir -p examples/wasm/static
- 'cd examples/wasm && GOOS=js GOARCH=wasm {{.GOCMD}} build -o static/reticulum-go.wasm .'
- mkdir -p examples/wasm/public/static
- 'cd examples/wasm && GOOS=js GOARCH=wasm {{.GOCMD}} build -o public/static/reticulum-go.wasm .'
- |
GOROOT=$({{.GOCMD}} env GOROOT)
if [ -f "$GOROOT/lib/wasm/wasm_exec.js" ]; then
cp "$GOROOT/lib/wasm/wasm_exec.js" examples/wasm/
cp "$GOROOT/lib/wasm/wasm_exec.js" examples/wasm/public/js/
echo "wasm_exec.js copied successfully from $GOROOT/lib/wasm/"
elif [ -f "$GOROOT/misc/wasm/wasm_exec.js" ]; then
cp "$GOROOT/misc/wasm/wasm_exec.js" examples/wasm/
cp "$GOROOT/misc/wasm/wasm_exec.js" examples/wasm/public/js/
echo "wasm_exec.js copied successfully from $GOROOT/misc/wasm/"
else
echo "Warning: wasm_exec.js not found at $GOROOT/lib/wasm/wasm_exec.js or $GOROOT/misc/wasm/wasm_exec.js"
echo "Please copy it manually to examples/wasm/"
echo "Warning: wasm_exec.js not found"
exit 1
fi
install:
@@ -217,4 +217,73 @@ tasks:
else
echo "Error: Binary not found at $BINARY_PATH"
exit 1
fi
fi
example:announce:
desc: Run announce example
cmds:
- 'cd examples/announce && {{.GOCMD}} run .'
example:minimal:
desc: Run minimal example
cmds:
- 'cd examples/minimal && {{.GOCMD}} run .'
example:pageserver:
desc: Run pageserver example
cmds:
- 'cd examples/pageserver && {{.GOCMD}} run .'
example:echo-listen:
desc: Run echo example (waits for incoming connections, P2P peer)
cmds:
- 'cd examples/echo && {{.GOCMD}} run . --server'
example:echo-connect:
desc: Run echo example (initiates connection to peer, requires DESTINATION env var)
cmds:
- |
if [ -z "${DESTINATION}" ]; then
echo "Error: DESTINATION environment variable required (hexadecimal hash of peer)"
echo "Example: DESTINATION=abc123... task example:echo-connect"
exit 1
fi
cd examples/echo && {{.GOCMD}} run . --destination="${DESTINATION}"
example:link-listen:
desc: Run link example (waits for incoming link requests, P2P peer)
cmds:
- 'cd examples/link && {{.GOCMD}} run . --server'
example:link-connect:
desc: Run link example (initiates link to peer, requires DESTINATION env var)
cmds:
- |
if [ -z "${DESTINATION}" ]; then
echo "Error: DESTINATION environment variable required (hexadecimal hash of peer)"
echo "Example: DESTINATION=abc123... task example:link-connect"
exit 1
fi
cd examples/link && {{.GOCMD}} run . --destination="${DESTINATION}"
example:filetransfer-share:
desc: Run filetransfer example (shares files from directory, P2P peer)
cmds:
- |
if [ -z "${SERVE_PATH}" ]; then
echo "Error: SERVE_PATH environment variable required (directory to share)"
echo "Example: SERVE_PATH=/path/to/files task example:filetransfer-share"
exit 1
fi
cd examples/filetransfer && {{.GOCMD}} run . --server --serve="${SERVE_PATH}"
example:filetransfer-fetch:
desc: Run filetransfer example (fetches files from peer, requires DESTINATION env var)
cmds:
- |
if [ -z "${DESTINATION}" ]; then
echo "Error: DESTINATION environment variable required (hexadecimal hash of peer)"
echo "Example: DESTINATION=abc123... task example:filetransfer-fetch"
exit 1
fi
cd examples/filetransfer && {{.GOCMD}} run . --destination="${DESTINATION}"