-
Notifications
You must be signed in to change notification settings - Fork 175
/
Makefile
79 lines (63 loc) · 1.96 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
# makefile for usb-tcp bridge for OT-3
include ../scripts/push.mk
include ../scripts/python.mk
# using bash instead of /bin/bash in SHELL prevents macOS optimizing away our PATH update
SHELL := bash
PATH := $(shell cd .. && yarn bin):$(PATH)
SHX := npx shx
# add yarn CLI dev deps to PATH (for cross platform POSIX commands via shx)
PATH := $(shell cd .. && yarn bin):$(PATH)
ot_project := $(OPENTRONS_PROJECT)
project_ir_default = $(if $(ot_project),$(ot_project),ot3)
project_rs_default = $(if $(ot_project),$(ot_project),robot-stack)
# These variables can be overriden when make is invoked to customize the
# behavior of pytest. For instance,
# make test tests=tests/ot3usb/abcd.py would run only the
# specified test
tests ?= tests
test_opts ?=
sdist_file = $(call python_get_sdistname,usb-bridge,$(project_rs_default),ot3usb)
# Find the branch, sha, version that will be used to update the VERSION.json file
version_file = $(call python_get_git_version,usb-bridge,$(project_rs_default),ot3usb)
# Host key location for robot
ssh_key ?= $(default_ssh_key)
# Other SSH args for robot
ssh_opts ?= $(default_ssh_opts)
.PHONY: setup
setup:
$(pipenv) sync $(pipenv_opts)
$(pipenv) run pip freeze
.PHONY: clean
clean:
$(SHX) rm -rf \
build \
dist \
.coverage \
coverage.xml \
'*.egg-info' \
'**/__pycache__' \
'**/*.pyc'
.PHONY: teardown
teardown:
$(pipenv) --rm
.PHONY: test
test:
$(python) -m pytest $(test_opts) $(tests)
.PHONY: lint
lint:
$(python) -m mypy ot3usb tests
$(python) -m black --check ./ot3usb ./tests
$(python) -m flake8 ot3usb tests
.PHONY: format
format:
$(python) -m black ot3usb tests
.PHONY: sdist
sdist: export OPENTRONS_PROJECT=$(project_rs_default)
sdist: clean
$(python) setup.py sdist
$(SHX) rm -rf build
$(SHX) ls dist
.PHONY: push-ot3
push-ot3: sdist
$(call push-python-sdist,$(host),$(ssh_key),$(ssh_opts),dist/$(sdist_file),/opt/ot3usb,ot3usb,,,$(version_file))
$(call restart-service,$(host),$(ssh_key),$(ssh_opts),opentrons-usb-bridge)