为什么我在将模式添加到文件的拉取请求中收到 Travis CI 错误?

Why am I getting a Travis CI error on my pull request to add a schema to a file?

我是 Github 的新手。我通常不编程,但我正在尝试为此处的 Google Code-In 做些事情。我提交了一个pull request with several changes to xsf/xeps on Github, but I'm getting an error with Travis CI。带有 TCI 的日志结尾如下所示:

unable to parse xep-0363.xml
make: *** [build/xep-0363.html] Error 6
The command "make all" exited with 2.
2.88s$ echo "lint,$(xmllint --nonet --noout --noent --loaddtd --valid *.xml 2>&1 | wc -l)" | ./git-ratchet check -v
INFO: 2016/12/18 20:33:55 check.go:12: Parsing measures from stdin
INFO: 2016/12/18 20:33:58 check.go:14: Finished parsing measures from stdin
INFO: 2016/12/18 20:33:58 check.go:15: [{lint 4279 4279}]
INFO: 2016/12/18 20:33:58 check.go:21: Reading measures stored in git
INFO: 2016/12/18 20:33:58 git.go:14: git --no-pager log --notes=git-ratchet-1-master --pretty=format:'%H,%ae,%at,"%N",' HEAD
INFO: 2016/12/18 20:33:58 check.go:50: Checking passed measure against stored value
INFO: 2016/12/18 20:33:58 git.go:14: git --no-pager log --notes=git-ratchet-excuse-1-master --pretty=format:'%N' 8930133cb12cef58730b70ca2abac6523b19b6a7^1..HEAD
INFO: 2016/12/18 20:33:58 reader.go:169: Total excuses []
INFO: 2016/12/18 20:33:58 reader.go:183: Checking measures: lint lint
ERROR: 2016/12/18 20:33:58 reader.go:209: Measure rising: lint, delta 3 (0.07015902712815715 percents)
FATAL: 2016/12/18 20:33:58 check.go:63: One or more metrics currently failing.
The command "echo "lint,$(xmllint --nonet --noout --noent --loaddtd --valid *.xml 2>&1 | wc -l)" | ./git-ratchet check -v" exited with 50.
Done. Your build exited with 1.

The command "make all" exited with 2.The command "echo "lint,$(xmllint --nonet --noout --noent --loaddtd --valid *.xml 2>&1 | wc -l)" | ./git-ratchet check -v" exited with 50. 行是红色的。

这是怎么回事?

好的,我正在编辑它以添加我已经尝试了@melpomene 在他们下面的回答中建议的内容。但是,我已经尝试删除该行 4 次,然后重新压缩提交,并且它不断重新出现。我该如何解决这个问题?

根据the Travis configuration of that build

{
  "addons": {
    "apt": {
      "packages": [
        "xsltproc",
        "libxml2-utils"
      ]
    }
  },
  "before_install": [
    "wget -O git-ratchet https://github.com/iangrunert/git-ratchet/releases/download/v0.3.1/linux_amd64_git-ratchet",
    "chmod +x git-ratchet",
    "git fetch https://github.com/xsf/xeps.git refs/notes/*:refs/notes/*"
  ],
  "script": [
    "make all",
    "echo \"lint,$(xmllint --nonet --noout --noent --loaddtd --valid *.xml 2>&1 | wc -l)\" | ./git-ratchet check -v"
  ],
  "language": "ruby",
  "group": "stable",
  "dist": "precise",
  "os": "linux"
}

... 直接来自 that repo's .travis.yml:

addons:
  apt:
    packages:
      - xsltproc
      - libxml2-utils
before_install:
  - wget -O git-ratchet https://github.com/iangrunert/git-ratchet/releases/download/v0.3.1/linux_amd64_git-ratchet
  - chmod +x git-ratchet
  - git fetch https://github.com/xsf/xeps.git refs/notes/*:refs/notes/*
script:
  - make all
  - echo "lint,$(xmllint --nonet --noout --noent --loaddtd --valid *.xml 2>&1 | wc -l)" | ./git-ratchet check -v

有人通过设置 script 键获得了 customized the build step

script 的值可以是单个 shell 命令,也可以是要由 travis 执行的 shell 命令列表。它们都是 运行,但如果它们中的任何一个失败(通过返回非零退出状态),整个构建将被视为失败。

红线来自 Travis,告诉您哪个命令失败以及它的退出状态是什么。

至于这些命令的实际作用以及错误的含义,这取决于项目。我不熟悉这个,但失败前的最后几行输出是:

xep-0363.xml:249: parser error : XML declaration allowed only at the start of the document    
 <?xml version='1.0' encoding='UTF-8'?>    
      ^    
xep-0363.xml:249: parser error : XML declaration allowed only at the start of the document    
 <?xml version='1.0' encoding='UTF-8'?>    
      ^    
unable to parse xep-0363.xml    
make: *** [build/xep-0363.html] Error 6

确实 your commit 在文件中间引入了 <?xml ...?> 行,所以这可能是破坏构建的原因。