view release on metacpan or search on metacpan
0.11 2017-12-10
- Add support for the branches block in Travis config.
0.10 2017-10-03
- Updated our list of Perl versions to include 5.26.1, 5.24.2, and 5.22.4.
- The save value of force-threaded-perls and perl-caching flags in the
.travis.yml was being ignored, and a default (false and true respectively)
was always being applied when these flags weren't set on the command line.
0.09 2017-10-01
- Caching is now enabled for Travis Perl projects by default, taking advantage
of the travis-perl helper's support for this. This can be disable passing
the --no-perl-caching flag to the setup-travis-yml.pl script.
0.06 2017-07-10
- Fixed a bug in the update mode which would cause it to die.
- Added 5.26.0 to the list of Perl versions that the Travis code knows about.
0.05 2017-06-22
- Removed the use List::Gather. This seems to be the most likely culprit for
some very odd test failures seen with threaded versions of Perl. See
https://rt.cpan.org/Ticket/Display.html?id=121777 for details.
0.04 2017-06-16
- Make sure IPC::System::Simple is included in prereqs. Reported by Slaven
ReziÄ. RT #122115.
0.03 2017-06-16
"Oschwald's",
"PayPal",
"Rolsky",
"Rolsky's",
"appveyor",
"dev",
"dir",
"distro",
"param",
"travis",
"unthreaded"
],
"wordlist" : "Pod::Wordlist"
}
},
"name" : "@MAXMIND/Test::PodSpelling",
"version" : "2.007005"
},
{
"class" : "Dist::Zilla::Plugin::PodSyntaxTests",
"name" : "@MAXMIND/PodSyntaxTests",
- "Oschwald's"
- PayPal
- Rolsky
- "Rolsky's"
- appveyor
- dev
- dir
- distro
- param
- travis
- unthreaded
wordlist: Pod::Wordlist
name: '@MAXMIND/Test::PodSpelling'
version: '2.007005'
-
class: Dist::Zilla::Plugin::PodSyntaxTests
name: '@MAXMIND/PodSyntaxTests'
version: '6.012'
-
class: Dist::Zilla::Plugin::RunExtraTests
config:
bin/setup-travis-yml.pl view on Meta::CPAN
- eval $(curl https://travis-perl.github.io/init) --auto --always-upgrade-modules
If there is an existing travis-perl C<eval> line, this will be replaced with
the line above. Otherwise this line will be inserted at the beginning of the
block.
=head2 C<perl> and C<matrix>
The C<perl> block will be updated based on the following rules:
If your distro does not have XS and you did not force the use of threaded
Perls, then you get a block like this:
perl:
- blead
- dev
- '5.26'
- '5.24'
- '5.22'
- '5.20'
- '5.18'
- '5.16'
- '5.14'
If the distro has XS code or you pass the C<--force-threaded-perls>
command line argument, then you will get a block with every Perl from 5.14 to
the latest stable release, plus dev and blead, in both threaded and unthreaded
forms. This will look something like this:
perl:
- blead
- blead-thr
- dev
- dev-thr
- 5.26.0
- 5.26.0-thr
- 5.24.1
bin/setup-travis-yml.pl view on Meta::CPAN
Create a new file instead of updating existing ones.
=head2 --dir
The directory under which to look for F<.travis.yml> files. This does a
recursive search so you can update many projects at once. In create mode it
will only create a file in the current directory.
This is required.
=head2 --force-threaded-perls
Force the inclusion of both threaded and unthreaded Perls in the generated
config, regardless of whether the distro has XS or not.
=head2 --perl-caching
If this is true, then a C<cache> block will added to cache the C<$HOME/perl5>
directory. In addition, the travis-perl C<init> call will be updated to add
C<--always-uprade-modules>.
Caching is enabled for Perl projects by default, but you can disable this by
passing C<--no-perl-caching>.
copyright_holder = MaxMind, Inc.
[@MAXMIND]
dist = App-CISetup
stopwords = appveyor
stopwords = dev
stopwords = dir
stopwords = distro
stopwords = param
stopwords = travis
stopwords = unthreaded
-remove = Test::Pod::Coverage::Configurable
lib/App/CISetup/Travis/ConfigFile.pm view on Meta::CPAN
use Moose;
use MooseX::StrictConstructor;
has email_address => (
is => 'ro',
isa => Str, # todo, better type
predicate => 'has_email_address',
);
has force_threaded_perls => (
is => 'ro',
isa => Bool,
default => 0,
);
has perl_caching => (
is => 'ro',
isa => Bool,
default => 1,
);
lib/App/CISetup/Travis/ConfigFile.pm view on Meta::CPAN
my @perls = @Perls;
for my $perl (qw( 5.8 5.10 5.12 )) {
pop @perls
unless grep {/\Q$perl/} @{ $travis->{perl} };
}
my $has_xs
= defined Path::Iterator::Rule->new->file->name(qr/\.xs/)
->iter( $self->file->parent )->();
if ( $self->force_threaded_perls || $has_xs ) {
$travis->{perl} = [ map { ( $_, $_ . '-thr' ) } @perls ];
}
else {
$travis->{perl} = \@perls;
}
return;
}
sub _update_perl_matrix {
lib/App/CISetup/Travis/ConfigFile.pm view on Meta::CPAN
);
return $block
=~ s/coverity_scan:\n.+(?=\S|\z)/coverity_scan:\n$reordered/msr;
}
sub _cisetup_flags {
my $self = shift;
my %flags = (
force_threaded_perls => $self->force_threaded_perls ? 1 : 0,
perl_caching => $self->perl_caching ? 1 : 0,
);
$flags{email_address} = $self->email_address
if $self->has_email_address;
$flags{github_user} = $self->github_user
if $self->has_github_user;
return \%flags;
}
lib/App/CISetup/Travis/ConfigUpdater.pm view on Meta::CPAN
use Moose;
use MooseX::StrictConstructor;
has email_address => (
is => 'ro',
isa => Str, # todo, better type
predicate => 'has_email_address',
);
has force_threaded_perls => (
is => 'ro',
isa => Bool,
predicate => 'has_force_threaded_perls',
);
has perl_caching => (
is => 'ro',
isa => Bool,
predicate => 'has_perl_caching',
);
has github_user => (
is => 'ro',
lib/App/CISetup/Travis/ConfigUpdater.pm view on Meta::CPAN
sub _config_filename {'.travis.yml'}
sub _config_file_class {'App::CISetup::Travis::ConfigFile'}
sub _cli_params {
my $self = shift;
return (
## no critic (BuiltinFunctions::ProhibitComplexMappings)
map { my $p = 'has_' . $_; $self->$p ? ( $_ => $self->$_ ) : () } qw(
force_threaded_perls
perl_caching
email_address
github_user
slack_key
)
);
}
## use critic
__PACKAGE__->meta->make_immutable;
t/lib/T/Shared.pm view on Meta::CPAN
sub test_stored_params {
my $self = shift;
my $dir = tempdir();
my $file = $dir->child('.travis.yml');
my %p = (
github_user => 'autarch',
email_address => 'drolsky@cpan.org',
force_threaded_perls => 0,
perl_caching => 1,
);
## no critic (Variables::ProtectPrivateVars, Subroutines::ProtectPrivateSubs)
no warnings 'redefine';
local *App::CISetup::Travis::ConfigFile::_run3 = sub { };
App::CISetup::Travis::ConfigFile->new(
file => $file,
%p,
)->create_file;
t/lib/T/Shared.pm view on Meta::CPAN
{
App::CISetup::Travis::ConfigUpdater->_stored_params_from_file(
$file)
},
\%p,
'_stored_params_from_file'
);
my $updater = App::CISetup::Travis::ConfigUpdater->new(
dir => $dir,
force_threaded_perls => 1,
perl_caching => 1,
email_address => 'autarch@urth.org',
github_user => 'bob',
);
is(
{ $updater->_cf_params($file) },
{
file => $file,
force_threaded_perls => 1,
perl_caching => 1,
email_address => 'autarch@urth.org',
github_user => 'bob',
},
'CLI params win over params stored in the file'
);
}
__PACKAGE__->meta->make_immutable;
t/lib/T/Travis.pm view on Meta::CPAN
}
sub test_create_and_update {
my $self = shift;
my $dir = tempdir();
my $file = $dir->child('.travis.yml');
App::CISetup::Travis::ConfigFile->new(
file => $file,
force_threaded_perls => 0,
)->create_file;
my $yaml = $file->slurp;
for my $v (qw( 5.14 5.16 5.18 5.20 5.22 5.24 5.26 5.28 5.30 )) {
like(
$yaml,
qr/^ +- \Q'$v'\E$/ms,
"created file includes Perl $v"
);
t/lib/T/Travis.pm view on Meta::CPAN
before_install => [
'eval $(curl https://travis-perl.github.io/init) --auto --always-upgrade-modules'
],
},
'travis config contains expected content'
);
$self->_test_cisetup_flags_comment(
$file,
{
force_threaded_perls => 0,
perl_caching => 1,
}
);
App::CISetup::Travis::ConfigFile->new(
file => $file,
force_threaded_perls => 0,
)->update_file;
my $updated = LoadFile($file);
is( $travis, $updated, 'file was not changed by update' );
}
sub test_force_threaded_perls {
my $self = shift;
my $dir = tempdir();
my $file = $dir->child('.travis.yml');
App::CISetup::Travis::ConfigFile->new(
file => $file,
force_threaded_perls => 1,
)->create_file;
my $yaml = $file->slurp;
for my $v (qw( 5.14 5.16 5.18 5.20 5.22 5.24 5.26 5.28 5.30 )) {
for my $t ( $v, "$v-thr" ) {
like(
$yaml,
qr/^ +- '?\Q$t\E'?$/ms,
"created file includes Perl $t"
);
}
}
$self->_test_cisetup_flags_comment(
$file,
{
force_threaded_perls => 1,
perl_caching => 1,
}
);
}
sub test_no_perl_caching {
my $self = shift;
my $dir = tempdir();
my $file = $dir->child('.travis.yml');
App::CISetup::Travis::ConfigFile->new(
file => $file,
force_threaded_perls => 0,
perl_caching => 0,
)->create_file;
my $yaml = $file->slurp;
my $travis = Load($yaml);
is(
$travis,
hash {
field cache => DNE();
t/lib/T/Travis.pm view on Meta::CPAN
);
is(
$travis->{before_install},
['eval $(curl https://travis-perl.github.io/init) --auto'],
'call to travis-perl init does not include --always-upgrade-modules flag'
);
$self->_test_cisetup_flags_comment(
$file,
{
force_threaded_perls => 0,
perl_caching => 0,
}
);
}
sub test_distro_has_xs {
my $self = shift;
my $dir = tempdir();
$dir->child('Foo.xs')->touch;
my $file = $dir->child('.travis.yml');
App::CISetup::Travis::ConfigFile->new(
file => $file,
force_threaded_perls => 0,
)->create_file;
my $yaml = $file->slurp;
for my $v (qw( 5.14 5.16 5.18 5.20 5.22 5.24 5.26 5.28 5.30 )) {
for my $t ( $v, "$v-thr" ) {
like(
$yaml,
qr/^ +- '?\Q$t\E'?$/ms,
"created file includes Perl $t"
t/lib/T/Travis.pm view on Meta::CPAN
language => 'perl',
before_install => [
'$(curl git://github.com/haarg/perl-travis-helper) --auto --always-upgrade-modules'
],
perl => ['5.26'],
}
);
App::CISetup::Travis::ConfigFile->new(
file => $file,
force_threaded_perls => 0,
)->update_file;
my $travis = LoadFile($file);
is(
$travis->{before_install},
[
'eval $(curl https://travis-perl.github.io/init) --auto --always-upgrade-modules'
],
'old travis-perl URL is replaced'
);
$self->_test_cisetup_flags_comment(
$file,
{
force_threaded_perls => 0,
perl_caching => 1,
}
);
}
sub test_maybe_disable_sudo {
my $self = shift;
my $dir = tempdir();
my $file = $dir->child('.travis.yml');
t/lib/T/Travis.pm view on Meta::CPAN
language => 'perl',
before_install => [
'eval $(curl https://travis-perl.github.io/init) --auto --always-upgrade-modules'
],
perl => ['5.26'],
}
);
App::CISetup::Travis::ConfigFile->new(
file => $file,
force_threaded_perls => 0,
)->update_file;
ok(
!exists LoadFile($file)->{sudo},
'sudo key is deleted',
);
}
sub test_coverity_email {
my $self = shift;
t/lib/T/Travis.pm view on Meta::CPAN
},
before_install => [
'eval $(curl https://travis-perl.github.io/init) --auto --always-upgrade-modules'
],
perl => ['5.26'],
}
);
App::CISetup::Travis::ConfigFile->new(
file => $file,
force_threaded_perls => 0,
email_address => 'bar@example.com',
)->update_file;
is(
LoadFile($file)->{addons}{coverity_scan},
{ notification_email => 'bar@example.com' },
'email address for coverity_scan is updated',
);
$self->_test_cisetup_flags_comment(
$file,
{
email_address => 'bar@example.com',
force_threaded_perls => 0,
perl_caching => 1,
}
);
}
sub test_email_notifications {
my $self = shift;
my $dir = tempdir();
my $file = $dir->child('.travis.yml');
t/lib/T/Travis.pm view on Meta::CPAN
language => 'perl',
before_install => [
'eval $(curl https://travis-perl.github.io/init) --auto --always-upgrade-modules'
],
perl => ['5.26'],
}
);
App::CISetup::Travis::ConfigFile->new(
file => $file,
force_threaded_perls => 0,
email_address => 'bar@example.com',
)->update_file;
is(
LoadFile($file)->{notifications},
{
email => {
recipients => ['bar@example.com'],
on_success => 'change',
on_failure => 'always',
t/lib/T/Travis.pm view on Meta::CPAN
local *App::CISetup::Travis::ConfigFile::_run3 = sub {
shift;
push @run3, @_;
${ $_[2] } = q{"encrypted"};
};
local $ENV{PATH} = join ':', abs_path('t/bin'), ( $ENV{PATH} // () );
my $slack_key = 'slack key';
App::CISetup::Travis::ConfigFile->new(
file => $file,
force_threaded_perls => 0,
slack_key => $slack_key,
github_user => 'autarch',
)->update_file;
is(
LoadFile($file)->{notifications},
{
slack => { rooms => { secure => 'encrypted' } },
},
'slack notification is added when slack key and github user is provided',
t/lib/T/Travis.pm view on Meta::CPAN
$run3[0],
[
qw( encrypt --no-interactive -R ),
'autarch/' . $dir->basename, $slack_key
],
'travis CLI command is run with expected args'
);
$self->_test_cisetup_flags_comment(
$file, {
force_threaded_perls => 0,
perl_caching => 1,
github_user => 'autarch',
}
);
}
__PACKAGE__->meta->make_immutable;
1;
xt/author/pod-spell.t view on Meta::CPAN
bin
dev
dir
distro
lib
mark
oalders
param
setup
travis
unthreaded
zakame