Search code examples
pythonmysqlsql-serverappveyor

Multiple combinations of Python and SQL Server on AppVeyor


How do I setup a AppVeyor build that runs multiple jobs with different combinations of SQL Server, MySQL and Python versions?

Let's say I want to run the following combinations:

  • SQL Server 2012 and Python 2.7
  • SQL Server 2012 and Python 3.4

  • SQL Server 2014 and Python 2.7
  • SQL Server 2014 and Python 3.4

  • SQL Server 2016 and Python 2.7
  • SQL Server 2016 and Python 3.6

  • MySQL 5.7 and Python 2.7
  • MySQL 5.7 and Python 3.6

How would I write my appveyor.yml file? This is what I have so far:

environment:

  matrix:

    # For Python versions available on Appveyor, see
    # http://www.appveyor.com/docs/installed-software#python

    - PYTHON: "C:\\Python27-x64"

    - PYTHON: "C:\\Python34-x64"
      DISTUTILS_USE_SDK: "1"

    - PYTHON: "C:\\Python36-x64"

services:
  - mysql
  - mssql2012sp1
  - mssql2014
  - mssql2016

platform:
  - x86

install:
  - "%PYTHON%\\python.exe -m pip install django==1.10"

test_script:
  - "%PYTHON%\\python.exe manage.py test"

Solution

  • Services are not supported dimensions for build matrix. Therefore you need to introduce environment variable for SQL server version and start it accordingly. This YAML should work:

    init:
    - cmd: net start %SQL%
    environment:
      matrix:
      - SQL: MSSQL$SQL2012SP1
        PYTHON: C:\\Python27-x64
      - SQL: MSSQL$SQL2012SP1
        PYTHON: C:\\Python34-x64
        DISTUTILS_USE_SDK: 1
      - SQL: MSSQL$SQL2014
        PYTHON: C:\\Python27-x64
      - SQL: MSSQL$SQL2014
        PYTHON: C:\\Python34-x64
        DISTUTILS_USE_SDK: 1
      - SQL: MSSQL$SQL2016
        PYTHON: C:\\Python27-x64
      - SQL: MSSQL$SQL2016
        PYTHON: C:\\Python36-x64
      - SQL: MySQL57
        PYTHON: C:\\Python27-x64
      - SQL: MySQL57
        PYTHON: C:\\Python36-x64