-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (37 loc) · 1.32 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
## The lines below can be uncommented for debugging the make rules
#
# OLD_SHELL := $(SHELL)
# SHELL = $(warning Building $@$(if $<, (from $<))$(if $?, ($? newer)))$(OLD_SHELL)
#
# print-%:
# @echo $* = $($*)
.PHONY: build fmt test vet clean generate
SRC = $(shell find . -type f -name '*.go' -not -path "./grafeas/grafeas/*")
CLEAN := *~
.EXPORT_ALL_VARIABLES:
GO111MODULE=on
build: vet fmt generate
go build -v ./...
# http://golang.org/cmd/go/#hdr-Run_gofmt_on_package_sources
fmt:
@gofmt -l -w $(SRC)
pre-test:
mkdir -p test
bash -c "if [ ! -f test/dynamodb_local_latest.tgz ]; then curl https://s3.eu-central-1.amazonaws.com/dynamodb-local-frankfurt/dynamodb_local_latest.tar.gz -o test/dynamodb_local_latest.tgz -L; fi"
tar xf test/dynamodb_local_latest.tgz -C test
bash -c 'cd test; java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb & echo $$! > dynamo.pid'
test: generate
@go test -v ./...
post-test:
bash -c "kill $$(cat test/dynamo.pid)"
rm -f test/dynamo.pid
vet: generate
@go vet ./...
generate:
mkdir -p grafeas
bash -c "if [ ! -f grafeas/grafeas.tgz ]; then curl https://github.com/grafeas/grafeas/releases/download/v0.1.3/grafeas-0.1.3.tar.gz -o grafeas/grafeas.tgz -L; fi"
tar xf grafeas/grafeas.tgz -C grafeas
clean: generate
go clean ./...
rm -rf $(CLEAN)
rm -rf test grafeas