I want to test my python project on both Windows and Ubuntu. Fortunately Appveyor supports both systems since several months.
On Windows I used to run a test for 32 bits and 64 bits python configuring the environment matrix with
- PYTHON: "C:\\Python36"
- PYTHON: "C:\\Python36-x64"
Now if I want to run jobs for Ubuntu, as this PYTHON
variable doubles the jobs number, I get the Ubuntu job running two times instead of only once (moreover, never using this PYTHON
variable, what's useless on Ubuntu). Excerpt of appveyor.yml
to fix:
version: build{build}
branches:
only:
- master
- pre-release
- dev
image:
- Visual Studio 2015
- Ubuntu1804
max_jobs: 1
environment:
matrix:
# For Python versions available on Appveyor, see
# https://www.appveyor.com/docs/windows-images-software/#python
# https://www.appveyor.com/docs/linux-images-software#python
- PYTHON: "C:\\Python36"
- PYTHON: "C:\\Python36-x64"
install:
# We need wheel installed to build wheels
- cmd: "%PYTHON%\\python.exe -m pip install wheel pytest"
- sh: "pip install wheel pytest"
build: off
test_script:
# Note that you must use the environment variable %PYTHON% to refer to
# the interpreter you're using - Appveyor does not do anything special
# to put the Python version you want to use on PATH.
- cmd: "%PYTHON%\\python.exe setup.py test"
- sh: "python setup.py test"
I have seen in the doc there is a variety of possibilities to exclude some parts from being run using keywords like for:
or exclude
but can't figure out how to use them correctly.
So, is there a way to still run the two Windows jobs and only one Ubuntu job?
(as a workaround I could remove the 32 bit python test maybe but this is a not really satisfying trick).
Sure it is doable, please check this part of docs. In your case you can get rid of image
section and set up matrix like this:
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
PYTHON: "C:\\Python36"
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
PYTHON: "C:\\Python36-x64"
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu1804