Python Appveyor:如何在Windows映像上运行两个作业,而在Linux映像上仅运行一个作业?
我想在Windows和Ubuntu上测试我的python项目。幸运的是,Appveyor在几个月后就支持这两个系统 在Windows上,我曾经对32位和64位python运行一个测试,使用Python Appveyor:如何在Windows映像上运行两个作业,而在Linux映像上仅运行一个作业?,python,appveyor,Python,Appveyor,我想在Windows和Ubuntu上测试我的python项目。幸运的是,Appveyor在几个月后就支持这两个系统 在Windows上,我曾经对32位和64位python运行一个测试,使用 - PYTHON: "C:\\Python36" - PYTHON: "C:\\Python36-x64" 现在,如果我想为Ubuntu运行作业,因为这个PYTHON变量使作业数加倍,我让Ubuntu作业运行两次而不是一次(而且,从不使用这个PYTHON变量,这在Ubuntu上是无用的)。要
- PYTHON: "C:\\Python36"
- PYTHON: "C:\\Python36-x64"
现在,如果我想为Ubuntu运行作业,因为这个PYTHON
变量使作业数加倍,我让Ubuntu作业运行两次而不是一次(而且,从不使用这个PYTHON
变量,这在Ubuntu上是无用的)。要修复的appveyor.yml
摘录:
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"
我在文档中看到,使用诸如for:
或exclude
之类的关键字,有多种可能会将某些部件排除在运行之外,但无法正确使用它们
那么,有没有办法继续运行两个Windows作业和一个Ubuntu作业
(作为一种解决方法,我可能会删除32位python测试,但这不是一个真正令人满意的技巧)。如果确定它是可行的,请查看部分文档。在您的情况下,您可以去掉
图像
部分,并按如下方式设置矩阵:
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