1- # With infos from
1+ # With infos from
22# http://tjelvarolsson.com/blog/how-to-continuously-test-your-python-code-on-windows-using-appveyor/
33# https://packaging.python.org/en/latest/appveyor/
44# https://github.com/rmcgibbo/python-appveyor-conda-example
@@ -11,33 +11,31 @@ environment:
1111 # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
1212 # /E:ON and /V:ON options are not enabled in the batch script intepreter
1313 # See: http://stackoverflow.com/a/13751649/163740
14- CMD_IN_ENV : " cmd /E:ON /V:ON /C .\\ ci\\ appveyor\\ run_with_env.cmd"
14+ CMD_IN_ENV : " cmd /E:ON /V:ON /C obvci_appveyor_python_build_env.cmd"
15+ CONDA_INSTALL_LOCN : " C:\\ conda"
16+ # Workaround for https://github.com/conda/conda-build/issues/636
17+ PYTHONIOENCODING : " UTF-8"
1518
1619 matrix :
17- - PYTHON : " C:\\ Python34_64"
18- PYTHON_VERSION : " 3.4"
19- PYTHON_ARCH : " 64"
20- CONDA_PY : " 34"
21- CONDA_NPY : " 110"
22-
23- - PYTHON : " C:\\ Python35_64"
24- PYTHON_VERSION : " 3.5"
25- PYTHON_ARCH : " 64"
26- CONDA_PY : " 35"
27- CONDA_NPY : " 110"
28-
29- - PYTHON : " C:\\ Python27_64"
30- PYTHON_VERSION : " 2.7"
31- PYTHON_ARCH : " 64"
20+ # for testing purpose: numpy 1.8 on py2.7, for the rest use 1.10/latest
21+ - TARGET_ARCH : " x86"
3222 CONDA_PY : " 27"
3323 CONDA_NPY : " 18"
34-
35- - PYTHON : " C:\\ Python27_32"
3624 PYTHON_VERSION : " 2.7"
37- PYTHON_ARCH : " 32 "
25+ - TARGET_ARCH : " x64 "
3826 CONDA_PY : " 27"
3927 CONDA_NPY : " 18"
40-
28+ PYTHON_VERSION : " 2.7"
29+ - TARGET_ARCH : " x64"
30+ CONDA_PY : " 34"
31+ CONDA_NPY : " 110"
32+ PYTHON_VERSION : " 3.4"
33+ - TARGET_ARCH : " x64"
34+ CONDA_PY : " 35"
35+ CONDA_NPY : " 110"
36+ PYTHON_VERSION : " 3.5"
37+
38+
4139# We always use a 64-bit machine, but can build x86 distributions
4240# with the PYTHON_ARCH variable (which is used by CMD_IN_ENV).
4341platform :
@@ -47,25 +45,42 @@ platform:
4745build : false
4846
4947init :
50- - " ECHO %PYTHON_VERSION% %PYTHON %"
48+ - cmd : " ECHO %PYTHON_VERSION% %CONDA_INSTALL_LOCN %"
5149
5250install :
53- - powershell .\ci\appveyor\install.ps1
54- - SET PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%
51+ - appveyor DownloadFile "https://raw.githubusercontent.com/pelson/Obvious-CI/master/bootstrap-obvious-ci-and-miniconda.py"
52+ - cmd : python bootstrap-obvious-ci-and-miniconda.py %CONDA_INSTALL_LOCN% %TARGET_ARCH% %CONDA_PY:~0,1% --without-obvci
53+ - cmd : set PATH=%CONDA_INSTALL_LOCN%;%CONDA_INSTALL_LOCN%\scripts;%PATH%;
54+ - cmd : set PYTHONUNBUFFERED=1
55+ - cmd : conda install -c http://conda.anaconda.org/pelson/channel/development --yes --quiet obvious-ci
56+ - cmd : obvci_install_conda_build_tools.py
5557 - cmd : conda config --set show_channel_urls yes
5658 # for msinttypes
5759 - cmd : conda config --add channels conda-forge
5860 # this is now the downloaded conda...
5961 - conda info -a
60- # same things as in tools/conda_recipe
61- - cmd : conda create -y -q -n test-environment python=%PYTHON_VERSION% pip setuptools numpy python-dateutil freetype=2.5 msinttypes tk pyparsing pytz tornado libpng zlib pyqt cycler nose mock
62+
63+ # Fix the appveyor build environment to work with conda build
64+ # workaround for missing vcvars64.bat in py34 64bit
65+ - cmd : copy ci\appveyor\vcvars64.bat "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64"
66+ # workaround for conda build on py27 prefering the normal installed
67+ # VS tools instead of the also installed Py27 VS compiler (which wouldn't need this workarounds...)
68+ - cmd : copy "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat"
69+
70+ # same things as the requirements in ci/conda_recipe/meta.yaml
71+ - cmd : conda create -y -q -n test-environment python=%PYTHON_VERSION% pip setuptools numpy python-dateutil freetype msinttypes tk pyparsing pytz tornado libpng zlib pyqt cycler nose mock
6272 - activate test-environment
63- # This is needed for the installer to find the dlls...
73+ - cmd : echo %PYTHON_VERSION% %TARGET_ARCH%
74+ - cmd : IF %PYTHON_VERSION% == 2.7 conda install -y functools32
75+
76+ # Let the install prefer the static builds of the libs
6477 - set LIBRARY_LIB=%CONDA_DEFAULT_ENV%\Library\lib
6578 - cmd : ' mkdir lib || cmd /c "exit /b 0"'
66- - copy %LIBRARY_LIB%\zlibstatic.lib lib\z.lib
79+ - copy %LIBRARY_LIB%\zlibstatic.lib lib\z.lib
6780 - copy %LIBRARY_LIB%\libpng_static.lib lib\png.lib
6881 - set MPLBASEDIRLIST=%CONDA_DEFAULT_ENV%\Library\;.
82+ # enables the local freetype build
83+ - copy ci\travis\setup.cfg .
6984 # Show the installed packages + versions
7085 - conda list
7186
@@ -78,27 +93,39 @@ test_script:
7893
7994after_test :
8095 # After the tests were a success, build packages (wheels and conda)
81-
82- # There is a bug in wheels which prevents building wheels when the package uses namespaces
83- - cmd : ' %CMD_IN_ENV% python setup.py bdist_wheel'
84- # Note also that our setup.py script, which is called by conda-build, writes
85- # a __conda_version__.txt file, so the version number on the binary package
86- # is set dynamically. This unfortunately mean that conda build --output
87- # doesn't really work.
96+
97+ # Build the wheel
98+ # Hide the output, the copied files really clutter the build log...
99+ - cmd : ' %CMD_IN_ENV% python setup.py bdist_wheel > NUL:'
100+
101+ # And now the conda build after a cleanup...
102+ # cleanup build files so that they don't pollute the conda build but keep the wheel in dist...
103+ - cmd : git clean -d -x -f -e dist/
104+ # cleanup the environment so that the test-environment does not leak into the conda build...
105+ - cmd : set MPLBASEDIRLIST=
106+ - cmd : set LIBRARY_LIB=
107+ - cmd : deactivate
108+ - cmd : path
109+ - cmd : where python
88110 - cmd : ' %CMD_IN_ENV% conda config --get channels'
89- # we can't build conda packages on 27 due to missing functools32, which is a recent
90- # additional dependency for matplotlib
91- - cmd : if [%CONDA_PY%] NEQ [27] %CMD_IN_ENV% conda build .\ci\conda_recipe
111+ - cmd : ' %CMD_IN_ENV% conda build .\ci\conda_recipe'
112+
92113 # Move the conda package into the dist directory, to register it
93- # as an "artifact" for Appveyor.
94- - cmd : ' copy /Y %PYTHON%\conda-bld\win-32\*.bz2 dist || cmd /c "exit /b 0"'
95- - cmd : ' copy /Y %PYTHON%\conda-bld\win-64\*.bz2 dist || cmd /c "exit /b 0"'
96- - cmd : dir .\dist\
114+ # as an "artifact" for Appveyor.
115+ - cmd : ' copy /Y %CONDA_INSTALL_LOCN%\conda-bld\win-32\*.bz2 dist || cmd /c "exit /b 0"'
116+ - cmd : ' copy /Y %CONDA_INSTALL_LOCN%\conda-bld\win-64\*.bz2 dist || cmd /c "exit /b 0"'
117+ - cmd : dir dist\
118+ - cmd : echo finished...
97119
98120artifacts :
99121 - path : dist\*
100122 name : packages
101-
123+
102124 - path : result_images\*
103- name : test result images
125+ name : result_images
104126 type : zip
127+
128+ on_failure :
129+ - echo zipping images after a failure...
130+ - 7z a result_images.zip result_images\ >NUL :
131+ - appveyor PushArtifact result_images.zip
0 commit comments