forked from h2oai/datatable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
443 lines (359 loc) · 11.3 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
#-------------------------------------------------------------------------------
# © H2O.ai 2018; -*- encoding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#-------------------------------------------------------------------------------
BUILDDIR := build/fast
PYTHON ?= python
MODULE ?= .
ifneq ($(CI),)
PYTEST_FLAGS := -vv -s --showlocals
endif
# Platform details
OS := $(shell uname | tr A-Z a-z)
ARCH := $(shell uname -m)
PLATFORM := $(ARCH)-$(OS)
# Distribution directory
DIST_DIR := dist/$(PLATFORM)
.PHONY: all clean mrproper build install uninstall test_install test \
benchmark debug bi coverage dist fast
ifeq ($(MAKECMDGOALS), fast)
-include ci/fast.mk
ci/fast.mk:
@echo • Regenerating ci/fast.mk
@$(PYTHON) ci/make_fast.py
endif
ifeq ($(MAKECMDGOALS), dfast)
-include ci/fast.mk
ci/fast.mk:
@echo • Regenerating ci/fast.mk [debug mode]
@$(PYTHON) ci/make_fast.py debug
endif
ifeq ($(MAKECMDGOALS), main-fast)
-include ci/fast.mk
endif
all:
$(MAKE) clean
$(MAKE) build
$(MAKE) install
$(MAKE) test
clean::
rm -rf .asan
rm -rf .cache
rm -rf .eggs
rm -rf build
rm -rf dist
rm -rf datatable.egg-info
rm -f *.so
rm -f datatable/lib/_datatable*.so
rm -f ci/fast.mk
find . -type d -name "__pycache__" -exec rm -rf {} +
mrproper: clean
git clean -f -d -x
build:
$(PYTHON) setup.py build
cp build/lib.*/datatable/lib/_datatable.* datatable/lib/
install:
$(PYTHON) -m pip install . --upgrade --no-cache-dir
uninstall:
$(PYTHON) -m pip uninstall datatable -y
test_install:
$(PYTHON) -m pip install ${MODULE}[testing] --no-cache-dir
test:
rm -rf build/test-reports 2>/dev/null
mkdir -p build/test-reports/
$(PYTHON) -m pytest -ra --maxfail=10 $(PYTEST_FLAGS) \
--junit-prefix=$(PLATFORM) \
--junitxml=build/test-reports/TEST-datatable.xml \
tests
benchmark:
$(PYTHON) -m pytest -ra -x -v benchmarks
debug:
$(MAKE) clean
DTDEBUG=1 \
$(MAKE) build
$(MAKE) install
# In order to run with Address Sanitizer:
# $ make clean
# $ make asan_env
# $ source .asan/bin/activate
# $ make asan
# $ make install
# $ make test
# (note that `make test_install` doesn't work due to py-cpuinfo crashing
# in Asan).
asan_env:
$(MAKE) clean
bash -x ci/asan-env.sh
asan:
DTASAN=1 $(MAKE) fast
bi:
$(MAKE) build
$(MAKE) install
coverage:
$(eval DTCOVERAGE := 1)
$(eval export DTCOVERAGE)
$(MAKE) clean
$(MAKE) build
$(MAKE) install
$(MAKE) test_install
$(PYTHON) -m pytest -x \
--benchmark-skip \
--cov=datatable --cov-report=html:build/coverage-py \
tests
$(PYTHON) -m pytest -x \
--benchmark-skip \
--cov=datatable --cov-report=xml:build/coverage.xml \
tests
chmod +x ci/llvm-gcov.sh
lcov --gcov-tool ci/llvm-gcov.sh --capture --directory . --no-external --output-file build/coverage.info
genhtml --legend --output-directory build/coverage-c --demangle-cpp build/coverage.info
mv .coverage build/
dist: build
$(PYTHON) setup.py bdist_wheel -d $(DIST_DIR)
sdist:
$(PYTHON) setup.py sdist
version:
@$(PYTHON) ci/setup_utils.py version
nothing:
@echo Nothing
#-------------------------------------------------------------------------------
# CentOS7 build
#-------------------------------------------------------------------------------
DIST_DIR = dist
ARCH := $(shell arch)
OS_NAME ?= centos7
PLATFORM := $(ARCH)_$(OS_NAME)
DOCKER_REPO_NAME ?= harbor.h2o.ai
CONTAINER_NAME_SUFFIX ?= -$(USER)
CONTAINER_NAME ?= $(DOCKER_REPO_NAME)/opsh2oai/datatable-build-$(PLATFORM)$(CONTAINER_NAME_SUFFIX)
PROJECT_VERSION := $(shell grep '^version' datatable/__version__.py | sed 's/version = //' | sed 's/\"//g')
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
BRANCH_NAME_SUFFIX = +$(BRANCH_NAME)
BUILD_ID ?= local
BUILD_ID_SUFFIX = .$(BUILD_ID)
VERSION = $(PROJECT_VERSION)$(BRANCH_NAME_SUFFIX)$(BUILD_ID_SUFFIX)
CONTAINER_TAG := $(shell echo $(VERSION) | sed 's/[+\/]/-/g')
CONTAINER_NAME_TAG = $(CONTAINER_NAME):$(CONTAINER_TAG)
ifneq ($(CI), 1)
CI_VERSION_SUFFIX ?= $(BRANCH_NAME)
endif
ARCH_SUBST = undefined
FROM_SUBST = undefined
ifeq ($(PLATFORM),x86_64_centos7)
FROM_SUBST = centos:7
ARCH_SUBST = $(ARCH)
endif
ifeq ($(PLATFORM),ppc64le_centos7)
FROM_SUBST = ibmcom\/centos-ppc64le
ARCH_SUBST = $(ARCH)
endif
ifeq ($(PLATFORM),x86_64_ubuntu)
FROM_SUBST = x86_64_linux
ARCH_SUBST = $(ARCH)
endif
Dockerfile-centos7.$(PLATFORM): ci/Dockerfile-centos7.in
cat $< | sed 's/FROM_SUBST/$(FROM_SUBST)/'g | sed 's/ARCH_SUBST/$(ARCH_SUBST)/g' > $@
Dockerfile-centos7.$(PLATFORM).tag: Dockerfile-centos7.$(PLATFORM)
docker build \
-t $(CONTAINER_NAME_TAG) \
-f Dockerfile-centos7.$(PLATFORM) \
.
echo $(CONTAINER_NAME_TAG) > $@
centos7_docker_build: Dockerfile-centos7.$(PLATFORM).tag
centos7_docker_publish: Dockerfile-centos7.$(PLATFORM).tag
docker push $(CONTAINER_NAME_TAG)
centos7_in_docker: Dockerfile-centos7.$(PLATFORM).tag
make clean
docker run \
--rm \
--init \
-u `id -u`:`id -g` \
-v `pwd`:/dot \
-w /dot \
--entrypoint /bin/bash \
-e "CI_VERSION_SUFFIX=$(CI_VERSION_SUFFIX)" \
-e "DTBL_GIT_HASH=$(DTBL_GIT_HASH)" \
$(CONTAINER_NAME_TAG) \
-c 'make dist'
mkdir -p $(DIST_DIR)/$(PLATFORM)
mv $(DIST_DIR)/*.whl $(DIST_DIR)/$(PLATFORM)
echo $(VERSION) > $(DIST_DIR)/$(PLATFORM)/VERSION.txt
#
# Ubuntu image - will be removed
#
Dockerfile-ubuntu.$(PLATFORM): ci/Dockerfile-ubuntu.in
cat $< | sed 's/FROM_SUBST/$(FROM_SUBST)/'g | sed 's/ARCH_SUBST/$(ARCH_SUBST)/g' > $@
Dockerfile-ubuntu.$(PLATFORM).tag: Dockerfile-ubuntu.$(PLATFORM)
docker build \
-t $(CONTAINER_NAME_TAG) \
-f Dockerfile-ubuntu.$(PLATFORM) \
.
echo $(CONTAINER_NAME_TAG) > $@
ubuntu_docker_build: Dockerfile-ubuntu.$(PLATFORM).tag
ubuntu_docker_publish: Dockerfile-ubuntu.$(PLATFORM).tag
docker push $(CONTAINER_NAME_TAG)
ARCH_NAME ?= $(shell uname -m)
DOCKER_IMAGE_TAG ?= 0.8.0-master.9
CENTOS_DOCKER_IMAGE_NAME ?= harbor.h2o.ai/opsh2oai/datatable-build-$(ARCH_NAME)_centos7:$(DOCKER_IMAGE_TAG)
UBUNTU_DOCKER_IMAGE_NAME ?= harbor.h2o.ai/opsh2oai/datatable-build-$(ARCH_NAME)_ubuntu:$(DOCKER_IMAGE_TAG)
docker_image_tag:
@echo $(DOCKER_IMAGE_TAG)
centos7_build_in_docker_impl:
docker run \
--rm \
--init \
-u `id -u`:`id -g` \
-v `pwd`:/dot \
-w /dot \
--entrypoint /bin/bash \
-e "CI_VERSION_SUFFIX=$(CI_VERSION_SUFFIX)" \
-e "DTBL_GIT_HASH=$(DTBL_GIT_HASH)" \
$(CUSTOM_ARGS) \
$(CENTOS_DOCKER_IMAGE_NAME) \
-c ". activate $(BUILD_VENV) && \
make CI=$(CI) dist"
centos7_build_py37_in_docker:
$(MAKE) BUILD_VENV=datatable-py37-with-pandas centos7_build_in_docker_impl
centos7_build_py36_in_docker:
$(MAKE) BUILD_VENV=datatable-py36-with-pandas centos7_build_in_docker_impl
centos7_build_py35_in_docker:
$(MAKE) BUILD_VENV=datatable-py35-with-pandas centos7_build_in_docker_impl
centos7_version_in_docker:
docker run \
--rm \
--init \
-u `id -u`:`id -g` \
-v `pwd`:/dot \
-w /dot \
--entrypoint /bin/bash \
-e "CI_VERSION_SUFFIX=$(CI_VERSION_SUFFIX)" \
-e "DTBL_GIT_HASH=$(DTBL_GIT_HASH)" \
$(CUSTOM_ARGS) \
$(CENTOS_DOCKER_IMAGE_NAME) \
-c ". activate datatable-py36-with-pandas && \
python --version && \
mkdir -p dist && \
make CI=$(CI) version > dist/VERSION.txt && \
cat dist/VERSION.txt"
centos7_test_in_docker_impl:
docker run \
--rm \
--init \
-u `id -u`:`id -g` \
-v `pwd`:/dot \
-w /dot \
--entrypoint /bin/bash \
-e "DT_LARGE_TESTS_ROOT=$(DT_LARGE_TESTS_ROOT)" \
-e "DTBL_GIT_HASH=$(DTBL_GIT_HASH)" \
$(CUSTOM_ARGS) \
$(CENTOS_DOCKER_IMAGE_NAME) \
-c ". activate $(TEST_VENV) && \
python --version && \
pip install --no-cache-dir --upgrade dist/*.whl && \
make CI=$(CI) MODULE=datatable test_install && \
make test CI=$(CI)"
centos7_test_py37_with_pandas_in_docker:
$(MAKE) TEST_VENV=datatable-py37-with-pandas centos7_test_in_docker_impl
centos7_test_py36_with_pandas_in_docker:
$(MAKE) TEST_VENV=datatable-py36-with-pandas centos7_test_in_docker_impl
centos7_test_py35_with_pandas_in_docker:
$(MAKE) TEST_VENV=datatable-py35-with-pandas centos7_test_in_docker_impl
centos7_test_py36_with_numpy_in_docker:
$(MAKE) TEST_VENV=datatable-py36-with-numpy centos7_test_in_docker_impl
centos7_test_py36_in_docker:
$(MAKE) TEST_VENV=datatable-py36 centos7_test_in_docker_impl
ubuntu_build_in_docker_impl:
docker run \
--rm \
--init \
-u `id -u`:`id -g` \
-v `pwd`:/dot \
-w /dot \
--entrypoint /bin/bash \
-e "CI_VERSION_SUFFIX=$(CI_VERSION_SUFFIX)" \
-e "DT_LARGE_TESTS_ROOT=$(DT_LARGE_TESTS_ROOT)" \
-e "DTBL_GIT_HASH=$(DTBL_GIT_HASH)" \
$(CUSTOM_ARGS) \
$(UBUNTU_DOCKER_IMAGE_NAME) \
-c ". /envs/$(BUILD_VENV)/bin/activate && \
python --version && \
make CI=$(CI) dist"
ubuntu_build_sdist_in_docker:
docker run \
--rm \
--init \
-u `id -u`:`id -g` \
-v `pwd`:/dot \
-w /dot \
--entrypoint /bin/bash \
-e "CI_VERSION_SUFFIX=$(CI_VERSION_SUFFIX)" \
-e "DT_LARGE_TESTS_ROOT=$(DT_LARGE_TESTS_ROOT)" \
-e "DTBL_GIT_HASH=$(DTBL_GIT_HASH)" \
$(CUSTOM_ARGS) \
$(UBUNTU_DOCKER_IMAGE_NAME) \
-c ". /envs/datatable-py36-with-pandas/bin/activate && \
python --version && \
make CI=$(CI) sdist"
ubuntu_build_py37_in_docker:
$(MAKE) BUILD_VENV=datatable-py37-with-pandas ubuntu_build_in_docker_impl
ubuntu_build_py36_in_docker:
$(MAKE) BUILD_VENV=datatable-py36-with-pandas ubuntu_build_in_docker_impl
ubuntu_build_py35_in_docker:
$(MAKE) BUILD_VENV=datatable-py35-with-pandas ubuntu_build_in_docker_impl
ubuntu_coverage_py36_with_pandas_in_docker:
docker run \
--rm \
--init \
-u `id -u`:`id -g` \
-v `pwd`:/dot \
-w /dot \
--entrypoint /bin/bash \
-e "DT_LARGE_TESTS_ROOT=$(DT_LARGE_TESTS_ROOT)" \
-e "DTBL_GIT_HASH=$(DTBL_GIT_HASH)" \
$(CUSTOM_ARGS) \
$(UBUNTU_DOCKER_IMAGE_NAME) \
-c ". /envs/datatable-py36-with-pandas/bin/activate && \
python --version && \
make CI=$(CI) coverage"
ubuntu_test_in_docker_impl:
docker run \
--rm \
--init \
-u `id -u`:`id -g` \
-v `pwd`:/dot \
-w /dot \
--entrypoint /bin/bash \
-e "DT_LARGE_TESTS_ROOT=$(DT_LARGE_TESTS_ROOT)" \
-e "DTBL_GIT_HASH=$(DTBL_GIT_HASH)" \
$(CUSTOM_ARGS) \
$(UBUNTU_DOCKER_IMAGE_NAME) \
-c ". /envs/$(TEST_VENV)/bin/activate && \
python --version && \
pip freeze && \
pip install --no-cache-dir dist/*.whl && \
python --version && \
make CI=$(CI) MODULE=datatable test_install && \
make CI=$(CI) test"
ubuntu_test_py37_with_pandas_in_docker:
$(MAKE) TEST_VENV=datatable-py37-with-pandas ubuntu_test_in_docker_impl
ubuntu_test_py36_with_pandas_in_docker:
$(MAKE) TEST_VENV=datatable-py36-with-pandas ubuntu_test_in_docker_impl
ubuntu_test_py35_with_pandas_in_docker:
$(MAKE) TEST_VENV=datatable-py35-with-pandas ubuntu_test_in_docker_impl
ubuntu_test_py36_with_numpy_in_docker:
$(MAKE) TEST_VENV=datatable-py36-with-numpy ubuntu_test_in_docker_impl
ubuntu_test_py36_in_docker:
$(MAKE) TEST_VENV=datatable-py36 ubuntu_test_in_docker_impl
# Note: We don't actually need to run mrproper in docker (as root) because
# the build step runs as the user. But keep the API for consistency.
mrproper_in_docker: mrproper
printvars:
@echo PLATFORM=$(PLATFORM)
@echo PROJECT_VERSION=$(PROJECT_VERSION)
@echo VERSION=$(VERSION)
@echo CONTAINER_TAG=$(CONTAINER_TAG)
@echo CONTAINER_NAME=$(CONTAINER_NAME)
clean::
rm -f Dockerfile-centos7.$(PLATFORM)