-
Notifications
You must be signed in to change notification settings - Fork 92
/
Makefile
50 lines (38 loc) · 1.14 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
PROJECT = github.com/chromium/hstspreload.org/...
.PHONY: build
build:
go build ${PROJECT}
.PHONY: lint
lint:
go vet ${PROJECT}
go install honnef.co/go/tools/cmd/[email protected]
staticcheck ${PROJECT}
.PHONY: pre-commit
pre-commit: lint build test
.PHONY: deploy
deploy: version
date
time gcloud app deploy app.yaml cron.yaml
date
# Version file.
.PHONY: version
version:
git rev-parse HEAD > ./frontend/version
# Google Cloud Datastore Emulator
GCD_NAME = gcd-grpc-1.0.0
XDG_CACHE_HOME ?= $(HOME)/.cache
DATABASE_TESTING_FOLDER = ${XDG_CACHE_HOME}/datastore-emulator
.PHONY: get-datastore-emulator
get-datastore-emulator: ${DATABASE_TESTING_FOLDER}/gcd/gcd.sh
${DATABASE_TESTING_FOLDER}/gcd/gcd.sh:
mkdir -p "${DATABASE_TESTING_FOLDER}"
curl "https://storage.googleapis.com/gcd/tools/${GCD_NAME}.zip" -o "${DATABASE_TESTING_FOLDER}/${GCD_NAME}.zip"
unzip "${DATABASE_TESTING_FOLDER}/${GCD_NAME}.zip" -d "${DATABASE_TESTING_FOLDER}"
rm "${DATABASE_TESTING_FOLDER}/${GCD_NAME}.zip"
# Testing
.PHONY: serve
serve: get-datastore-emulator version
go run *.go -local
.PHONY: test
test: get-datastore-emulator
go test -v -cover "${PROJECT}"