-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
135 lines (105 loc) · 3.13 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
# This Makefile requires the following commands to be available:
# * python3.7
# * rubygems
SRC:=detox_bridge tests setup.py
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
DETOX=$(ROOT_DIR)/node_modules/.bin/detox
.PHONY: pyclean
pyclean:
-find . -name "*.pyc" -delete
-rm -rf *.egg-info build
-rm -rf coverage*.xml .coverage
.PHONY: clean
clean: pyclean clean_example_app
-rm -rf venv
-rm -rf .tox
venv: PYTHON?=python3.7
venv:
$(PYTHON) -m venv venv
# FIXME: unpin when https://github.com/pypa/pip/issues/9215 is fixed
venv/bin/pip install -U "pip==20.2" -q
venv/bin/pip install -r requirements.txt
## Code style
.PHONY: lint
lint: lint/black lint/flake8 lint/isort lint/mypy
.PHONY: lint/black
lint/black: venv
venv/bin/black --diff --check $(SRC)
.PHONY: lint/flake8
lint/flake8: venv
venv/bin/flake8 $(SRC)
.PHONY: lint/isort
lint/isort: venv
venv/bin/isort --diff --check $(SRC)
.PHONY: lint/mypy
lint/mypy: venv
venv/bin/mypy $(SRC)
.PHONY: format
format: format/isort format/black
.PHONY: format/isort
format/isort: venv
venv/bin/isort $(SRC)
.PHONY: format/black
format/black: venv
venv/bin/black $(SRC)
## Tests
.PHONY: unittests
unittests: TOX_ENV?=ALL
unittests: TOX_EXTRA_PARAMS?=""
unittests: venv
venv/bin/tox -e $(TOX_ENV) $(TOX_EXTRA_PARAMS)
.PHONY: test
test: pyclean unittests
## Distribution
.PHONY: changelog
changelog:
venv/bin/gitchangelog
.PHONY: build
build: venv
-rm -rf dist build
venv/bin/python setup.py sdist bdist_wheel
venv/bin/twine check dist/*
.PHONY: upload
upload: venv
-rm -rf dist build
venv/bin/python setup.py sdist bdist_wheel upload -r local
.PHONY: nvm_install
nvm_install:
source "${NVM_DIR}/nvm.sh" && nvm install 15.2.1
.PHONY: app_github_requirements
app_github_requirements: nvm_install
gem install xcpretty
gem install xcpretty-travis-formatter
.PHONY: app_local_requirements
app_local_requirements: nvm_install
sudo gem install xcpretty -n /usr/local/bin
sudo gem install xcpretty-travis-formatter -n /usr/local/bin
## JS app related stuff
$(DETOX): package.json
npm install
.PHONY: example_app_node_modules
example_app_node_modules: ./example/package.json
pushd example && source "${NVM_DIR}/nvm.sh" && nvm use && npm install && popd
.PHONY: example_app_pods
example_app_pods: example_app_node_modules ./example/ios/Podfile
pushd example/ios && pod install && popd
.PHONY: example_app_binary
example_app_binary: example_app_node_modules example_app_pods $(DETOX)
pushd example && source "${NVM_DIR}/nvm.sh" && nvm use && $(DETOX) build --configuration ios.sim.release --logLevel trace && popd
.PHONY: jsdriventest
jsdriventest:
pushd example && $(DETOX) test --configuration ios.sim.release --cleanup && popd
.PHONY: clean_example_app
clean_example_app: clean_example_app_build clean_example_app_node_modules clean_example_app_pods
.PHONY: clean_example_app_build
clean_example_app_build:
rm -rf ./example/ios/build
.PHONY: clean_example_app_pods
clean_example_app_pods:
rm -rf ./example/ios/Pods
.PHONY: clean_example_app_node_modules
clean_example_app_node_modules:
rm -rf ./example/node_modules
.PHONY: docs
docs: venv
sphinx-build -W -b html docs /docs/_build/html