forked from Opentrons/opentrons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·136 lines (110 loc) · 3.2 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# opentrons platform makefile
# https://github.com/Opentrons/opentrons
SHELL := /bin/bash
# add node_modules/.bin to PATH
PATH := $(shell yarn bin):$(PATH)
API_DIR := api
DISCOVERY_CLIENT_DIR := discovery-client
SHARED_DATA_DIR := shared-data
UPDATE_SERVER_DIR := update-server
# this may be set as an environment variable to select the version of
# python to run if pyenv is not available. it should always be set to
# point to a python3.6.
OT_PYTHON ?= python
# watch, coverage, and update snapshot variables for tests
watch ?= false
cover ?= true
updateSnapshot ?= false
ifeq ($(watch), true)
cover := false
endif
# run at usage (=), not on makefile parse (:=)
usb_host = $(shell yarn run -s discovery find -i 169.254 fd00 -c "[fd00:0:cafe:fefe::1]")
# install all project dependencies
.PHONY: install
install: install-js install-py
.PHONY: install-py
install-py:
$(OT_PYTHON) -m pip install pipenv==2018.10.9
$(MAKE) -C $(API_DIR) install
$(MAKE) -C $(UPDATE_SERVER_DIR) install
# front-end dependecies handled by yarn
.PHONY: install-js
install-js:
yarn
$(MAKE) -j 1 -C $(SHARED_DATA_DIR)
$(MAKE) -j 1 -C $(DISCOVERY_CLIENT_DIR)
# uninstall all project dependencies
# TODO(mc, 2018-03-22): API uninstall via pipenv --rm in api/Makefile
.PHONY: uninstall
uninstall:
$(MAKE) -C $(API_DIR) clean uninstall
shx rm -rf '**/node_modules'
# install flow typed definitions for all JS projects that use flow
# typedefs are commited, so only needs to be run when we want to update
.PHONY: install-types
install-types:
flow-mono align-versions
flow-mono install-types --overwrite --flowVersion=0.61.0
flow-typed install --overwrite --flowVersion=0.61.0
.PHONY: push-api
push-api: export host = $(usb_host)
push-api:
$(if $(host),@echo "Pushing to $(host)",$(error host variable required))
$(MAKE) -C $(API_DIR) push
$(MAKE) -C $(API_DIR) restart
.PHONY: api-local-container
api-local-container:
docker build . \
--no-cache \
--build-arg base_image=resin/amd64-alpine-python:3.6-slim-20180123 \
--build-arg running_on_pi="" \
--build-arg data_mkdir_path_slash_if_none=/data/system
.PHONY: term
term: export host = $(usb_host)
term:
$(if $(host),@echo "Connecting to $(host)",$(error host variable required))
$(MAKE) -C $(API_DIR) term
# all tests
.PHONY: test
test: test-py test-js
.PHONY: test-py
test-py:
$(MAKE) -C api test
.PHONY: test-js
test-js:
jest \
--runInBand=$(if $(CI),true,false) \
--coverage=$(cover) \
--watch=$(watch) \
--updateSnapshot=$(updateSnapshot)
# lints and typechecks
.PHONY: lint
lint: lint-py lint-js lint-json lint-css check-js
.PHONY: lint-py
lint-py:
$(MAKE) -C $(API_DIR) lint
$(MAKE) -C $(UPDATE_SERVER_DIR) lint
.PHONY: lint-js
lint-js:
eslint '.*.js' '**/*.js'
.PHONY: lint-json
lint-json:
eslint --max-warnings 0 --ext .json .
.PHONY: lint-css
lint-css:
stylelint '**/*.css'
.PHONY: check-js
check-js:
flow $(if $(CI),check,status)
# upload coverage reports
.PHONY: coverage
coverage:
codecov
# TODO(mc, 2018-06-06): update publish call and echo note when lerna splits
# version bump and publish: https://github.com/lerna/lerna/issues/961
.PHONY: bump
bump:
@echo "Bumping versions"
@echo "(please ignore lerna mentioning 'publish'; publish is disabled)"
lerna publish $(opts)