mirror of
https://github.com/onyx-and-iris/xair-cli.git
synced 2026-04-08 18:03:37 +00:00
replace makefile with taskfile
add CI config + action
This commit is contained in:
57
Taskfile.yml
Normal file
57
Taskfile.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
version: '3'
|
||||
|
||||
vars:
|
||||
PROGRAM: xair-cli
|
||||
SHELL: '{{if eq .OS "Windows_NT"}}powershell{{end}}'
|
||||
BIN_DIR: bin
|
||||
VERSION:
|
||||
sh: 'git describe --tags $(git rev-list --tags --max-count=1)'
|
||||
|
||||
WINDOWS: '{{.BIN_DIR}}/{{.PROGRAM}}_windows_amd64.exe'
|
||||
LINUX: '{{.BIN_DIR}}/{{.PROGRAM}}_linux_amd64'
|
||||
|
||||
tasks:
|
||||
default:
|
||||
desc: Build the xair-cli project
|
||||
cmds:
|
||||
- task: build
|
||||
|
||||
build:
|
||||
desc: Build the xair-cli project
|
||||
deps: [vet]
|
||||
cmds:
|
||||
- task: build-windows
|
||||
- task: build-linux
|
||||
|
||||
vet:
|
||||
desc: Vet the code
|
||||
deps: [fmt]
|
||||
cmds:
|
||||
- go vet ./...
|
||||
|
||||
fmt:
|
||||
desc: Fmt the code
|
||||
cmds:
|
||||
- go fmt ./...
|
||||
|
||||
build-windows:
|
||||
desc: Build the xair-cli project for Windows
|
||||
cmds:
|
||||
- GOOS=windows GOARCH=amd64 go build -o {{.WINDOWS}} -ldflags="-X main.version={{.VERSION}}"
|
||||
internal: true
|
||||
|
||||
build-linux:
|
||||
desc: Build the xair-cli project for Linux
|
||||
cmds:
|
||||
- GOOS=linux GOARCH=amd64 go build -o {{.LINUX}} -ldflags="-X main.version={{.VERSION}}"
|
||||
internal: true
|
||||
|
||||
test:
|
||||
desc: Run tests
|
||||
cmds:
|
||||
- go test ./...
|
||||
|
||||
clean:
|
||||
desc: Clean the build artifacts
|
||||
cmds:
|
||||
- '{{.SHELL}} rm -r {{.BIN_DIR}}'
|
||||
Reference in New Issue
Block a user