]> git.phdru.name Git - cookiecutter.git/commitdiff
Run tests at Travis CI and AppVeyor
authorOleg Broytman <phd@phdru.name>
Fri, 28 Apr 2017 04:05:26 +0000 (07:05 +0300)
committerOleg Broytman <phd@phdru.name>
Fri, 28 Apr 2017 04:05:26 +0000 (07:05 +0300)
project_template/.travis.yml [new file with mode: 0644]
project_template/appveyor.yml [new file with mode: 0644]
project_template/run_with_env.cmd [new file with mode: 0644]
project_template/tox.ini

diff --git a/project_template/.travis.yml b/project_template/.travis.yml
new file mode 100644 (file)
index 0000000..74a3fac
--- /dev/null
@@ -0,0 +1,36 @@
+# Config file for automatic testing at travis-ci.org
+
+# Only test maint, master and pull requests; skip tags.
+# Other branches can allow themselves.
+branches:
+  only:
+    - maint
+    - master
+
+# Prefer docker containers
+sudo: required
+
+language: python
+
+python:
+  - "3.6"
+
+cache: pip
+
+env:
+  - TOXENV=py27
+  - TOXENV=py33
+  - TOXENV=py34
+  - TOXENV=py35
+  - TOXENV=py36
+  - TOXENV=pypy
+
+matrix:
+  allow_failures:
+    - env: TOXENV=pypy
+
+install:
+  - travis_retry pip install tox
+
+script:
+  - tox
diff --git a/project_template/appveyor.yml b/project_template/appveyor.yml
new file mode 100644 (file)
index 0000000..6107a56
--- /dev/null
@@ -0,0 +1,92 @@
+# Test on windows
+# Heavily inspired by Oliver Grisel's appveyor-demo (https://github.com/ogrisel/python-appveyor-demo)
+version: '{branch}-{build}'
+
+# Only test maint, master and pull requests; skip tags.
+# Other branches can allow themselves.
+branches:
+  only:
+    - maint
+    - master
+skip_branch_with_pr: false
+skip_tags: true
+
+cache:
+  - '%LOCALAPPDATA%\pip\Cache'
+
+# Match travis
+clone_depth: 50
+
+environment:
+  global:
+    # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
+    # /E:ON and /V:ON options are not enabled in the batch script intepreter
+    # See: http://stackoverflow.com/a/13751649/163740
+    CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\run_with_env.cmd"
+
+  matrix:
+    - PYTHON_HOME: "C:\\Python27"
+      PYTHON_VERSION: "2.7"
+      PYTHON_ARCH: "32"
+      TOX_ENV: "py27"
+    - PYTHON_HOME: "C:\\Python27-x64"
+      PYTHON_VERSION: "2.7"
+      PYTHON_ARCH: "64"
+      TOX_ENV: "py27"
+    - PYTHON_HOME: "C:\\Python33"
+      PYTHON_VERSION: "3.3"
+      PYTHON_ARCH: "32"
+      TOX_ENV: "py33"
+    - PYTHON_HOME: "C:\\Python33-x64"
+      PYTHON_VERSION: "3.3"
+      PYTHON_ARCH: "64"
+      TOX_ENV: "py33"
+    - PYTHON_HOME: "C:\\Python34"
+      PYTHON_VERSION: "3.4"
+      PYTHON_ARCH: "32"
+      TOX_ENV: "py34"
+    - PYTHON_HOME: "C:\\Python34-x64"
+      PYTHON_VERSION: "3.4"
+      PYTHON_ARCH: "64"
+      TOX_ENV: "py34"
+    - PYTHON_HOME: "C:\\Python35"
+      PYTHON_VERSION: "3.5"
+      PYTHON_ARCH: "32"
+      TOX_ENV: "py35"
+    - PYTHON_HOME: "C:\\Python35-x64"
+      PYTHON_VERSION: "3.5"
+      PYTHON_ARCH: "64"
+      TOX_ENV: "py35"
+    - PYTHON_HOME: "C:\\Python36"
+      PYTHON_VERSION: "3.6"
+      PYTHON_ARCH: "32"
+      TOX_ENV: "py36"
+    - PYTHON_HOME: "C:\\Python36-x64"
+      PYTHON_VERSION: "3.6"
+      PYTHON_ARCH: "64"
+      TOX_ENV: "py36"
+
+install:
+  # Ensure we use the right python version
+  - "SET PATH=%PYTHON_HOME%;%PYTHON_HOME%\\Scripts;%PATH%"
+  - "SET TOXPYTHON=%PYTHON_HOME%\\python.exe"
+  - "python --version"
+  - "python -c \"import struct; print(struct.calcsize('P') * 8)\""
+  - "pip --version"
+  - "pip install tox"
+
+# No build step - _namemapper extension will be built under tox
+build: false
+
+test_script:
+  - "%CMD_IN_ENV% tox -e %TOX_ENV%"
+
+#after_test:
+#  # If tests are successful, create binary package
+#  - "pip install wheel"
+#  - "%CMD_IN_ENV% python setup.py bdist_wheel"
+#  - ps: "ls dist"
+#
+#artifacts:
+#  # Archive the generated packages in the ci.appveyor.com build report
+#  - path: dist\*
diff --git a/project_template/run_with_env.cmd b/project_template/run_with_env.cmd
new file mode 100644 (file)
index 0000000..5da547c
--- /dev/null
@@ -0,0 +1,88 @@
+:: To build extensions for 64 bit Python 3, we need to configure environment
+:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of:
+:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1)
+::
+:: To build extensions for 64 bit Python 2, we need to configure environment
+:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of:
+:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0)
+::
+:: 32 bit builds, and 64-bit builds for 3.5 and beyond, do not require specific
+:: environment configurations.
+::
+:: Note: this script needs to be run with the /E:ON and /V:ON flags for the
+:: cmd interpreter, at least for (SDK v7.0)
+::
+:: More details at:
+:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows
+:: http://stackoverflow.com/a/13751649/163740
+::
+:: Author: Olivier Grisel
+:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
+::
+:: Notes about batch files for Python people:
+::
+:: Quotes in values are literally part of the values:
+::      SET FOO="bar"
+:: FOO is now five characters long: " b a r "
+:: If you don't want quotes, don't include them on the right-hand side.
+::
+:: The CALL lines at the end of this file look redundant, but if you move them
+:: outside of the IF clauses, they do not run properly in the SET_SDK_64==Y
+:: case, I don't know why.
+@ECHO OFF
+
+SET COMMAND_TO_RUN=%*
+SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows
+SET WIN_WDK=c:\Program Files (x86)\Windows Kits\10\Include\wdf
+
+:: Extract the major and minor versions, and allow for the minor version to be
+:: more than 9.  This requires the version number to have two dots in it.
+SET MAJOR_PYTHON_VERSION=%PYTHON_VERSION:~0,1%
+IF "%PYTHON_VERSION:~3,1%" == "." (
+    SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,1%
+) ELSE (
+    SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,2%
+)
+
+:: Based on the Python version, determine what SDK version to use, and whether
+:: to set the SDK for 64-bit.
+IF %MAJOR_PYTHON_VERSION% == 2 (
+    SET WINDOWS_SDK_VERSION="v7.0"
+    SET SET_SDK_64=Y
+) ELSE (
+    IF %MAJOR_PYTHON_VERSION% == 3 (
+        SET WINDOWS_SDK_VERSION="v7.1"
+        IF %MINOR_PYTHON_VERSION% LEQ 4 (
+            SET SET_SDK_64=Y
+        ) ELSE (
+            SET SET_SDK_64=N
+            IF EXIST "%WIN_WDK%" (
+                :: See: https://connect.microsoft.com/VisualStudio/feedback/details/1610302/
+                REN "%WIN_WDK%" 0wdf
+            )
+        )
+    ) ELSE (
+        ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%"
+        EXIT 1
+    )
+)
+
+IF %PYTHON_ARCH% == 64 (
+    IF %SET_SDK_64% == Y (
+        ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture
+        SET DISTUTILS_USE_SDK=1
+        SET MSSdk=1
+        "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION%
+        "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release
+        ECHO Executing: %COMMAND_TO_RUN%
+        call %COMMAND_TO_RUN% || EXIT 1
+    ) ELSE (
+        ECHO Using default MSVC build environment for 64 bit architecture
+        ECHO Executing: %COMMAND_TO_RUN%
+        call %COMMAND_TO_RUN% || EXIT 1
+    )
+) ELSE (
+    ECHO Using default MSVC build environment for 32 bit architecture
+    ECHO Executing: %COMMAND_TO_RUN%
+    call %COMMAND_TO_RUN% || EXIT 1
+)
index 7ebfa923e5c7adfea20381b68c7083ff6990869e..6208a18ce9f14e046f7bd37de818e261d60e76e6 100644 (file)
@@ -5,6 +5,16 @@ envlist = {py26,py27,py33,py34,py35,py36},{py27,py36}-flake8
 
 # Base test environment settings
 [testenv]
+basepython =
+    py27: {env:TOXPYTHON:python2.7}
+    py33: {env:TOXPYTHON:python3.3}
+    py34: {env:TOXPYTHON:python3.4}
+    py35: {env:TOXPYTHON:python3.5}
+    py36: {env:TOXPYTHON:python3.6}
+    pypy: {env:TOXPYTHON:pypy}
+commands =
+    {envpython} --version
+    {envpython} -c "import struct; print(struct.calcsize('P') * 8)"
 deps =
     pytest
     pytest-cov
@@ -21,13 +31,19 @@ commands =
     python -m pytest --cov={project}
 
 [testenv:py26]
-commands = {[general]commands}
+commands =
+    {[testenv]commands}
+    {[general]commands}
 
 [testenv:py27]
-commands = {[general]commands}
+commands =
+    {[testenv]commands}
+    {[general]commands}
 
 [testenv:py34]
-commands = {[general]commands}
+commands =
+    {[testenv]commands}
+    {[general]commands}
 
 [testenv:py27-flake8]
 deps =