Skip to content

Commit 998a2f4

Browse files
committed
CI: restore travis test with native Linux Python
1 parent cf945e9 commit 998a2f4

File tree

1 file changed

+33
-24
lines changed

1 file changed

+33
-24
lines changed

.travis.yml

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Use container-based travis workers
2-
sudo: false
3-
1+
dist: xenial
42
language: generic
53

64
os:
@@ -14,11 +12,6 @@ env:
1412
- MYUSEMC=true MYPYTHON_VERSION=3.7
1513
- MYUSEMC=false
1614

17-
matrix:
18-
exclude:
19-
- os: linux
20-
env: MYUSEMC=false
21-
2215
git:
2316
depth: 999999
2417

@@ -32,14 +25,20 @@ before_install:
3225
- MYCOMMIT="$(git rev-parse HEAD)"
3326
- umask 022
3427
- git fetch origin --tags
28+
- MYPYTHON=python; MYPIP=pip
29+
- NOSYS=true; NOAPT=true; NOBREW=true; NOMC=true
3530
- if ${MYUSEMC}; then
36-
NOBREW=true; NOMC=false;
37-
MYPIP=pip;
38-
else
39-
NOBREW=false; NOMC=true;
40-
MYPIP=pip3; MYPIPFLAGS="--user";
31+
NOMC=false;
32+
elif [[ ${TRAVIS_OS_NAME} == linux ]]; then
33+
NOAPT=false; NOSYS=false;
34+
MYPIPFLAGS="--user";
35+
elif [[ ${TRAVIS_OS_NAME} == osx ]]; then
36+
NOBREW=false; NOSYS=false;
37+
MYPYTHON=python3;
38+
MYPIP=pip3;
39+
MYPIPFLAGS="--user";
4140
fi
42-
- MYMCREPO=https://repo.continuum.io/miniconda
41+
- MYMCREPO=https://repo.anaconda.com/miniconda
4342
- case ${TRAVIS_OS_NAME} in
4443
linux)
4544
MYMCBUNDLE=Miniconda3-latest-Linux-x86_64.sh ;;
@@ -61,39 +60,49 @@ before_install:
6160
- $NOMC || popd
6261
- $NOMC || source ~/mc/bin/activate base
6362
- $NOMC || conda update --yes conda
64-
- $NOMC || conda install --yes conda-build jinja2
63+
- $NOMC || conda install --yes conda-build conda-verify jinja2
6564
- $NOMC || conda create --name=testenv --yes python=${MYPYTHON_VERSION} coverage
66-
# TODO - switch to the diffpy channel after release.
65+
- $NOMC || conda config --add channels diffpy
66+
# FIXME - keep just the "diffpy" channel for public release.
6767
- $NOMC || conda config --add channels diffpy/channel/dev
6868

69+
- $NOAPT || test "${TRAVIS_OS_NAME}" = "linux" || exit $?
70+
- $NOAPT || PATH="$(echo "$PATH" | sed 's,:/opt/pyenv/[^:]*,,g')"
71+
- $NOAPT || test "$(which python)" = "/usr/bin/python" || (
72+
which python; exit 1)
73+
- $NOAPT || sudo apt-get update -qq
74+
- $NOAPT || sudo apt-get install -y
75+
python-dev python-numpy python-setuptools build-essential
76+
6977
- $NOBREW || test "${TRAVIS_OS_NAME}" = "osx" || exit $?
7078
- $NOBREW || brew update
7179
- $NOBREW || brew upgrade python
7280
- $NOBREW || brew install gcc || brew link --overwrite gcc
73-
- $NOBREW || devutils/makesdist
74-
- $NOBREW || MYTARBUNDLE="$(ls -t "${PWD}"/dist/*.tar.gz | head -1)"
81+
82+
- $NOSYS || devutils/makesdist
83+
- $NOSYS || MYTARBUNDLE="$(ls -t "${PWD}"/dist/*.tar.gz | head -1)"
7584

7685

7786
install:
78-
- $NOMC || conda build conda-recipe
79-
- $NOMC || conda render --output conda-recipe |
87+
- $NOMC || conda build --python=${MYPYTHON_VERSION} conda-recipe
88+
- $NOMC || conda render --python=${MYPYTHON_VERSION} --output conda-recipe |
8089
sed 's,.*/,,; s/[.]tar[.]bz2$//; s/-/=/g' > /tmp/mypackage.txt
8190
- $NOMC || source activate testenv
8291
- $NOMC || conda install --yes --use-local --file=/tmp/mypackage.txt
8392

84-
- $NOBREW || $MYPIP install $MYPIPFLAGS coverage
85-
- $NOBREW || $MYPIP install $MYPIPFLAGS "${MYTARBUNDLE}"
93+
- $NOSYS || $MYPIP install $MYPIPFLAGS coverage
94+
- $NOSYS || $MYPIP install $MYPIPFLAGS "${MYTARBUNDLE}"
8695

8796
- cd ${MYRUNDIR}
88-
- MYGIT_REV=$(python3 -c "import ${MYNAME}.version as v; print(v.__git_commit__)")
97+
- MYGIT_REV=$($MYPYTHON -c "import ${MYNAME}.version as v; print(v.__git_commit__)")
8998
- if [[ "${MYCOMMIT}" != "${MYGIT_REV}" ]]; then
9099
echo "Version mismatch ${MYCOMMIT} vs ${MYGIT_REV}.";
91100
exit 1;
92101
fi
93102

94103

95104
before_script:
96-
- $NOBREW || USER_BASE="$(python3 -c 'import site; print(site.USER_BASE)')"
105+
- $NOBREW || USER_BASE="$($MYPYTHON -c 'import site; print(site.USER_BASE)')"
97106
- $NOBREW || PATH="${USER_BASE}/bin:${PATH}"
98107

99108

0 commit comments

Comments
 (0)