aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: c556faac1e63d6fa97736da77cff2097ff3c8814 (plain)
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
PWD := $(shell pwd)
PLATFORM := linux
BINARY := opa-pdp
GO_TEST_CLEAN ?= go clean -cache -testcache -modcache -i -r
RETRY_COUNT ?= 3
SLEEP_BETWEEN_RETRIES ?= 5


all: test build

build: install clean go_build test cover

deploy: install clean build_image

.PHONY: test
test:
	@go test -v ./...

format:
	@go fmt ./...

clean:
	@echo "Cleaning up..."
	rm -f go.tar.gz
	@rm -f $(BINARY)
	@echo "Done."

.PHONY: cover
cover:
	@go test -p 2 ./... -coverprofile=coverage.out
	@go tool cover -func=coverage.out -o coverage.html

.PHONY: install clean

install:
	./build_image.sh install

build_image:
	./build_image.sh build

go_build:
	CGO_ENABED=0 GOOS=$(PLATFORM) GOARCH=amd64 go build -ldflags "-w -s" -o $(PWD)/$(BINARY) cmd/opa-pdp/opa-pdp.go