-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile
More file actions
33 lines (22 loc) · 827 Bytes
/
Makefile
File metadata and controls
33 lines (22 loc) · 827 Bytes
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
.PHONY: clean check test build release-test
export GO111MODULE=on
TAG_NAME := $(shell git tag -l --contains HEAD)
SHA := $(shell git rev-parse --short HEAD)
VERSION := $(if $(TAG_NAME),$(TAG_NAME),$(SHA))
BUILD_DATE := $(shell date -u '+%Y-%m-%d_%I:%M:%S%p')
BIN_OUTPUT := $(if $(filter $(shell go env GOOS), windows), lobicornis.exe, lobicornis)
IMAGE_NAME := traefik/lobicornis
default: clean check test build
test: clean
go test -v -cover ./...
lint:
golangci-lint run
clean:
rm -rf dist/ cover.out
build: clean
@echo Version: $(VERSION) $(BUILD_DATE)
CGO_ENABLED=0 go build -trimpath -ldflags '-s -w -X "main.version=${VERSION}" -X "main.commit=${SHA}" -X "main.date=${BUILD_DATE}"' -o ${BIN_OUTPUT} ./cmd/
release-test:
goreleaser --skip=publish --snapshot --clean
image:
docker build -t $(IMAGE_NAME) .