-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
59 lines (43 loc) · 1.15 KB
/
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
50
51
52
53
54
55
56
57
58
59
APP:=pauditd
ifndef CIRCLECI
BUILD_NUM := dev-$(shell git rev-parse --short HEAD)
endif
ifndef BUILD_NUM
BUILD_NUM := dev
endif
ifdef CIRCLE_BUILD_NUM
BUILD_NUM := $(CIRCLE_BUILD_NUM)
QUAY := docker login -p "$$QUAY_PASSWD" -u "$$QUAY_USER" quay.io
endif
# These can be overridden
REGISTRY ?= quay.io/getpantheon
IMAGE ?= $(REGISTRY)/$(APP):$(BUILD_NUM)
build: build-linux
build-linux:
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build
test:
go test $$(go list ./...) -race
test-cov-html:
go test -coverprofile=coverage.out
go tool cover -html=coverage.out
bench:
go test -bench=.
bench-cpu:
go test -bench=. -benchtime=5s -cpuprofile=cpu.pprof
go tool pprof pauditd.test cpu.pprof
bench-cpu-long:
go test -bench=. -benchtime=60s -cpuprofile=cpu.pprof
go tool pprof pauditd.test cpu.pprof
build-docker:
docker build -t $(IMAGE) .
push-circle: setup-quay
make push
push:
docker push $(IMAGE)
snapshot:
goreleaser --snapshot --rm-dist --debug
setup-quay:: ## setup docker login for quay.io
ifdef CIRCLE_BUILD_NUM
@$(QUAY) > /dev/null
endif
.PHONY: test test-cov-html bench bench-cpu bench-cpu-long bin setup-quay build-docker push push-circle