Skip to content

Commit 92e088d

Browse files
committed
Add travis test for OSX and Native Linux.
Test for Python 2.6, 2.7 with Anaconda and native Linux packages.
1 parent 96cc1ff commit 92e088d

File tree

1 file changed

+72
-21
lines changed

1 file changed

+72
-21
lines changed

.travis.yml

Lines changed: 72 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,92 @@
11
# Use container-based travis workers
22
sudo: false
33

4-
language: python
4+
language: generic
55

6-
python:
7-
- 2.6
8-
- 2.7
9-
# - 3.3
10-
# - 3.4
11-
# - "3.5.0b4"
6+
os:
7+
- linux
8+
- osx
9+
10+
env:
11+
- MYUSEMC=true MYPYTHON_VERSION=2.6
12+
- MYUSEMC=true MYPYTHON_VERSION=2.7
13+
- MYUSEMC=false MYPYTHON_VERSION=2.6
14+
- MYUSEMC=false MYPYTHON_VERSION=2.7
15+
16+
matrix:
17+
exclude:
18+
- os: osx
19+
env: MYUSEMC=false MYPYTHON_VERSION=2.6
20+
- os: osx
21+
env: MYUSEMC=false MYPYTHON_VERSION=2.7
1222

1323
branches:
1424
except:
1525
- /^v[0-9]/
1626

27+
addons:
28+
apt:
29+
packages:
30+
- python-numpy
31+
- python-setuptools
32+
1733
before_install:
34+
- umask 022
35+
- git fetch origin --unshallow --tags
36+
- if ${MYUSEMC}; then
37+
NOAPT=true; NOMC=false;
38+
else
39+
NOAPT=false; NOMC=true;
40+
MYPIPFLAGS="--user";
41+
fi
1842
- MYMCREPO=https://repo.continuum.io/miniconda
19-
- MYMCBUNDLE=Miniconda-latest-Linux-x86_64.sh
43+
- case ${TRAVIS_OS_NAME} in
44+
linux)
45+
MYMCBUNDLE=Miniconda-latest-Linux-x86_64.sh ;;
46+
osx)
47+
MYMCBUNDLE=Miniconda-latest-MacOSX-x86_64.sh ;;
48+
*)
49+
echo "Unsupported operating system." >&2
50+
exit 2 ;;
51+
esac
52+
2053
- mkdir -p ~/pkgs/
21-
- pushd ~/pkgs/
22-
- wget --timestamping ${MYMCREPO}/${MYMCBUNDLE}
23-
- test -x ~/mc/bin/conda || bash ${MYMCBUNDLE} -b -f -p ~/mc
24-
- export PATH="${HOME}/mc/bin:${PATH}"
25-
- conda update conda --yes
26-
- conda remove --name=testenv --yes --offline --all
27-
- conda create --name=testenv --yes
28-
python=$TRAVIS_PYTHON_VERSION pip setuptools numpy coverage
29-
- source activate testenv
30-
- popd
54+
55+
- $NOMC || pushd ~/pkgs/
56+
- $NOMC || wget --timestamping ${MYMCREPO}/${MYMCBUNDLE}
57+
- $NOMC || test -x ~/mc/bin/conda || bash ${MYMCBUNDLE} -b -f -p ~/mc
58+
- $NOMC || popd
59+
- $NOMC || export PATH="${HOME}/mc/bin:${PATH}"
60+
- $NOMC || conda update --yes conda
61+
- $NOMC || conda install --yes conda-build jinja2
62+
- $NOMC || conda create --name=testenv --yes python=${MYPYTHON_VERSION} coverage
63+
64+
- $NOAPT || test "${TRAVIS_OS_NAME}" = "linux" || exit $?
65+
- $NOAPT || devutils/makesdist
66+
- $NOAPT || MYTARBUNDLE="$(ls -t "${PWD}"/dist/*.tar.gz | head -1)"
3167

3268
install:
33-
- git fetch origin --tags
34-
- python setup.py install
69+
- $NOMC || CONDA_PY=${MYPYTHON_VERSION} conda build conda-recipe
70+
- $NOMC || conda list --name=_test --export diffpy.utils > /tmp/mypackage.txt
71+
- $NOMC || source activate testenv
72+
- $NOMC || conda install --yes --use-local --file=/tmp/mypackage.txt
73+
74+
- $NOAPT || pip install $MYPIPFLAGS coverage
75+
- $NOAPT || easy_install --user "${MYTARBUNDLE}"
76+
77+
- cd
78+
- MYGIT_REV=$(python -c "import diffpy.utils.version as v; print(v.__gitsha__)")
79+
- if [[ "${TRAVIS_COMMIT}" != "${MYGIT_REV}" ]]; then
80+
echo "Version mismatch ${TRAVIS_COMMIT} vs ${MYGIT_REV}.";
81+
exit 1;
82+
fi
3583

3684
script:
3785
- coverage run --source diffpy.utils -m diffpy.utils.tests.run
3886

3987
after_success:
40-
- pip install codecov
88+
- pip install $MYPIPFLAGS codecov
89+
- $NOMC || if [[ "${MYPYTHON_VERSION}" == 2.6 ]]; then
90+
conda install --yes argparse;
91+
fi
4192
- codecov

0 commit comments

Comments
 (0)