4

MetaCPAN Travis CI 覆盖构建非常缓慢。请参阅https://travis-ci.org/metacpan/metacpan-web/builds/238884497 这可能部分是因为我们没有成功忽略作为我们构建的一部分/local创建的文件夹。Cartonhttps://coveralls.io/builds/11809290

我们perl-helpers用来帮助​​我们的 Travis 配置。我认为我应该能够使用DEVEL_COVER_OPTIONS环境变量来解决这个问题,但我想我没有正确的咒语。我在下面包含了整个配置,因为一些断章取义的片段似乎具有误导性。

language: perl
perl:
  - "5.22"

matrix:
  fast_finish: true
  allow_failures:
    - env: COVERAGE=1 USE_CPANFILE_SNAPSHOT=true
    - env: USE_CPANFILE_SNAPSHOT=false HARNESS_VERBOSE=1
env:
  global:
    # Carton --deployment only works on the same version of perl
    # that the snapshot was built from.
    - DEPLOYMENT_PERL_VERSION=5.22
    - DEVEL_COVER_OPTIONS="-ignore ^local/"
  matrix:

    # Get one passing run with coverage and one passing run with Test::Vars
    # checks.  If run together they more than double the build time.
    - COVERAGE=1 USE_CPANFILE_SNAPSHOT=true
    - USE_CPANFILE_SNAPSHOT=false HARNESS_VERBOSE=1
    - USE_CPANFILE_SNAPSHOT=true

before_install:
  - git clone git://github.com/travis-perl/helpers ~/travis-perl-helpers
  - source ~/travis-perl-helpers/init

  - npm install -g less js-beautify
  # Pre-install from backpan to avoid upgrade breakage.
  - cpanm -n http://cpan.metacpan.org/authors/id/M/ML/MLEHMANN/common-sense-3.6.tar.gz
  - cpanm -n App::cpm Carton

install:
  - cpan-install --coverage   # installs converage prereqs, if enabled
  - 'cpm install `test "${USE_CPANFILE_SNAPSHOT}" = "false" && echo " --resolver metadb" || echo " --resolver snapshot"`'

before_script:
  - coverage-setup

script:
  # Devel::Cover isn't in the cpanfile
  # but if it's installed into the global dirs this should work.
  - carton exec prove -lr -j$(test-jobs) t

after_success:
  - coverage-report

notifications:
  email:
    recipients:
      - olaf@seekrit.com
    on_success: change
    on_failure: always
  irc: "irc.perl.org#metacpan-travis"

# Use newer travis infrastructure.
sudo: false
cache:
  directories:
    - local
4

1 回答 1

4

命令行上的 Devel::Cover 选项的语法很奇怪。你需要把东西用逗号分隔。至少当你使用PERL5OPT.

DEVEL_COVER_OPTIONS="-ignore,^local/"

参见例如https://github.com/simbabque/AWS-S3/blob/master/.travis.yml#L26,其中有很多带逗号的东西。

PERL5OPT=-MDevel::Cover=-ignore,"t/",+ignore,"prove",-coverage,statement,branch,condition,path,subroutine prove -lrs t
于 2017-06-05T20:05:06.003 回答