如何强制 Devel::Cover 在通过 Travis CI 使用 perl-helpers 时忽略文件夹



MetaCPAN Travis CI的覆盖构建非常慢。 请参阅 https://travis-ci.org/metacpan/metacpan-web/builds/238884497 这可能部分原因是我们没有成功忽略Carton在构建过程中创建的/local文件夹。 请参阅 https://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

命令行上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

最新更新