-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
50 lines (42 loc) · 1.44 KB
/
Taskfile.yaml
File metadata and controls
50 lines (42 loc) · 1.44 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
version: '3'
env:
CGO_ENABLED: '0'
vars:
BINARY_NAME: wormatter
CMD_PATH: ./cmd/wormatter
VERSION_PKG: github.com/werf/wormatter/internal/cli
VERSION:
sh: git describe --tags --always --dirty 2>/dev/null || echo "dev"
LDFLAGS: -X {{.VERSION_PKG}}.version={{.VERSION}}
tasks:
default:
desc: Build and test
deps: [build, test]
build:
desc: Build the wormatter binary
cmds:
- go build -ldflags "{{.LDFLAGS}}" -o bin/{{.BINARY_NAME}} {{.CMD_PATH}}
sources:
- '**/*.go'
generates:
- bin/{{.BINARY_NAME}}
build:all:
desc: Build binaries for all platforms
cmds:
- GOOS=linux GOARCH=amd64 go build -ldflags "{{.LDFLAGS}}" -o bin/{{.BINARY_NAME}}-linux-amd64 {{.CMD_PATH}}
- GOOS=linux GOARCH=arm64 go build -ldflags "{{.LDFLAGS}}" -o bin/{{.BINARY_NAME}}-linux-arm64 {{.CMD_PATH}}
- GOOS=darwin GOARCH=amd64 go build -ldflags "{{.LDFLAGS}}" -o bin/{{.BINARY_NAME}}-darwin-amd64 {{.CMD_PATH}}
- GOOS=darwin GOARCH=arm64 go build -ldflags "{{.LDFLAGS}}" -o bin/{{.BINARY_NAME}}-darwin-arm64 {{.CMD_PATH}}
- GOOS=windows GOARCH=amd64 go build -ldflags "{{.LDFLAGS}}" -o bin/{{.BINARY_NAME}}-windows-amd64.exe {{.CMD_PATH}}
test:
desc: Run tests
cmds:
- go test -v ./...
clean:
desc: Remove build artifacts
cmds:
- rm -rf bin/
install:
desc: Install the binary to $GOPATH/bin
cmds:
- go install -ldflags "{{.LDFLAGS}}" {{.CMD_PATH}}