-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
49 lines (40 loc) · 980 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
40
41
42
43
44
45
46
47
48
49
NAME=monorepo-diff-buildkite-plugin
HAS_DOCKER=$(shell command -v docker;)
HAS_GORELEASER=$(shell command -v goreleaser;)
.PHONY: all
all: quality test
.PHONY: test-go
test-go:
go test -race -coverprofile=coverage.out -covermode=atomic
.PHONY: build-docker-test
build-docker-test:
ifneq (${HAS_DOCKER},)
docker build -t ${NAME} -f tests/Dockerfile .
endif
.PHONY: test-docker
test-docker: build-docker-test
ifneq (${HAS_DOCKER},)
docker run --rm ${NAME} go test -race -coverprofile=coverage.out -covermode=atomic
endif
.PHONY: test
test: test-go test-docker
.PHONY: quality
quality:
go vet
go fmt
go mod tidy
ifneq (${HAS_DOCKER},)
docker run --rm buildkite/plugin-linter:latest --id buildkite-plugins/monorepo-diff
endif
.PHONY: build
build:
ifneq (${HAS_GORELEASER},)
goreleaser build --clean --skip-validate
else
$(error goreleaser binary is missing, please install goreleaser)
endif
.PHONY: local
local:
rm -f ${NAME}
go build -o ${NAME}
chmod +x ${NAME}