forked from tmc/rules_helm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
104 lines (82 loc) · 2.01 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
99
100
101
102
103
# This non-hermetic Makefile installs core dependencies such as bazel
UNAME ?= $(shell uname -s)
BAZEL ?= $(shell which bazel)
CACHEDIR ?= .cache
IMAGE ?= $(shell basename $(shell pwd))
.PHONY: all
all: docs ci
.PHONY: docs
docs: deps
bazel build //docs && cp bazel-bin/docs/docs.md docs
@chmod +w docs/docs.md
.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
sudo apt-get install -y build-essential curl unzip
.PHONY: deps-bazel
ifeq "$(BAZEL)" ""
# default to bazel24
deps-bazel: deps-bazel24
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 deps 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-bazel24
deps-bazel24: ${CACHEDIR}/bazel-installer-24.sh
$^ --user
${CACHEDIR}/bazel-installer-24.sh:
ifeq ($(UNAME),Darwin)
curl -L -o $@ https://github.com/bazelbuild/bazel/releases/download/0.24.0/bazel-0.24.0-installer-darwin-x86_64.sh
chmod +x $@
endif
ifeq ($(UNAME),Linux)
curl -L -o $@ https://github.com/bazelbuild/bazel/releases/download/0.24.0/bazel-0.24.0-installer-linux-x86_64.sh
chmod +x $@
endif