diff --git a/Taskfile.yaml b/Taskfile.yaml new file mode 100644 index 0000000..60bed7e --- /dev/null +++ b/Taskfile.yaml @@ -0,0 +1,35 @@ +--- +version: "3" + +env: + VERSION: + sh: git describe --tags --always --dirty + DIR_NAME: + sh: basename $(git rev-parse --show-toplevel) + +tasks: + build: + desc: Build the binary. + sources: + - main.go + - cmd/* + - internal/* + - go.mod + - go.sum + cmd: go build -ldflags "-s -w -X github.com/mirceanton/kube-switcher/cmd.version=${VERSION}" -o ${DIR_NAME} + + run: + desc: Run the binary. + deps: [build] + cmd: ./${DIR_NAME} {{.CLI_ARGS}} + test: + desc: Run tests. + cmd: go test -v ./... -race -covermode=atomic + + lint: + desc: Run linter. + cmd: golangci-lint run + + docker-build: + desc: Build the docker image. + cmd: docker build . -t ${DIR_NAME}:${VERSION}