-
Notifications
You must be signed in to change notification settings - Fork 14
/
.travis.yml
153 lines (129 loc) · 4.64 KB
/
.travis.yml
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
dist: xenial
language: cpp
os:
- linux
- osx
env:
- MYUSEMC=true MYPYTHON_VERSION=2.7
- MYUSEMC=true MYPYTHON_VERSION=3.7
- MYUSEMC=false
matrix:
exclude:
- os: osx
env: MYUSEMC=true MYPYTHON_VERSION=2.7
git:
depth: 999999
branches:
except:
- /^v[0-9]/
before_install:
- MYNAME=libdiffpy
- MYCOMMIT="$(git rev-parse HEAD)"
# travis virtual hosts have 2 cores as per https://goo.gl/DQy4oW
- MYNCPU=2
- umask 022
- git fetch origin --tags
- NOSYS=true; NOAPT=true; NOBREW=true; NOMC=true
- if ${MYUSEMC}; then
NOMC=false;
elif [[ ${TRAVIS_OS_NAME} == linux ]]; then
NOAPT=false; NOSYS=false;
MYPIPFLAGS="--user";
elif [[ ${TRAVIS_OS_NAME} == osx ]]; then
NOBREW=false; NOSYS=false;
MYPIPFLAGS="--user";
fi
- MYMCREPO=https://repo.anaconda.com/miniconda
- case ${TRAVIS_OS_NAME} in
linux)
MYMCBUNDLE=Miniconda3-latest-Linux-x86_64.sh;
MYCXXCOMPILER=gxx_linux-64
;;
osx)
MYMCBUNDLE=Miniconda3-latest-MacOSX-x86_64.sh;
MYCXXCOMPILER=clangxx_osx-64
;;
*)
echo "Unsupported operating system." >&2;
exit 2 ;;
esac
- mkdir -p ~/pkgs
- $NOMC || pushd ~/pkgs
- $NOMC || wget --timestamping ${MYMCREPO}/${MYMCBUNDLE}
- $NOMC || test -x ~/mc/bin/conda || bash ${MYMCBUNDLE} -b -f -p ~/mc
- $NOMC || popd
- $NOMC || source ~/mc/bin/activate base
- $NOMC || conda update --yes conda
- $NOMC || conda install --yes conda-build conda-verify jinja2
- $NOMC || conda create --name=testenv --yes $MYCXXCOMPILER
- $NOMC || conda config --add channels diffpy
- $NOAPT || test "${TRAVIS_OS_NAME}" = "linux" || exit $?
- $NOAPT || sudo apt-get update -qq
- $NOAPT || sudo apt-get install -y
libgsl0-dev libboost-all-dev python-pip
build-essential scons cxxtest
- $NOBREW || test "${TRAVIS_OS_NAME}" = "osx" || exit $?
- $NOBREW || brew update
- $NOBREW || brew install gsl
- $NOBREW || brew install scons
- $NOBREW || brew install cxxtest
- $NOBREW || PATH="$(brew --prefix python)/libexec/bin:${PATH}"
- $NOBREW || export CXXTEST="$(brew --prefix cxxtest)"/libexec/bin/cxxtestgen
- $NOSYS || scons sdist
- $NOSYS || MYTARBUNDLE="$(ls -t "${PWD}"/*.tar.gz | head -1)"
- $NOSYS || pushd ~/pkgs
- $NOSYS || tar xzf "${MYTARBUNDLE}"
- $NOSYS || git clone https://github.com/diffpy/libobjcryst.git
- $NOSYS || popd
install:
- $NOMC || conda build --python=${MYPYTHON_VERSION} conda-recipe
- $NOMC || conda render --python=${MYPYTHON_VERSION} --output conda-recipe |
sed 's,.*/,,; s/[.]tar[.]bz2$//; s/-/=/g' > /tmp/mypackage.txt
- $NOMC || source activate base
- $NOMC || conda build purge
- $NOMC || source activate testenv
- $NOMC || conda install --yes --use-local --file=/tmp/mypackage.txt
- $NOMC || conda install --yes cxxtest scons
- $NOMC || MYPREFIX="${HOME}/mc/envs/testenv"
- MYSUDO=
- $NOAPT || MYSUDO=sudo
- $NOSYS || $MYSUDO scons -j $MYNCPU -C ~/pkgs/libobjcryst install
- $NOSYS || cd ~/pkgs/"$(basename "${MYTARBUNDLE}" .tar.gz)"
- $NOSYS || scons -j $MYNCPU build=fast lib
- $NOSYS || $MYSUDO scons build=fast install
- $NOSYS || scons -Q build=fast --clean lib
- $NOSYS || MYPREFIX=/usr/local
# Verify version of the installed library.
- MYINCLUDE="${MYPREFIX}/include"
- MYVERSION="${MYINCLUDE}/diffpy/version.hpp"
- MYGIT_REV=$(grep '^#define DIFFPY_GIT_SHA' "$MYVERSION" | cut -d '"' -f 2)
- if [[ "${MYCOMMIT}" != "${MYGIT_REV}" ]]; then
echo "Version mismatch ${MYCOMMIT} vs ${MYGIT_REV}.";
exit 1;
fi
- $NOMC || export MYPREFIX
# drop linker flags that spuriously remove linkage with libgslcblas
- $NOMC || LDFLAGS="${LDFLAGS/-Wl,-dead_strip_dylibs/}"
- $NOMC || cp .travis-sconscript.local sconscript.local
- scons -j $MYNCPU build=fast prefix="${MYPREFIX}" test_installed=true alltests
- MYALLTESTSFAST=$(ls -t ${PWD}/build/fast*/tests/alltests | head -1)
- scons -j $MYNCPU build=debug lib alltests
# APT and BREW jobs test builds from expanded source archive, but codecov
# requires compilation from a git repository. Tell scons to do so.
- scons -j $MYNCPU -C $TRAVIS_BUILD_DIR build=coverage lib alltests
before_script:
- $NOBREW || USER_BASE="$(python -c 'import site; print(site.USER_BASE)')"
- $NOBREW || PATH="${USER_BASE}/bin:${PATH}"
script:
- scons -Q build=debug test
- scons -Q build=debug enable_objcryst=false test
- ${MYALLTESTSFAST}
- scons -j $MYNCPU -C $TRAVIS_BUILD_DIR build=coverage test
after_success:
- cd $TRAVIS_BUILD_DIR
- pip install $MYPIPFLAGS codecov
- codecov
-
deploy:
- provider: releases
- draft: true