【问题标题】:How to set build configuration-dependent variable in AppVeyor如何在 AppVeyor 中设置构建配置依赖变量
【发布时间】:2017-09-08 11:40:43
【问题描述】:

对于 Visual Studio 的调试构建配置,我想从 CTest 中排除某些测试。我的想法是做类似的事情

matrix:
  - configuration: Release
    environment:
      EXCLUDETESTS: ""
  - configuration: Debug
    environment:
      EXCLUDETESTS: "solver"

为每个配置创建一个名为 EXCLUDETESTS 的相应字符串环境变量。 但这给了我Error parsing appveyor.yml: "matrix" section must be a mapping. (Line: 15, Column: 3),尽管根据http://yaml-online-parser.appspot.com/,语法应该没问题

完整的appveyor.yml 文件读取

version: "{build}"

os:
  - Visual Studio 2017
  - Visual Studio 2015

# x64 is a CMake-compatible solution platform name.
# This allows us to pass %PLATFORM% to CMake -A.
platform:
  - x64

# Build Configurations, i.e. Debug, Release, etc.
# EXCLUDETESTS determines which tests will not be run
matrix:
  - configuration: Release
    environment:
      EXCLUDETESTS: ""
  - configuration: Debug
    environment:
      EXCLUDETESTS: "solver"

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

# Cmake will autodetect the compiler, but we set the arch
before_build:
  - set PATH=%PYTHON%;%PATH%
  - set CXXFLAGS=%additional_flags%
  - cmake -H. -BBuild -A%PLATFORM% -DUI_CXX_USE_QT=OFF

# Build with MSBuild
build:
  project: Build\spirit.sln # path to Visual Studio solution or project
  parallel: true            # enable MSBuild parallel builds
  verbosity: normal         # MSBuild verbosity level {quiet|minimal|normal|detailed}

install:
  - "%PYTHON%/Scripts/pip.exe install numpy"

test_script:
  - cd Build
  - ctest --output-on-failure -C %CONFIGURATION% -E %EXCLUDETESTS%

【问题讨论】:

    标签: visual-studio continuous-integration appveyor


    【解决方案1】:

    请查看Exclude configuration from the matrix。像这样的东西应该适合你:

    configuration:
    - Debug
    - Release
    
    environment:
      matrix:  
        - EXCLUDETESTS: solver
        - EXCLUDETESTS:
    
    matrix:
      exclude:
        - configuration: Release
          EXCLUDETESTS: solver
        - configuration: Debug
          EXCLUDETESTS:
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-23
      • 2015-08-31
      • 1970-01-01
      • 2015-06-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多