-
Notifications
You must be signed in to change notification settings - Fork 24
/
Makefile
124 lines (97 loc) · 2.91 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
PROJECT_DIR = $(abspath .)
EXTENSIONS_DIR = ${PROJECT_DIR}/fidimag/extensions
USER_EXTENSIONS_DIR = ${PROJECT_DIR}/fidimag/extensions/user
PYTHON = python3
PYTEST = ${PYTHON} -m pytest
#####################
# Cython Extensions #
#####################
build:
${PYTHON} setup.py build_ext --inplace -j2
clean:
rm -rf ${EXTENSIONS_DIR}/*
mkdir -p ${USER_EXTENSIONS_DIR}
touch ${EXTENSIONS_DIR}/__init__.py
touch ${USER_EXTENSIONS_DIR}/__init__.py
rm -rf build
docker:
docker build -t fidimag -f ./docker/travis/Dockerfile .
docker run -ti -d --name fidimag fidimag
#########
# Tests #
#########
test-docker:
docker exec fidimag make test-basic
#docker exec fidimag make test-without-run-oommf
#docker exec fidimag make test-ipynb
ipynb-docker:
while sleep 9m; do echo "===[ Still Running ]===\n"; done &
docker exec fidimag make test-ipynb
kill %1
travis-test: test-docker
docker exec fidimag make codecov
docker exec fidimag make test-ipynb
codecov:
bash <(curl -s https://codecov.io/bash)
codecov: SHELL:= /bin/bash
# or the recipe fails with /bin/sh complaining
# `/bin/sh: 1: Syntax error: "(" unexpected`.
# Quick tests, also not using OOMMF tests
test:
cd tests && ${PYTEST} -v -m "not slow and not run_oommf"
test-clean:
rm -rf neb*.ndt
rm -rf relax_npys
rm -rf relax.txt
rm -rf skx_number_*
rm -rf skx_num_*
rm -rf vtks
rm -rf spin.txt
rm -rf unnamed_npys
rm -rf unnamed.txt
rm -rf 2dpbc_tensors.npz
rm -rf 10spin.txt
rm -rf dyn_npys
rm -rf dyn_spin.txt
rm -rf dyn.txt
rm -rf dyn_vtks
rm -rf m0.npy
rm -rf skx_num.txt
rm -rf test_energy.txt
rm -rf unnamed_vtks
rm -rf dw_cobalt.txt
rm -rf mu_s.npy
rm -rf npys
rm -rf relax_vtks
rm -rf m1.npy
test2:
# like test, but run also outside the 'tests' directory.
# Doesn't work on Hans laptop.
${PYTEST} -v -m "not slow and not run_oommf"
test-all: create-dirs
${PYTEST} -v --junitxml=$(PROJECT_DIR)/test-reports/junit/test-pytest.xml
test-without-run-oommf: create-dirs
${PYTEST} -v -m "not run_oommf" --cov=fidimag --cov-report=html --junitxml=$(PROJECT_DIR)/test-reports/junit/test-pytest.xml
test-basic:
cd tests && ${PYTEST} -v
# Convenience name for commonly used quick running of tests
tq:
$(error This target 'tq' has been removed, please update the code calling this)
test-quick:
$(error This target 'test-quick' has been removed, please update the code calling this)
test-ipynb: create-dirs
cd doc/ipynb && ${PYTEST} . -v --current-env --nbval --sanitize-with sanitize_file --junitxml=$(PROJECT_DIR)/test-reports/junit/test-ipynb-pytest.xml
test-oommf:
${PYTEST} -v -m "oommf"
create-dirs:
mkdir -p test-reports/junit
#################
# Documentation #
#################
doc: doc-html doc-latexpdf doc-singlehtml
doc-clean:
make -C doc clean
doc-%:
@echo $*
make -C doc $*
.PHONY: extensions-directory build clean create-dirs test test-basic test-ipynb doc doc-clean doc-html doc-latexpdf doc-singlehtml docker test-docker travis codecov