App-CISetup
view release on metacpan or search on metacpan
0.18 2019-01-24
- Make fewer assumptions about the existing config when updating, notably the
matrix.allow_failures section. Fixed by Olaf Alders. GH #8.
0.17 2019-01-10
- Both tools could incorrectly report that they updated the .travis.yml when
in fact they errored out trying to parse the YAML file. Fixed by Olaf
Alders. GH #7.
0.16 2018-12-21
- Remove the "sudo" key from any Travis configs. Travis moving all builds to a
VM-based system where you always have access to "sudo". See
https://blog.travis-ci.com/2018-10-04-combining-linux-infrastructures for
details.
bin/setup-appveyor-yml.pl view on Meta::CPAN
This will contain one command, C<perl -e 1>, for newly created files.
=head2 C<test_script>
This will contain one command, C<prove -lrv t/>, for newly created files.
=head2 C<notifications>
If you pass an C<--email-address> or C<--slack-key> command line argument,
then this block will be updated. For email, notifications will be sent on all
failures and on status changes.
If you pass an encrypted slack key then notifications will be delivered via
Slack on all failures and on status changes.
=head2 C<__app_cisetup__> comment
This saves any flags you pass on the command line. Future runs of this script
will use these flags. However, CLI flags will always take precedence over
these.
bin/setup-travis-yml.pl view on Meta::CPAN
=head1 THE CONFIG
If there is an existing file, most of its config will be preserved. The
existing config is used as the guide for some decisions about what to update,
as detailed below. A newly created file will also follow this guide.
Here's a step-by-step guide to the generated Travis config and what it does:
=head2 C<addons>
An C<addons> block will be added or updated to include C<aspell> and
C<aspell-en> for the benefit of L<Test::Spelling>.
=head2 C<before_install>, C<install>, and C<script>
If this exists and does not mention either C<travis-perl> (the new name) or
C<perl-travis-helper> (the old name), then these blocks will be left as-is.
If the travis-perl helpers I<are> referenced, the following updates are done:
If the C<script> block is more than 3 lines long I<and> either the C<install>
block is longer than 2 lines I<or> the C<install> block does not contain a
call to the travis-perl C<cpan-install>, then the C<before_install> block is
updated to include these lines:
- git clone git://github.com/travis-perl/helpers ~/travis-perl-helpers
- source ~/travis-perl-helpers/init
If there are existing travis-perl C<clone> and C<source> lines, these will be
replaced with the two lines above. Otherwise these two lines will be inserted
at the beginning of the block.
This is how you would start using the travis-perl helpers in the non-auto
(long) config.
If the C<script> and C<install> blocks don't match the aforementioned
conditions, then the C<instal> and C<script> blocks are deleted entirely and
the C<before_install> block is updated to contain this line:
- 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'
bin/setup-travis-yml.pl view on Meta::CPAN
=head2 C<env.global>
This script will ensure that C<env.global> sets both C<RELEASE_TESTING=1> and
C<AUTHOR_TESTING=1>, in addition to any other variables you have listed. It
will also sort the entries in this block.
=head2 C<notifications>
If you pass an C<--email-address> or C<--slack-key> command line argument,
then this block will be updated. For email, notifications will be sent on all
failures and on changes.
If you pass a slack key the C<travis> command line tool will be executed to
encrypt the key and it will be added to the config. If you have an existing
secure key it will not be updated, because the C<travis> tool generates a new
encrypted key every time it's invoked, leading to annoying churn.
=head2 C<__app_cisetup__> comment
This saves any flags you pass on the command line. Future runs of this script
will use these flags. However, CLI flags will always take precedence over
these.
=head1 ARGUMENTS
bin/setup-travis-yml.pl view on Meta::CPAN
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>.
=head2 --slack-key
A Slack key to use for Slack notifications. If you pass this you must also
pass C<--github-user>.
lib/App/CISetup/Role/ConfigUpdater.pm view on Meta::CPAN
sub _update_files {
my $self = shift;
my $iter = $self->_config_file_iterator;
my $count = 0;
while ( my $file = $iter->() ) {
$file = path($file);
$count++;
my $updated;
try {
$updated
= $self->_config_file_class->new( $self->_cf_params($file) )
->update_file;
}
catch {
print "\n\n\n" . $file . "\n" or die $!;
print $_ or die $!;
};
next unless $updated;
print "Updated $file\n" or die $!;
}
warn sprintf( "WARNING: No %s files found\n", $self->_config_filename )
unless $count;
return 0;
}
t/lib/T/AppVeyor.pm view on Meta::CPAN
}
);
App::CISetup::AppVeyor::ConfigFile->new(
file => $file,
encrypted_slack_key => 'encrypted',
slack_channel => 'my-channel',
email_address => 'drolsky@cpan.org',
)->update_file;
my $updated = LoadFile($file);
is( $appveyor, $updated, 'file was not changed by second update' );
}
sub test_update {
my $self = shift;
my $dir = tempdir();
my $file = $dir->child('appveyor.yml');
$file->spew(<<'EOF');
cache:
t/lib/T/AppVeyor.pm view on Meta::CPAN
}
);
App::CISetup::AppVeyor::ConfigFile->new(
file => $file,
encrypted_slack_key => 'encrypted',
slack_channel => 'my-channel',
email_address => 'drolsky@cpan.org',
)->update_file;
my $updated = LoadFile($file);
is( $appveyor, $updated, 'file was not changed by second update' );
}
__PACKAGE__->meta->make_immutable;
1;
t/lib/T/Travis.pm view on Meta::CPAN
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,
t/lib/T/Travis.pm view on Meta::CPAN
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,
}
);
( run in 0.370 second using v1.01-cache-2.11-cpan-05444aca049 )