-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
135 lines (101 loc) · 3.99 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
# FinMag - Copyright (C) 2012-2017 University of Southampton
# Contact: Hans Fangohr <[email protected]>
# Do not distribute.
#
# This Makefile is used by our continuous-integration server
# to run the tests and to build the documentation
#
default:
@echo 'This makefile is used for CI only; do not use directly.'
PYTHON ?= python
PURGE_REPO_CMD ?= git clean -f -x
NETGENDIR ?= /usr/share/netgen/
PROJECT_DIR = $(abspath .)
NATIVE_DIR = native
PYTHON_ROOTS = $(PROJECT_DIR)/src
FINMAG_REPO ?= ssh://[email protected]/fangohr/finmag
FINMAG_BINARY_DEST ?= $(HOME)/finmag_binary_version_of_last_successful_build
FINMAG_BINARY_LICENSE_FILE ?= $(HOME)/License-LicenseRequest_FinmagJenkins
DIST_WRAPPER_DIR ?= $(HOME)/finmag-dist
DIST_WRAPPER_OPTIONS ?= --skip-tests --finmag-repo=$(FINMAG_REPO) --destdir=$(FINMAG_BINARY_DEST)
export PRECOMPILED_HEADER_DIR = $(PROJECT_DIR)/tmp/$(notdir $(abspath .))-$(BUILD_TAG)-$(BUILD_ID)
export DISABLE_PYTHON_MAKE = 1 # to only build native modules once per session
CIRCLECI_TEST_REPORTS_DIR=${CIRCLE_TEST_REPORTS}
print-debugging-info: print-PROJECT_DIR print-PYTHON_ROOTS print-NETGENDIR
@echo
# display variables defined in this Makefile
# example: `make print-PROJECT_DIR`
print-%:
@echo [DDD] Makefile $*=\`$($*)\`
purge: clean
@echo "Removing all untracked files from repository."
$(PURGE_REPO_CMD)
clean:
make -C src/ cleansrc
make -C $(NATIVE_DIR) clean
rm -rf test-reports
##################################
# BUILDING THE NATIVE EXTENSIONS #
##################################
make-modules:
make -C $(NATIVE_DIR) all
% : %.c
##############################
# BUILDING THE DOCUMENTATION #
##############################
doc: make-modules doc-html doc-latexpdf doc-singlehtml
doc-clean:
make -C doc clean
# generate documentation in html format without re-building the examples
# good for debugging but needs to the examples to have been built before
doc-html-nobuildexamples:
SPHINXWARNINGOPTS= make -C doc htmlraw
# generate documentation in any of the supported formats in doc/Makefile
# examples: `make doc-html`, `make doc-singlehtml`, `make doc-pdf`
doc-%:
make -C doc generate-doc $*
#####################
# RUNNING THE TESTS #
#####################
# py.test options
# example: `-sx` to disable capturing of STDOUT and exit on first error
TEST_OPTIONS ?= -v
create-dirs:
mkdir -p test-reports/junit
test: clean create-dirs make-modules tests test-native test-notebooks
# test against PEP8 guidelines
test-pep8:
flake8 --config=flake8 $(PYTHON_ROOTS)
# run all Python tests
test-python: create-dirs make-modules
PYTHONPATH=$(PYTHON_ROOTS) py.test $(TEST_OPTIONS) \
--junitxml=$(PROJECT_DIR)/test-reports/junit/TEST_pytest.xml
# exclude tests marked as slow
test-fast: create-dirs make-modules
PYTHONPATH=$(PYTHON_ROOTS) py.test $(TEST_OPTIONS) -m "not requires_X_display and not slow" \
--junitxml=$(PROJECT_DIR)/test-reports/test-fast.xml
# Only run tests marked as slow
test-slow: create-dirs make-modules
PYTHONPATH=$(PYTHON_ROOTS) py.test $(TEST_OPTIONS) -m "not requires_X_display and slow" \
--junitxml=$(PROJECT_DIR)/test-reports/test-slow.xml
# run both fast and slow tests
tests: test-fast test-slow
# run tests on the native extensions
test-native: make-modules
make -C $(NATIVE_DIR) run-ci-tests
# try to reproduce the ipython notebooks
test-notebooks: create-dirs make-modules print-debugging-info
cd doc/ipython_notebooks_src/ && py.test . -v --ipynb --sanitize-with sanitize_file --junitxml=$(PROJECT_DIR)/test-reports/junit/TEST_pytest.xml
.PHONY: default make-modules create-dirs doc test test-python test-fast test-slow test-native test-notebooks
# Working with containers 2017. C stands for Container:
cbuild:
@# builds a docker image for Finmag
make -C install/docker/latest build
ctest: cbuild
@# runs tests in docker image
docker run -ti -v `pwd`:/io/finmag finmag/finmag:latest bash -c "make test-fast"
crun: cbuild
@# provides fenics environment in container
docker run -ti -v `pwd`:/io/finmag finmag/finmag:latest bash
test-all:
py.test -v