-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
108 lines (91 loc) · 2.64 KB
/
Taskfile.yml
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
# https://taskfile.dev
version: '3'
vars:
USERNAME: jonesrussell
PROJECTNAME: gimbal
VERSION: v0.1.0
BINARY_DIR: bin
BINARY_NAME: gimbal
WASM_EXEC_PATH: '{{default "$(go env GOROOT)/misc/wasm/wasm_exec.js" .WASM_EXEC_PATH}}'
ITCH_USERNAME: '{{default "jonesrussell" .ITCH_USERNAME}}'
ITCH_PATH: gimbal
tasks:
serve:
desc: Starts a local server for development
cmds:
- |
if ! command -v wasmserve >/dev/null 2>&1; then
echo "wasmserve could not be found. You can install it with: go install github.com/hajimehoshi/wasmserve@latest" >&2
exit 1
fi
- echo "Hosting game on http://localhost:4242"
- cd cmd/gimbal/ && wasmserve -http=":4242" -allow-origin='*' -tags .
build:linux:
desc: Build Linux target
cmds:
- rm -rf build/linux
- mkdir -p build/linux/{{.PROJECTNAME}}
- go build -tags build -o build/linux/{{.PROJECTNAME}}/{{.PROJECTNAME}} ./cmd/gimbal
build:win32:
desc: Build Win32 target
cmds:
- rm -rf build/win32
- mkdir -p build/win32/{{.PROJECTNAME}}
- GOOS=windows go build -tags build -o build/win32/{{.PROJECTNAME}}/{{.PROJECTNAME}}.exe ./cmd/gimbal
build:web:
desc: Build WebAssembly target
cmds:
- rm -rf build/web
- mkdir -p build/web
- GOOS=js GOARCH=wasm go build -tags "build,js" -o build/web/game.wasm ./cmd/gimbal
- cp -r html/* build/web
- cp {{.WASM_EXEC_PATH}} build/web
build:
desc: Build all targets
deps: [build:linux, build:win32, build:web]
itch:
desc: Upload to itch.io
deps: [clean:build, build]
cmds:
- butler push --if-changed build/win32 {{.ITCH_USERNAME}}/{{.ITCH_PATH}}:windows
- butler push --if-changed build/linux {{.ITCH_USERNAME}}/{{.ITCH_PATH}}:linux-amd64
- butler push build/web {{.ITCH_USERNAME}}/{{.ITCH_PATH}}:web
- echo "Project is live on http://{{.ITCH_USERNAME}}.itch.io/{{.ITCH_PATH}}"
run:
desc: Run the application
cmds:
- go run ./cmd/gimbal
clean:build:
desc: Clean build directory
cmds:
- rm -rf build
clean:
desc: Clean all artifacts
cmds:
- task: clean:build
- rm -rf game.wasm site.zip
test:
desc: Run tests
cmds:
- go test -v ./...
fmt:
desc: Format Go code
cmds:
- go fmt ./...
lint:
desc: Run linter
cmds:
- golangci-lint run
vet:
desc: Run Go vet
cmds:
- go vet ./...
mod:
desc: Tidy and download Go modules
cmds:
- go mod tidy
- go clean -modcache
- go mod download
all:
desc: Run format, lint, test, and build
deps: [fmt, lint, test, build]