8000 CI: add appveyor script and files for wheels · matplotlib/matplotlib@5c1da5a · GitHub
[go: up one dir, main page]

Skip to content

Commit 5c1da5a

Browse files
committed
CI: add appveyor script and files for wheels
When we release, we will want to build the Windows wheels as well.
1 parent 7bf436c commit 5c1da5a

File tree

12 files changed

+458
-0
lines changed

12 files changed

+458
-0
lines changed

appveyor.yml

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
# With infos from
2+
# http://tjelvarolsson.com/blog/how-to-continuously-test-your-python-code-on-windows-using-appveyor/
3+
# https://packaging.python.org/en/latest/appveyor/
4+
# https://github.com/rmcgibbo/python-appveyor-conda-example
5+
6+
# Backslashes in quotes need to be escaped: \ -> "\\"
7+
8+
environment:
9+
10+
global:
11+
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
12+
# /E:ON and /V:ON options are not enabled in the batch script intepreter
13+
# See: http://stackoverflow.com/a/13751649/163740
14+
CMD_IN_ENV: "cmd /E:ON /V:ON /C obvci_appveyor_python_build_env.cmd"
15+
# Workaround for https://github.com/conda/conda-build/issues/636
16+
PYTHONIOENCODING: "UTF-8"
17+
TEST_ARGS: --no-pep8
18+
PYTEST_ARGS: -ra --timeout=300 --durations=25 #--cov-report= --cov=lib #-n %NUMBER_OF_PROCESSORS%
19+
USE_PYTEST: no
20+
#PYTHONHASHSEED: 0 # Workaround for pytest-xdist flaky colletion order
21+
# # https://github.com/pytest-dev/pytest/issues/920
22+
# # https://github.com/pytest-dev/pytest/issues/1075
23+
24+
matrix:
25+
# for testing purpose: numpy 1.8 on py2.7, for the rest use 1.10/latest
26+
# theoretically the CONDA_INSTALL_LOCN could be only two: one for 32bit,
27+
# one for 64bit because we construct envs anyway. But using one for the
28+
# right python version is hopefully making it fast due to package caching.
29+
- TARGET_ARCH: "x64"
30+
CONDA_PY: "27"
31+
CONDA_NPY: "18"
32+
PYTHON_VERSION: "2.7"
33+
TEST_ALL: "no"
34+
CONDA_INSTALL_LOCN: "C:\\Miniconda-x64"
35+
- TARGET_ARCH: "x64"
36+
CONDA_PY: "34"
37+
CONDA_NPY: "110"
38+
PYTHON_VERSION: "3.4"
39+
TEST_ALL: "no"
40+
CONDA_INSTALL_LOCN: "C:\\Miniconda3-x64"
41+
- TARGET_ARCH: "x64"
42+
CONDA_PY: "35"
43+
CONDA_NPY: "110"
44+
PYTHON_VERSION: "3.5"
45+
TEST_ALL: "no"
46+
CONDA_INSTALL_LOCN: "C:\\Miniconda35-x64"
47+
- TARGET_ARCH: "x64"
48+
CONDA_PY: "35"
49+
CONDA_NPY: "110"
50+
PYTHON_VERSION: "3.5"
51+
TEST_ALL: "no"
52+
CONDA_INSTALL_LOCN: "C:\\Miniconda35-x64"
53+
USE_PYTEST: yes
54+
- TARGET_ARCH: "x86"
55+
CONDA_PY: "27"
56+
CONDA_NPY: "18"
57+
PYTHON_VERSION: "2.7"
58+
# this variable influence pdf/svg and most importantly the latex related tests
59+
# which triples the runtime of the tests (7-8min vs 30min).
60+
# pick the one which seems to make the most problems and run it last, so that
61+
# the rest of the tests can give feedback earlier
62+
TEST_ALL: "yes"
63+
CONDA_INSTALL_LOCN: "C:\\Miniconda"
64+
65+
# We always use a 64-bit machine, but can build x86 distributions
66+
# with the PYTHON_ARCH variable (which is used by CMD_IN_ENV).
67+
platform:
68+
- x64
69+
70+
# all our python builds have to happen in tests_script...
71+
build: false
72+
73+
init:
74+
- cmd: "ECHO %PYTHON_VERSION% PYTEST=%USE_PYTEST% %CONDA_INSTALL_LOCN%"
75+
76+
install:
77+
- cmd: set PATH=%CONDA_INSTALL_LOCN%;%CONDA_INSTALL_LOCN%\scripts;%PATH%;
78+
- cmd: set PYTHONUNBUFFERED=1
79+
# for obvci_appveyor_python_build_env.cmd
80+
- cmd: conda install -c pelson/channel/development --yes --quiet obvious-ci
81+
# for msinttypes and newer stuff
82+
- cmd: conda config --add channels conda-forge
83+
- cmd: conda config --set show_channel_urls yes
84+
- cmd: conda config --set always_yes true
85+
# For building conda packages
86+
- cmd: conda install --yes conda-build jinja2 anaconda-client
87+
# this is now the downloaded conda...
88+
- conda info -a
89+
90+
# Fix the appveyor build environment to work with conda build
91+
# workaround for missing vcvars64.bat in py34 64bit
92+
- cmd: copy ci\appveyor\vcvars64.bat "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64"
93+
94+
# For building, use a new environment which only includes the requirements for mpl
95+
# same things as the requirements in ci/conda_recipe/meta.yaml
96+
# if conda-forge gets a new pyqt, it might be nice to install it as well to have more backends
97+
# https://github.com/conda-forge/conda-forge.github.io/issues/157#issuecomment-223536381
98+
- conda create -q -n test-environment python=%PYTHON_VERSION%
99+
pip setuptools numpy python-dateutil freetype=2.6 msinttypes "tk=8.5"
100+
pyparsing pytz tornado "libpng>=1.6.21,<1.7" "zlib=1.2" "cycler>=0.10"
101+
nose mock sphinx
102+
- activate test-environment
103+
- cmd: echo %PYTHON_VERSION% %TARGET_ARCH%
104+
- cmd: IF %PYTHON_VERSION% == 2.7 conda install -q functools32
105+
# pytest-cov>=2.3.1 due to https://github.com/pytest-dev/pytest-cov/issues/124
106+
- if x%USE_PYTEST% == xyes conda install -q pytest "pytest-cov>=2.3.1" pytest-timeout #pytest-xdist
107+
108+
# Let the install prefer the static builds of the libs
109+
- set LIBRARY_LIB=%CONDA_PREFIX%\Library\lib
110+
- cmd: 'mkdir lib || cmd /c "exit /b 0"'
111+
- copy /Y %LIBRARY_LIB%\zlibstatic.lib lib\z.lib
112+
- copy /Y %LIBRARY_LIB%\libpng_static.lib lib\png.lib
113+
# These z.lib / png.lib are not static versions but files which end up as
114+
# dependencies to the dll file. This is fine for the conda build, but not here
115+
# and for the wheels
116+
- del %LIBRARY_LIB%\png.lib
117+
- del %LIBRARY_LIB%\z.lib
118+
- set MPLBASEDIRLIST=%CONDA_PREFIX%\Library\;.
119+
# enables the local freetype build
120+
- copy ci\travis\setup.cfg .
121+
# Show the installed packages + versions
122+
- conda list
123+
124+
test_script:
125+
# Now build the thing..
126+
- '%CMD_IN_ENV% python setup.py develop'
127+
# these should show no z, png, or freetype dll...
128+
- set "DUMPBIN=%VS140COMNTOOLS%\..\..\VC\bin\dumpbin.exe"
129+
#- cmd: '"%DUMPBIN%" /DEPENDENTS lib\matplotlib\_png*.pyd'
130+
#- cmd: '"%DUMPBIN%" /DEPENDENTS lib\matplotlib\ft2font*.pyd'
131+
- cmd: '"%DUMPBIN%" /DEPENDENTS lib\matplotlib\ft2font*.pyd | findstr freetype.*.dll && exit /b 1 || exit /b 0'
132+
- cmd: '"%DUMPBIN%" /DEPENDENTS lib\\matplotlib\\_png*.pyd | findstr z.*.dll && exit /b 1 || exit /b 0'
133+
- cmd: '"%DUMPBIN%" /DEPENDENTS lib\\matplotlib\\_png*.pyd | findstr png.*.dll && exit /b 1 || exit /b 0'
134+
135+
# this are optional dependencies so that we don't skip so many tests...
136+
- cmd: if x%TEST_ALL% == xyes; conda install -q pillow miktex inkscape
137+
# missing packages on conda-forge for ffmpeg avconv mencoder imagemagick
138+
- cmd: if x%TEST_ALL% == xyes; conda install -q -c menpo ffmpeg # a repackaged version
139+
# This install sometimes failed randomly :-(
140+
#- cmd: choco install imagemagick
141+
142+
# Test import of tkagg backend
143+
- python -c "import matplotlib as m; m.use('tkagg'); import matplotlib.pyplot as plt; print(plt.get_backend())"
144+
# tests
145+
- if x%USE_PYTEST% == xyes echo The following args are passed to pytest %PYTEST_ARGS%
146+
- if x%USE_PYTEST% == xyes py.test %PYTEST_ARGS% %TEST_ARGS%
147+
- if x%USE_PYTEST% == xno python tests.py %TEST_ARGS%
148+
# Generate a html for visual tests
149+
- python visual_tests.py
150+
151+
after_test:
152+
# After the tests were a success, build packages (wheels and conda)
153+
154+
# Build the wheel with the static libs
155+
# Hide the output, the copied files really clutter the build log...
156+
- cmd: '%CMD_IN_ENV% python setup.py bdist_wheel > NUL:'
157+
158+
# And now the conda build after a cleanup...
159+
# cleanup build files so that they don't pollute the conda build but keep the wheel in dist...
160+
- cmd: git clean -d -x -f -e dist/
161+
# cleanup the environment so that the test-environment does not leak into the conda build...
162+
- cmd: set MPLBASEDIRLIST=
163+
- cmd: set LIBRARY_LIB=
164+
- cmd: deactivate
165+
- cmd: path
166+
- cmd: where python
167+
- cmd: '%CMD_IN_ENV% conda config --get channels'
168+
- cmd: '%CMD_IN_ENV% conda build -q .\ci\conda_recipe'
169+
170+
# Move the conda package into the dist directory, to register it
171+
# as an "artifact" for Appveyor.
172+
- cmd: 'copy /Y %CONDA_INSTALL_LOCN%\conda-bld\win-32\*.bz2 dist || cmd /c "exit /b 0"'
173+
- cmd: 'copy /Y %CONDA_INSTALL_LOCN%\conda-bld\win-64\*.bz2 dist || cmd /c "exit /b 0"'
174+
- cmd: dir dist\
175+
- cmd: echo finished...
176+
177+
artifacts:
178+
- path: dist\*
179+
name: packages
180+
181+
- path: result_images\*
182+
name: result_images
183+
type: zip
184+
185+
on_failure:
186+
- python visual_tests.py
187+
- echo zipping images after a failure...
188+
- 7z a result_images.zip result_images\ |grep -v "Compressing"
189+
- appveyor PushArtifact result_images.zip

ci/appveyor/vcvars64.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64

ci/conda_recipe/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# conda package
2+
3+
Up to now, this is mainly used to build a test conda package on windows on appveyor.

ci/conda_recipe/bld.bat

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
set LIBPATH=%LIBRARY_LIB%;
2+
set INCLUDE=%INCLUDE%;%PREFIX%\Library\include\freetype2
3+
4+
ECHO [directories] > setup.cfg
5+
ECHO basedirlist = %LIBRARY_PREFIX% >> setup.cfg
6+
ECHO [packages] >> setup.cfg
7+
ECHO tests = False >> setup.cfg
8+
ECHO sample_data = False >> setup.cfg
9+
ECHO toolkits_tests = False >> setup.cfg
10+
11+
@rem workaround for https://github.com/matplotlib/matplotlib/issues/6460
12+
@rem see also https://github.com/conda-forge/libpng-feedstock/pull/4
13+
copy /y %LIBRARY_LIB%\libpng16.lib %LIBRARY_LIB%\png.lib
14+
15+
%PYTHON% setup.py install --single-version-externally-managed --record=record.txt
16+
if errorlevel 1 exit 1

ci/conda_recipe/build.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
if [ `uname` == Linux ]; then
4+
pushd $PREFIX/lib
5+
ln -s libtcl8.5.so libtcl.so
6+
ln -s libtk8.5.so libtk.so
7+
popd
8+
fi
9+
10+
cat <<EOF > setup.cfg
11+
[directories]
12+
basedirlist = $PREFIX
13+
14+
[packages]
15+
tests = False
16+
toolkit_tests = False
17+
sample_data = False
18+
19+
EOF
20+
21+
# The macosx backend isn't building with conda at this stage.
22+
if [ `uname` == Darwin ]; then
23+
cat << EOF >> setup.cfg
24+
25+
[gui_support]
26+
tkagg = true
27+
macosx = false
28+
29+
EOF
30+
fi
31+
32+
cat setup.cfg
33+
sed -i.bak "s|/usr/local|$PREFIX|" setupext.py
34+
35+
36+
$PYTHON setup.py install --single-version-externally-managed --record=record.txt
37+

ci/conda_recipe/cfg_qt4agg.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git setup.cfg.template setup.cfg.template
2+
index cae6f67..fd11c79 100644
3+
--- setup.cfg.template
4+
+++ setup.cfg.template
5+
@@ -88,7 +88,7 @@
6+
# if you have disabled the relevent extension modules. Agg will be used
7+
# by default.
8+
#
9+
-#backend = Agg
10+
+backend = Qt4Agg
11+
#
12+
13+
[package_data]

ci/conda_recipe/condaversion.patch

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git setup.py setup.py
2+
index 8af8b6d..4e4f9d2 100644
3+
--- setup.py
4+
+++ setup.py
5+
@@ -57,6 +57,9 @@
6+
import versioneer
7+
__version__ = versioneer.get_version()
8+
9+
+# For conda builds...
10+
+with open("__conda_version__.txt", "w") as f:
11+
+ f.write(__version__)
12+
13+
# These are the packages in the order we want to display them. This
14+
# list may contain strings to create section headers for the display.
15+

ci/conda_recipe/meta.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Full credit goes to https://github.com/conda/conda-recipes for providing this recipe.
2+
# It has been subsequently adapted for automated building with conda-forge and matplotlib.
3+
4+
package:
5+
name: matplotlib
6+
version: 1.9.9
7+
8+
source:
9+
path: ../../
10+
11+
patches:
12+
# A patch to make Qt4Agg the default backend.
13+
- cfg_qt4agg.patch # [linux]
14+
# Patches the matplotlibrc template to default to Qt4.
15+
- rctmp_pyside.patch # [not osx]
16+
# dynamic version from git
17+
# we can't use condas usual dynamic versions as setup.py uses
18+
# multiprocessing during the configure stage and this seems to confuse conda-build.
19+
# https://github.com/conda/conda-build/issues/1061
20+
- condaversion.patch
21+
22+
23+
requirements:
24+
build:
25+
- python
26+
- setuptools
27+
- pkg-config # [not win]
28+
- numpy x.x
29+
- python-dateutil
30+
- freetype 2.6*
31+
- msinttypes # [win]
32+
- cycler >=0.10
33+
- nose
34+
- pyparsing
35+
- pytz
36+
# - py2cairo # [linux and py2k]
37+
- tornado
38+
- libpng >=1.6.21,<1.7
39+
- zlib 1.2* # [win]
40+
- pyqt # [not osx]
41+
- tk 8.5* # [linux]
42+
- functools32 # [py2k]
43+
44+
run:
45+
- python
46+
- numpy x.x
47+
- cycler >=0.10
48+
- python-dateutil
49+
- freetype 2.6*
50+
- pytz
51+
- pyparsing
52+
# - py2cairo # [linux and py2k]
53+
- libpng >=1.6.21,<1.7
54+
- pyqt # [not osx]
55+
- tk 8.5* # [linux and win]
56+
- functools32 # [py2k]
57+
58+
test:
59+
imports:
60+
- matplotlib
61+
- matplotlib.pyplot
62+
63+
about:
64+
home: http://matplotlib.org/
65+
license: PSF-based (http://matplotlib.org/users/license.html)
66+
summary: Publication quality figures in Python
67+
68+
extra:
69+
recipe-maintainers:
70+
- janschulz # only in the mpl repository
71+
- mdboom # rest form conda-forge
72+
- ocefpaf
73+
- pelson
74+
- tacaswell

0 commit comments

Comments
 (0)
0