-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
99 lines (78 loc) · 1.88 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# This non-hermetic Makefile installs core dependencies such as bazel
UNAME ?= $(shell uname -s)
BAZEL ?= $(shell which bazel)
IMAGE ?= rules_homebrew
CACHEDIR ?= .cache
.PHONY: all
all: ci
.PHONY: deps
ifeq ($(UNAME),Darwin)
deps: deps-darwin
endif
ifeq ($(UNAME),Linux)
deps: deps-linux
endif
.PHONY: deps-common
deps-common: deps-bazel
.PHONY: deps-darwin
deps-darwin: deps-common
.PHONY: deps-linux
deps-linux: deps-common
apt-get install -y build-essential curl unzip
.PHONY: deps-bazel
ifeq "$(BAZEL)" ""
# default to bazel21
deps-bazel: deps-bazel21
else
deps-bazel:
@echo '[deps-bazel] Bazel already present.'
endif
.PHONY: ci
ci: build test
.PHONY: build
build:
bazel build //...
.PHONY: test
test:
bazel test //...
.PHONY: lint
lint:
bazel run //tools:lint
.PHONY: lintfix
lintfix:
bazel run //tools:lintfix
.PHONY: linux-ci-image
linux-ci-image: dockerfiles/Dockerfile
docker build -t ${IMAGE} -f dockerfiles/Dockerfile .
.PHONY: linux-ci-from-host
linux-ci-from-host: linux-ci-image
docker run \
-v $(shell pwd):/app \
-e CACHEDIR=.cache-linux \
-ti ${IMAGE} make ci
.PHONY: linux-ci-from-host-shell
linux-ci-from-host-shell: linux-ci-image
docker run \
-v $(shell pwd):/app \
-e CACHEDIR=.cache-linux \
-ti ${IMAGE} bash
# requires https://github.com/buildkite/cli
.PHONY: mac-ci-from-host
mac-ci-from-host:
bk run local
# requires https://circleci.com/docs/2.0/local-cli
.PHONY: circle-ci-from-host
circle-ci-from-host:
bk run local
.PHONY: deps-bazel21
deps-bazel21: ${CACHEDIR}/bazel-installer-21.sh
$^ --user
${CACHEDIR}/bazel-installer-21.sh:
ifeq ($(UNAME),Darwin)
curl -L -o $@ https://github.com/bazelbuild/bazel/releases/download/0.21.0/bazel-0.21.0-installer-darwin-x86_64.sh
chmod +x $@
endif
ifeq ($(UNAME),Linux)
curl -L -o $@ https://github.com/bazelbuild/bazel/releases/download/0.21.0/bazel-0.21.0-installer-linux-x86_64.sh
chmod +x $@
endif