App-CISetup

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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.

Changes  view on Meta::CPAN

84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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
 
 
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

META.json  view on Meta::CPAN

403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
            "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",

META.yml  view on Meta::CPAN

286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
        - "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

94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
    - 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

184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
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>.

dist.ini  view on Meta::CPAN

5
6
7
8
9
10
11
12
13
14
15
16
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

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use Moose;
 
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

175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
    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

399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
    );
 
    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

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use Moose;
 
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

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
        {
            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

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
}
 
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

109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
            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

187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
    );
    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

236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
            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

276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
            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

307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
            },
            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

346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
        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

393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
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

422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
        $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

43
44
45
46
47
48
49
50
51
52
53
54
bin
dev
dir
distro
lib
mark
oalders
param
setup
travis
unthreaded
zakame



( run in 0.292 second using v1.01-cache-2.11-cpan-496ff517765 )