forked from gimli-org/gimli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.jenkins.sh
94 lines (73 loc) · 2.79 KB
/
.jenkins.sh
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
# This script is for continuous integration using Jenkins (http://jenkins-ci.org/)
# It is called from the parent directory, i.e. bash -xe trunk/.jenkins.sh
echo "Starting automatic build #$BUILD_NUMBER on" `date`
start=$(date +"%s")
# Show last change to repo in build log
echo `git --git-dir trunk/.git log -1 --pretty="Last change by %cn (%h): %B"`
# link python to python3
ln -sf /usr/bin/python3 python
export PATH=`pwd`:$PATH
# Make polytools available (needed by mt.createCube for example)
export PATH="/var/lib/jenkins/workspace/pyBERT/build/bin/":$PATH
# Show system information
lsb_release -d
uname -a
gcc --version
cmake --version
python --version
python -c "import numpy; print(numpy.__version__)"
python -c "import matplotlib; print(matplotlib.__version__)"
# Check if core was changed
core_update=$(git --git-dir=trunk/.git diff --name-only $GIT_PREVIOUS_COMMIT $GIT_COMMIT | grep -c core/src || true)
# Set this to 1 if you want clean build (also of dependencies)
export CLEAN=0
export GIMLI_NUM_THREADS=4
################
# Main build #
################
# just do this if something is wrong with the thirdparty sources
#rm -rf thirdParty/src
#rm -rf build # Uncomment for clean build (expensive, but necessary sometimes)
rm -f build/build_tests.html # remove old test report
#rm -f build/CMakeCache.txt # clean old cache
mkdir -p build
cd build
if [ ! -f CMakeCache.txt ]; then
# Always rebuild core when Cmake cache does not exist
core_update=2
fi
if [[ $core_update -ge 1 ]]; then
echo "# Core changes detected. #"
touch CMakeCache.txt
cmake ../trunk \
-DPYVERSION=3 \
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
-DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.7m.so \
-DBoost_PYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libboost_python3-py37.so
make -j 8 gimli
make pygimli J=4
make gtest
else
echo "# No core changes detected. #"
fi
#############################
# Testing & documentation #
#############################
# Test pygimli
export PYTHONPATH=`pwd`/../trunk:$PYTHONPATH
OMP_THREAD_LIMIT=1 python -c "import pygimli; pygimli.test(show=False, abort=True, htmlreport=\"build_tests.html\")"
# Build documentation
# Setup for 3D visualizations
# ------------------------------------------------
export DISPLAY=:99.0
export PYVISTA_OFF_SCREEN=True
# ------------------------------------------------
make clean-gallery
make doc # = doxygen, sphinxapi, sphinxpdf, sphinxhtml
end=$(date +"%s")
echo "Ending automatic build #$BUILD_NUMBER".
diff=$(($end-$start))
echo "$(($diff / 60)) minutes and $(($diff % 60)) seconds elapsed."
# If this script fails, a mail with the log file will be send to [email protected].
# If it succeeds, the documentation will be uploaded to pygimli.org.
# In any case, a badge icon of the current status and the log file will be uploaded.