Skip to content

Commit 0bb7366

Browse files
committed
switch to pipenv and test python 3 on both linux and osx
1 parent 0e83343 commit 0bb7366

5 files changed

Lines changed: 336 additions & 49 deletions

File tree

.travis.yml

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -24,108 +24,112 @@ matrix:
2424
apt:
2525
sources: ['llvm-toolchain-precise-3.7', 'ubuntu-toolchain-r-test']
2626
packages: ['clang-3.7', 'gfortran', 'python-virtualenv']
27-
env: CXX_COMPILER='clang++-3.7' C_COMPILER='clang-3.7' Fortran_COMPILER='gfortran' BUILD_TYPE='release'
27+
env: CXX='clang++-3.7' CC='clang-3.7' FC='gfortran' BUILD_TYPE='release'
2828

2929
- os: linux
3030
compiler: clang
3131
addons: *clang37
32-
env: CXX_COMPILER='clang++-3.7' C_COMPILER='clang-3.7' Fortran_COMPILER='gfortran' BUILD_TYPE='debug'
32+
env: CXX='clang++-3.7' CC='clang-3.7' FC='gfortran' BUILD_TYPE='debug'
3333

3434
# 2/ Linux GCC Builds
35-
- os: linux
36-
compiler: gcc
37-
addons: &gcc49
38-
apt:
39-
sources: ['ubuntu-toolchain-r-test']
40-
packages: ['g++-4.9', 'gcc-4.9', 'gfortran-4.9', 'python-virtualenv']
41-
env: CXX_COMPILER='g++-4.9' C_COMPILER='gcc-4.9' Fortran_COMPILER='gfortran-4.9' BUILD_TYPE='release'
42-
43-
- os: linux
44-
compiler: gcc
45-
addons: *gcc49
46-
env: CXX_COMPILER='g++-4.9' C_COMPILER='gcc-4.9' Fortran_COMPILER='gfortran-4.9' BUILD_TYPE='debug' COVERAGE='true'
47-
4835
- os: linux
4936
compiler: gcc
5037
addons: &gcc5
5138
apt:
5239
sources: ['ubuntu-toolchain-r-test']
5340
packages: ['g++-5', 'gcc-5', 'gfortran-5', 'python-virtualenv']
54-
env: CXX_COMPILER='g++-5' C_COMPILER='gcc-5' Fortran_COMPILER='gfortran-5' BUILD_TYPE='release'
41+
env: CXX='g++-5' CC='gcc-5' FC='gfortran-5' BUILD_TYPE='release'
5542

5643
- os: linux
5744
compiler: gcc
5845
addons: *gcc5
59-
env: CXX_COMPILER='g++-5' C_COMPILER='gcc-5' Fortran_COMPILER='gfortran-5' BUILD_TYPE='debug'
46+
env: CXX='g++-5' CC='gcc-5' FC='gfortran-5' BUILD_TYPE='debug'
6047

6148
# 3/ OSX Clang Builds
6249
- os: osx
63-
osx_image: xcode7
50+
osx_image: xcode9.2
6451
compiler: clang
65-
env: CXX_COMPILER='clang++' C_COMPILER='clang' Fortran_COMPILER='gfortran' BUILD_TYPE='debug'
52+
env: CXX='clang++' CC='clang' FC='gfortran' BUILD_TYPE='debug'
6653

6754
- os: osx
68-
osx_image: xcode7
55+
osx_image: xcode9.2
6956
compiler: clang
70-
env: CXX_COMPILER='clang++' C_COMPILER='clang' Fortran_COMPILER='gfortran' BUILD_TYPE='release'
57+
env: CXX='clang++' CC='clang' FC='gfortran' BUILD_TYPE='release'
7158

7259
# 4/ OSX GCC5 Builds
7360
- os: osx
74-
osx_image: xcode7
61+
osx_image: xcode9.2
7562
compiler: gcc
76-
env: CXX_COMPILER='g++' C_COMPILER='gcc' Fortran_COMPILER='gfortran' BUILD_TYPE='debug'
63+
env: CXX='g++' CC='gcc' FC='gfortran' BUILD_TYPE='debug'
7764

7865
- os: osx
79-
osx_image: xcode7
66+
osx_image: xcode9.2
8067
compiler: gcc
81-
env: CXX_COMPILER='g++' C_COMPILER='gcc' Fortran_COMPILER='gfortran' BUILD_TYPE='release'
68+
env: CXX='g++' CC='gcc' FC='gfortran' BUILD_TYPE='release'
8269

8370
install:
8471
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
85-
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
72+
- mkdir -p ${DEPS_DIR}
73+
- cd ${DEPS_DIR}
8674
- |
8775
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
8876
cd ${TRAVIS_BUILD_DIR}
89-
virtualenv --python=python3 venv
90-
source venv/bin/activate
9177
curl https://cmake.org/files/v3.12/cmake-3.12.3-Linux-x86_64.tar.gz | tar xz
9278
export PATH=$PWD/cmake-3.12.3-Linux-x86_64/bin:$PATH
9379
export LD_LIBARY_PATH=$PWD/cmake-3.12.3-Linux-x86_64/lib:$LD_LIBRARY_PATH
80+
cd ${DEPS_DIR}
81+
curl -O https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz
82+
tar xf Python-3.6.6.tgz
83+
cd Python-3.6.6
84+
./configure --prefix=${DEPS_DIR}/python/
85+
make > /dev/null
86+
make install > /dev/null
87+
export PATH=${DEPS_DIR}/python/bin:$PATH
88+
export LD_LIBARY_PATH=${DEPS_DIR}/python/lib:$LD_LIBRARY_PATH
89+
pip install --user pipenv --upgrade
9490
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
9591
brew update &> /dev/null
9692
brew cask uninstall --force oclint
97-
brew install gcc python pyenv-virtualenv
93+
brew upgrade python
94+
brew install gcc pipenv
9895
brew upgrade cmake
9996
fi
10097
10198
before_script:
10299
- cd ${TRAVIS_BUILD_DIR}
103100
- |
104101
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
105-
pip install -r requirements.txt
102+
pipenv install --python=python3
106103
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
107-
pip2 install -r requirements.txt
104+
pipenv install --python=/usr/local/bin/python3
108105
fi
109106
- export PATH=$HOME/.local/bin:$PATH
110107
- |
111108
if [[ "${COVERAGE}" = true ]]; then
112-
./setup --cxx=${CXX_COMPILER} --cc=${C_COMPILER} --fc=${Fortran_COMPILER} --type=${BUILD_TYPE} --coverage
109+
./setup --fc=$FC --cc=$CC --cxx=$CXX --type=${BUILD_TYPE} --coverage
113110
else
114-
./setup --cxx=${CXX_COMPILER} --cc=${C_COMPILER} --fc=${Fortran_COMPILER} --type=${BUILD_TYPE}
111+
./setup --fc=$FC --cc=$CC --cxx=$CXX --type=${BUILD_TYPE}
115112
fi
116113
- cd build
117114

118115
script:
119116
- make -j 2
120117
- ctest -V -j 2
121118
- cd ..
122-
- pycodestyle --ignore=E501 test/test.py
119+
- pipenv run pycodestyle --ignore=E501 test/test.py
123120
- cd ${TRAVIS_BUILD_DIR}
124121
- mkdir test_python_interface
125122
- cp ${TRAVIS_BUILD_DIR}/test/test.py ${TRAVIS_BUILD_DIR}/test/reference_grid.txt test_python_interface
126123
- cd test_python_interface
127-
- pip install ${TRAVIS_BUILD_DIR}
128-
- pytest test.py
124+
- |
125+
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
126+
pipenv install ${TRAVIS_BUILD_DIR}
127+
pipenv run pytest test.py
128+
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
129+
pipenv install --python=/usr/local/bin/python3 ${TRAVIS_BUILD_DIR}
130+
pipenv install --python=/usr/local/bin/python3 pytest
131+
pipenv run pytest test.py
132+
fi
129133
130134
after_success:
131135
- cd ${TRAVIS_BUILD_DIR}/build

Pipfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
cffi = "*"
8+
pytest = "*"
9+
pycodestyle = "*"
10+
cpp-coveralls = "*"
11+
numpy = "*"
12+
PyYAML = "*"
13+
14+
[dev-packages]
15+
16+
[requires]
17+
python_version = "3.6"

0 commit comments

Comments
 (0)