0

我有一个 travis(.travis.yml) 的 YAML 文件

language: cpp
compiler:
  - gcc

env:
  global:
   # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
   #   via the "travis encrypt" command using the project repo's public key
    - secure: "*my secured token for coverity"

addons:
    coverity_scan:
      project:
        name: "*username/project"
        description: "Build submitted via Travis CI"
      notification_email: *my email
      build_command_prepend: "mkdir build && cd build && cmake -G "Unix Makefiles" ../project/"
      build_command: "make -j4"
      branch_pattern: master

script: mkdir build && cd build && cmake -G "Unix Makefiles" ../project/ && make

出于某种原因,这不会解析 travis 的一面......老实说,我不知道是什么破坏了 yaml......

4

2 回答 2

2

您的 值存在问题notification_email。您在那里使用别名my(由 表示*),但没有锚my(即&my在映射、序列或标量之前)。如果使用别名不是您打算做的,请提供该锚点,或者将整个放在引号中:

notification_email: "*my email"

在下面的行中,您在另一个字符串中使用了双引号,您应该将外引号设为单引号:

build_command_prepend: 'mkdir build && cd build && cmake -G "Unix Makefiles" ../project/'

这使它成为有效的 YAML。如果您还删除了descriptiontravis 不知道的密钥:

language: cpp
compiler:
  - gcc

env:
  global:
   # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
   #   via the "travis encrypt" command using the project repo's public key
    - secure: "*my secured token for coverity"

addons:
    coverity_scan:
      project:
        name: "*username/project"
      notification_email: "*my email"

      build_command_prepend: '"mkdir build && cd build && cmake -G "Unix Makefiles" ../project/'
      build_command: "make -j4"
      branch_pattern: master

script: mkdir build && cd build && cmake -G "Unix Makefiles" ../project/ && make

Travis WebLint验证文件。

于 2015-09-24T13:09:32.820 回答
1

在 Unix Makefiles 周围使用反斜杠效果更好:

build_command_prepend: "mkdir build && cd build && cmake -G \"Unix Makefiles\" ../project/"

代替

build_command_prepend: "mkdir build && cd build && cmake -G "Unix Makefiles" ../project/"

仍然存在关于描述的问题,我不明白为什么,但以下配置文件有效:

language: cpp

compiler:
  - gcc

env:
  global:
   # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
   #   via the "travis encrypt" command using the project repo's public key
    - secure: "*my secured token for coverity"

addons:
  coverity_scan:
    project:
      name: "Username/Project"
    notification_email: example@example.com
    build_command_prepend: "mkdir build && cd build && cmake -G \"Unix Makefiles\" ../project/"
    build_command: "make -j4"
    branch_pattern: master

script: mkdir build && cd build && cmake -G "Unix Makefiles" ../project/ && make
于 2015-09-24T12:40:07.127 回答