代码之家  ›  专栏  ›  技术社区  ›  zezollo

Appveyor:如何在Windows映像上运行两个作业,而在Linux映像上只运行一个作业?

  •  0
  • zezollo  · 技术社区  · 8 年前

    我想在Windows和Ubuntu上测试我的python项目。幸运的是Appveyor从几个月以来就支持这两个系统。

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

    PYTHON 变量将作业数增加一倍,我让Ubuntu作业运行两次,而不是只运行一次(而且,从不使用此变量) python 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测试,但这并不是一个真正令人满意的技巧)。

    1 回复  |  直到 8 年前
        1
  •  1
  •   Ilya Finkelsheyn    8 年前

    确定可行,请检查 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