80 lines
1.5 KiB
YAML
80 lines
1.5 KiB
YAML
version: '3'
|
|
|
|
vars:
|
|
BINARIES:
|
|
sh: ls cmd/
|
|
|
|
env:
|
|
GOOS: linux
|
|
GOARCH: amd64
|
|
|
|
tasks:
|
|
|
|
default:
|
|
cmds:
|
|
- task: build-all
|
|
|
|
build-all:
|
|
desc: build all binaries
|
|
cmds:
|
|
- for: { var: BINARIES }
|
|
task: native-compile-{{.ITEM}}
|
|
vars:
|
|
BINARY: '{{.ITEM}}'
|
|
|
|
install-all:
|
|
desc: install all binaries
|
|
cmds:
|
|
- for: { var: BINARIES }
|
|
task: install
|
|
vars:
|
|
BINARY: '{{.ITEM}}'
|
|
|
|
build-*:
|
|
desc: build a binary
|
|
cmd: |
|
|
mkdir -p bin
|
|
echo "Building {{.BINARY}} for {{.GOOS}}/{{.GOARCH}}"
|
|
GOOS={{.GOOS}} GOARCH={{.GOARCH}} go build -o bin/{{.BINARY}}_{{.GOOS}}_{{.GOARCH}} ./cmd/{{.BINARY}}
|
|
vars:
|
|
BINARY: '{{index .MATCH 0}}'
|
|
|
|
native-compile-*:
|
|
desc: build a binary
|
|
cmd: |
|
|
mkdir -p bin
|
|
go build -o bin/{{.BINARY}} ./cmd/{{.BINARY}}
|
|
vars:
|
|
BINARY: '{{index .MATCH 0}}'
|
|
|
|
cross-compile-*:
|
|
desc: cross compile a binary
|
|
cmds:
|
|
- task: build-{{.BINARY}}
|
|
vars:
|
|
GOOS: linux
|
|
GOARCH: amd64
|
|
- task: build-{{.BINARY}}
|
|
vars:
|
|
GOOS: darwin
|
|
GOARCH: arm64
|
|
- task: build-{{.BINARY}}
|
|
vars:
|
|
GOOS: linux
|
|
GOARCH: arm64
|
|
vars:
|
|
BINARY: '{{index .MATCH 0}}'
|
|
|
|
update:
|
|
desc: update dependencies
|
|
cmds:
|
|
- go get -u ./...
|
|
- go mod tidy
|
|
|
|
install:
|
|
desc: install a binary
|
|
cmd: |
|
|
sudo install -m 0755 bin/{{.BINARY}} $DESTDIR/{{.BINARY}}
|
|
env:
|
|
DESTDIR: /usr/local/sbin
|