forked from gevent/gevent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
318 lines (282 loc) · 12.7 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# .travis.yml based on
# https://github.com/DRMacIver/hypothesis/blob/master/.travis.yml
# Setting the language to C overrides our CC environment variable
# and disables ccache.
# Setting it to python overrides our TRAVIS_PYTHON_VERSION (which
# we're only using in hopes of being able to go *back* to using
# python: one day so making the migration simpler)
language: minimal
dist: xenial
group: travis_latest
env:
global:
- BUILD_RUNTIMES=$HOME/.runtimes
- PYTHONHASHSEED=8675309
- PIP_UPGRADE_STRATEGY=eager
- CC="ccache gcc"
- CCACHE_NOCPP2=true
- CCACHE_SLOPPINESS=file_macro,time_macros,include_file_ctime,include_file_mtime
- CCACHE_NOHASHDIR=true
- BUILD_LIBS=$HOME/.libs
- GEVENTSETUP_EV_VERIFY=2
# Disable some warnings produced by libev especially and also some Cython generated code.
# Note that changing the value of these variables invalidates configure caches
- CFLAGS="-g -pipe -Wno-strict-aliasing -Wno-comment"
- CPPFLAGS="-I$BUILD_LIBS/include -DEV_VERIFY=3"
- LDFLAGS="-L$BUILD_LIBS/lib"
- LD_LIBRARY_PATH="$BUILD_LIBS/lib"
# Note that this list is again *manually* expanded
# for the 'cache' stage. The benefit of doing this (instead of
# only listing a single version here, or using a different 'language')
# is that we get separate caches per version. This keeps them small,
# and prevents stepping on each other when we change Python minor
# versions.
# We do it here, rather than with the python: keyword
# because the way travis handles pypy is pretty messed up.
# Recall that unless otherwise specified, jobs inherit
# the first entry in this list.
matrix:
- TRAVIS_PYTHON_VERSION=2.7
- TRAVIS_PYTHON_VERSION=3.5
- TRAVIS_PYTHON_VERSION=3.6
- TRAVIS_PYTHON_VERSION=3.7
- TRAVIS_PYTHON_VERSION=3.8
- TRAVIS_PYTHON_VERSION=pypy2.7
- TRAVIS_PYTHON_VERSION=pypy3.6
- TRAVIS_PYTHON_VERSION=2.7 GEVENTSETUP_EMBED=0 GEVENTSETUP_EV_VERIFY=3
matrix:
fast_finish: true
before_install:
- export PATH=$BUILD_RUNTIMES/snakepit/$TRAVIS_PYTHON_VERSION.d/bin:$PATH
- export G_SITE=$BUILD_RUNTIMES/snakepit/$TRAVIS_PYTHON_VERSION.d/lib/*/site-packages/
# Restore the configure caches
- if [ -f $BUILD_LIBS/config.cache.ares ]; then cp $BUILD_LIBS/config.cache.ares deps/c-ares/config.cache ; fi
- if [ -f $BUILD_LIBS/config.cache.libev ]; then cp $BUILD_LIBS/config.cache.libev deps/libev/config.cache ; fi
- if [ -f $BUILD_LIBS/config.cache.libuv ]; then cp $BUILD_LIBS/config.cache.libuv deps/libuv/config.cache ; fi
before_script:
# Show some details of interest
- python --version
- >
python -c "import greenlet; print(greenlet, greenlet.__version__)"
- >
python -c "import gevent.core; print(gevent.core.loop)"
- >
python -c "import gevent.ares; print(gevent.ares)"
cache:
pip: true
directories:
- $HOME/.venv
- $HOME/.runtimes
- $HOME/.wheelhouse
- $HOME/.ccache
- $HOME/.libs
before_cache:
- rm -f $HOME/.cache/pip/log/debug.log
# Store the configure caches. Having a cache can speed up c-ares
# configure from 2-3 minutes to 20 seconds.
- mkdir -p $BUILD_LIBS
- cp deps/c-ares/config.cache $BUILD_LIBS/config.cache.ares
- cp deps/libev/config.cache $BUILD_LIBS/config.cache.libev
- cp deps/libuv/config.cache $BUILD_LIBS/config.cache.libuv
# Installing is taken care of by the first stage.
install:
- ls -l $BUILD_RUNTIMES/snakepit/
- echo $BUILD_RUNTIMES/snakepit/$TRAVIS_PYTHON_VERSION.d
- ls -l $BUILD_RUNTIMES/snakepit/$TRAVIS_PYTHON_VERSION.d
- python -c 'import gevent; print(gevent.__version__)'
script:
# The generic script for the matrix expansion is to
# test the defaults.
- &test-basic python -m gevent.tests
# Now, the non-default threaded file object.
# In the past, we included all test files that had a reference to 'subprocess'' somewhere in their
# text. The monkey-patched stdlib tests were specifically included here.
# However, we now always also test on AppVeyor (Windows) which only has GEVENT_FILE=thread,
# so we can save a lot of CI time by reducing the set and excluding the stdlib tests without
# losing any coverage. Which is good, because coverage fails when run this way.
- (cd src/gevent/tests && GEVENT_FILE=thread python -mgevent.tests test__*subprocess*.py)
# Submit coverage info
after_success:
- python -m coverage combine
- python -m coverage report -i
- python -m coveralls
stages:
- build-gevent
- test
- test-ares
jobs:
include:
- &build-gevent
stage: build-gevent
install:
# Install the Python runtime
- &build-gevent-python time ./scripts/install.sh $TRAVIS_PYTHON_VERSION
# Install gevent. Yes, this will create different files each time,
# leading to a fresh cache. But because of CCache stats, we had already been doing
# that (before we learned about CCACHE_NOSTATS).
# We don't install using the requirements file for speed (reduced deps) and because an editable
# install doesn't work in the cache.
# First, the build dependencies (see setup.cfg)
# so that we don't have to use build isolation and can better use the cache;
# Note that we can't use -U for cffi and greenlet on PyPy.
- &build-gevent-deps pip install -U setuptools wheel && pip install -U 'cffi;platform_python_implementation=="CPython"' cython 'greenlet;platform_python_implementation=="CPython"'
# Next, build the wheel *in place*. This helps ccache, and also lets us cache the configure
# output (pip install uses a random temporary directory, making this difficult)
- python setup.py bdist_wheel
- pip uninstall -y gevent
- pip install -U --no-compile `ls dist/*whl`[test]
script: ccache -s
before_script: true
after_success: true
- <<: *build-gevent
env: TRAVIS_PYTHON_VERSION=3.8
- <<: *build-gevent
env: TRAVIS_PYTHON_VERSION=3.5
- <<: *build-gevent
env: TRAVIS_PYTHON_VERSION=3.6
- <<: *build-gevent
env: TRAVIS_PYTHON_VERSION=3.7
- <<: *build-gevent
env: TRAVIS_PYTHON_VERSION=pypy2.7
- <<: *build-gevent
env: TRAVIS_PYTHON_VERSION=pypy3.6
- <<: *build-gevent
env: TRAVIS_PYTHON_VERSION=2.7 GEVENTSETUP_EMBED=0 GEVENTSETUP_EV_VERIFY=3
install:
# Install the Python runtime
- *build-gevent-python
- *build-gevent-deps
# Install the C dependencies to a known location. This is used
# to test 'no embed' cases. It might seem like it would prime
# the CCache for when we *do* embed if we did it as part of
# the generic build stage, but overall it just seems to slow
# things down. The Travis caching and CCache is not working as
# well as we would hope. (XXX: Probably because in the past we
# used pip install which used temporary directories.)
- pushd deps/libev && ./configure -C --prefix=$BUILD_LIBS && make install && popd
- pushd deps/c-ares && ./configure -C --prefix=$BUILD_LIBS && make -j4 install && popd
- pushd deps/libuv && ./autogen.sh && ./configure -C --disable-static --prefix=$BUILD_LIBS && make -j4 install && popd
# libev builds a manpage each time, and it includes today's date, so it frequently changes.
# delete to avoid repacking the archive
- rm -rf $BUILD_LIBS/share/man/
- ls -l $BUILD_LIBS $BUILD_LIBS/lib $BUILD_LIBS/include
- python setup.py bdist_wheel
- pip uninstall -y gevent
- pip install -U `ls dist/*whl`[test]
# Test that we're actually linking
# to the .so file.
- objdump -p $G_SITE/gevent/libev/_corecffi*so | grep "NEEDED.*libev.so"
- objdump -p $G_SITE/gevent/libev/corecext*so | grep "NEEDED.*libev.so"
- objdump -p $G_SITE/gevent/libuv/_corecffi*so | grep "NEEDED.*libuv.so"
script:
# Verify that we got non-embedded builds
- python -c 'import gevent.libev.corecffi as CF; assert not CF.LIBEV_EMBED'
- python -c 'import gevent.libuv.loop as CF; assert not CF.libuv.LIBUV_EMBED'
# Ok, now we switch to the test stage. These are all in addition
# to the jobs created by the matrix (and should override the `script` command).
# Lint the code. Because this is a separate job, even if it fails fast
# the tests will still run. Put it at the top for fast feedback.
# We only need to do this on one version, and it should be Python 3, because
# pylint has stopped updating for Python 2.
- stage: test
# We need pylint, since above we're not installing a
# requirements file.
install: pip install pylint
script: python -m pylint --limit-inference-results=1 --rcfile=.pylintrc gevent
env: TRAVIS_PYTHON_VERSION=3.7
name: lint37
# Now the various functional test groups.
# We organize these by interpreter, rather than functional test group,
# so that it's easy to see which interpreters are in which group.
# First, default (cpython 2.7). This tests essentially all the groups.
# Test the c-ares resolver. It's implemented in C, so don't bother with coverage.
# Also, we don't support it on PyPy for production, so don't bother to test PyPy.
- &test-ares-jobs
stage: test
script: GEVENT_RESOLVER=ares python -mgevent.tests --ignore tests_that_dont_use_resolver.txt
name: ares27
# Run dnspython with coverage enabled, it's implemented in python whereas ares is C.
# PyPy is supported.
- &test-dnspython-jobs
script: GEVENT_RESOLVER=dnspython python -mgevent.tests --coverage --ignore tests_that_dont_use_resolver.txt
name: dnspython27
# Now test the alternate backends, starting with libuv-cffi, which should be present everywhere
- &test-libuv-jobs
script: GEVENT_LOOP=libuv python -mgevent.tests --coverage
name: libuv27
# Next the libev-cffi backend, which is only needed on CPython (default on PyPy)
- &test-libev-jobs
script: GEVENT_LOOP=libev-cffi python -mgevent.tests --coverage
name: libev-cffi27
# No compiled cython modules on CPython, using the default backend. Get coverage here.
# We should only need to run this for a single Python 2 and a Python 3
- &test-pure-jobs
script: PURE_PYTHON=1 python -mgevent.tests --coverage
name: pure27
# Run the leaktests; this seems to be extremely slow on Python 3.7
# XXX: Figure out why. Can we reproduce locally?
- &test-leak-jobs
script: GEVENTTEST_LEAKCHECK=1 python -m gevent.tests --ignore tests_that_dont_do_leakchecks.txt
name: leak27
# Now, in order of the matrix, tests for particular versions.
# For the CPython interpreters, unless we have reason to expect
# different behaviour across the versions (e.g., as measured by coverage)
# it's sufficient to test the alternate backend library for non-current versions;
# run the full suite on the current version.
# 3.5.
- <<: *test-libuv-jobs
env: TRAVIS_PYTHON_VERSION=3.5
name: libuv35
# 3.6
- <<: *test-libuv-jobs
env: TRAVIS_PYTHON_VERSION=3.6
name: libuv36
# 3.7
- <<: *test-ares-jobs
env: TRAVIS_PYTHON_VERSION=3.7
name: ares37
- <<: *test-dnspython-jobs
env: TRAVIS_PYTHON_VERSION=3.7
name: dnspython37
- <<: *test-libuv-jobs
env: TRAVIS_PYTHON_VERSION=3.7
name: libuv37
- <<: *test-pure-jobs
env: TRAVIS_PYTHON_VERSION=3.7
name: pure37
# 3.8
- <<: *test-libuv-jobs
env: TRAVIS_PYTHON_VERSION=3.8
name: libuv38
- <<: *test-libev-jobs
env: TRAVIS_PYTHON_VERSION=3.8
name: libev-cffi38
# 2.7, no-embed. Run the tests that exercise the libraries we
# linked to.
- <<: *test-ares-jobs
# This job exercises both the non-embedded ares resolver
# and the non-embedded Cython libev loop.
env: TRAVIS_PYTHON_VERSION=2.7 GEVENTSETUP_EMBED=0 GEVENTSETUP_EV_VERIFY=3
name: ares27-noembed
# These exercise the CFFI versions.
- <<: *test-libuv-jobs
env: TRAVIS_PYTHON_VERSION=2.7 GEVENTSETUP_EMBED=0 GEVENTSETUP_EV_VERIFY=3
name: libuv27-noembed
- <<: *test-libev-jobs
env: TRAVIS_PYTHON_VERSION=2.7 GEVENTSETUP_EMBED=0 GEVENTSETUP_EV_VERIFY=3
name: libev27-noembed
# PyPy 2.7
- <<: *test-dnspython-jobs
env: TRAVIS_PYTHON_VERSION=pypy2.7
name: dnspythonpypy27
- <<: *test-libuv-jobs
env: TRAVIS_PYTHON_VERSION=pypy2.7
name: libuvpypy27
# PyPy 3.6
# We don't do particular extra tests on it, it's not
# considered a production (still alpha at this writing).
# - <<: *test-dnspython-jobs
# env: TRAVIS_PYTHON_VERSION=pypy3.6
# name: dnspythonpypy36
notifications:
email: false