-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
170 lines (154 loc) · 4.2 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# * conmech
# branches:
# only:
# except:
language: cpp
matrix:
include:
# pytest version conflict
# - name: "Python 2.7, gcc 4.8"
# os: linux
# dist: trusty
# env:
# - MATRIX_EVAL="export CONFIG=Release"
# - PYTHON=2.7 GCC=4.8
- name: "Python 3.6, gcc 4.8"
os: linux
dist: trusty
env:
- MATRIX_EVAL="export CONFIG=Release"
- PYTHON=3.6 GCC=4.8
addons:
apt:
sources:
- deadsnakes
packages:
- python3.6-dev
- python3.6-venv
- name: "Python 3.6, gcc 7"
os: linux
dist: xenial
env:
- MATRIX_EVAL="export CONFIG=Release"
- PYTHON=3.6 GCC=7
addons:
apt:
sources:
- deadsnakes
- ubuntu-toolchain-r-test
packages:
- g++-7
- python3.6-dev
- python3.6-venv
# pytest version conflict
# - name: "Python 2.7, AppleClang 7.3"
# os: osx
# osx_image: xcode7.3 # https://blog.travis-ci.com/2019-08-07-extensive-python-testing-on-travis-ci
# env:
# - MATRIX_EVAL="export CONFIG=Debug"
# - PYTHON=2.7 CLANG
- name: "Python 3.7, AppleClang 9.4"
os: osx
osx_image: xcode9.4 # https://blog.travis-ci.com/2019-08-07-extensive-python-testing-on-travis-ci
compiler: clang
env:
- MATRIX_EVAL="export CONFIG=Debug"
- PYTHON=3.7 CLANG
- name: "Python 3.7, AppleClang 10.2"
os: osx
osx_image: xcode10.2 # https://blog.travis-ci.com/2019-08-07-extensive-python-testing-on-travis-ci
compiler: clang
env:
- MATRIX_EVAL="export CONFIG=Debug"
- PYTHON=3.7 CLANG
cache:
directories:
- $HOME/.local/bin
- $HOME/.local/lib
- $HOME/.local/include
- $HOME/Library/Python
before_install:
- |
# Configure build variables
set -ex
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
if [ -n "$CLANG" ]; then
export CXX=clang++-$CLANG CC=clang-$CLANG
EXTRA_PACKAGES+=" clang-$CLANG llvm-$CLANG-dev"
else
if [ -z "$GCC" ]; then GCC=4.8
else EXTRA_PACKAGES+=" g++-$GCC"
fi
export CXX=g++-$GCC CC=gcc-$GCC
fi
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
export CXX=clang++ CC=clang;
fi
if [ "${PYTHON:0:1}" = "3" ]; then PY=3; fi
# if [ -n "$DEBUG" ]; then CMAKE_EXTRA_ARGS+=" -DCMAKE_BUILD_TYPE=Debug"; fi
set +ex
- |
# Initialize environment
set -ex
PY_CMD=python$PYTHON
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
if [ "$PY" = "3" ]; then
brew update && brew unlink python@2 && brew upgrade python
else
curl -fsSL https://bootstrap.pypa.io/get-pip.py | $PY_CMD - --user
fi
fi
if [ "$PY" = 3 ]; then
$PY_CMD -m ensurepip --user
fi
$PY_CMD --version
$PY_CMD -m pip install --user --upgrade pip wheel setuptools
set +ex
install:
- |
# Install dependencies
set -ex
cmake --version
echo "Installing pytest, numpy..."
$PY_CMD -m pip install --user --upgrade pytest numpy
echo "done."
set +ex
script:
# eval "${MATRIX_EVAL}"
# -DCMAKE_BUILD_TYPE=$CONFIG
- |
# CMake Configuration
mkdir build
cd build
cmake ..
make -j 2
ctest
cd ..
rm -rf build
- |
set -ex
# pip setup install and pytest
$PY_CMD setup.py sdist
$PY_CMD -m pip install --user -U ./dist/*
$PY_CMD -c "from _pystiffness_checker import _StiffnessChecker"
$PY_CMD -c "from pyconmech import StiffnessChecker"
set +ex
- |
set -ex
# pip install requirements
$PY_CMD -m pip install --no-cache-dir -r requirements-dev.txt
$PY_CMD -m pytest --cov=pyconmech tests
set +ex
after_success:
- coveralls
# pybind11 - cmake can't find the right python version if multiple versions exist
# https://github.com/libigl/libigl/blob/master/.travis.yml
# https://github.com/vgc/vgc/issues/42
# https://github.com/vgc/vgc/blob/master/.travis.yml
# https://github.com/pybind/pybind11/blob/master/.travis.yml
# reproduce travis ci failure locally with docker
# https://stackoverflow.com/questions/29753560/how-to-reproduce-a-travis-ci-build-environment-for-debugging
# https://gist.github.com/purp/0df77b579031127f10f31ebd202e8fd4
# TypeError: attrib() got an unexpected keyword argument 'convert'
# https://stackoverflow.com/questions/58189683/typeerror-attrib-got-an-unexpected-keyword-argument-convert
# set -ex https://www.peterbe.com/plog/set-ex