forked from adikari/monorepo-diff-buildkite-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (32 loc) · 838 Bytes
/
Makefile
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
34
35
36
37
38
39
NAME=monorepo-diff-buildkite-plugin
RELEASE_VERSION?= "0.0.0"
ARCH?= "amd64"
COMMIT=$(shell git rev-parse --short=7 HEAD)
TIMESTAMP:=$(shell date -u '+%Y-%m-%dT%I:%M:%SZ')
LDFLAGS += -X main.BuildTime=${TIMESTAMP}
LDFLAGS += -X main.BuildSHA=${COMMIT}
LDFLAGS += -X main.Version=${RELEASE_VERSION}
HAS_DOCKER=$(shell command -v docker;)
.PHONY: all
all: quality test
.PHONY: test
test:
go test -race -coverprofile=coverage.out -covermode=atomic
ifneq (${HAS_DOCKER},)
docker-compose run --rm plugin_test
endif
.PHONY: quality
quality:
go vet
go fmt
go mod tidy
ifneq (${HAS_DOCKER},)
docker-compose run --rm plugin_lint
endif
.PHONY: clean
clean-%:
rm -f coverage.out
rm -rf ${NAME}-$*-${ARCH}
.PHONY: build
build-%: clean-%
GOOS=$* GOARCH=${ARCH} CGO_ENABLED=0 go build -ldflags '${LDFLAGS}' -o ${PWD}/${NAME}-$*-${ARCH}