Appveyor:如何在 Windows 图像上 运行 2 个作业,而在 Linux 图像上只有一个?
Appveyor: how to run 2 jobs on Windows image and only one on Linux image?
我想在 Windows 和 Ubuntu 上测试我的 python 项目。幸运的是 Appveyor 已经支持这两个系统几个月了。
在 Windows 我曾经 运行 测试 32 位和 64 位 python 使用
配置环境矩阵
- 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 测试,但这是一个不太令人满意的技巧)。
确定可行,请检查 this 部分文档。在您的情况下,您可以去掉 image
部分并像这样设置矩阵:
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
我想在 Windows 和 Ubuntu 上测试我的 python 项目。幸运的是 Appveyor 已经支持这两个系统几个月了。
在 Windows 我曾经 运行 测试 32 位和 64 位 python 使用
配置环境矩阵 - 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 测试,但这是一个不太令人满意的技巧)。
确定可行,请检查 this 部分文档。在您的情况下,您可以去掉 image
部分并像这样设置矩阵:
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