From 1290ad74bcd65065f1edf481847c7c9f29013dfe Mon Sep 17 00:00:00 2001 From: Mircea-Pavel ANTON Date: Sun, 11 Aug 2024 12:27:48 +0000 Subject: [PATCH] chore: Add Taskfile automation --- Taskfile.yaml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Taskfile.yaml 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}