File Coverage

blib/lib/Dist/Zilla/Plugin/Author/CSSON/GithubActions/Workflow/TestWithMakefile.pm
Criterion Covered Total %
statement 21 23 91.3
branch 2 2 100.0
condition n/a
subroutine 6 8 75.0
pod 0 3 0.0
total 29 36 80.5


line stmt bran cond sub pod time code
1 1     1   3328014 use 5.14.0;
  1         5  
2 1     1   10 use strict;
  1         3  
  1         26  
3 1     1   5 use warnings;
  1         4  
  1         82  
4              
5             package Dist::Zilla::Plugin::Author::CSSON::GithubActions::Workflow::TestWithMakefile;
6              
7             # ABSTRACT: Workflow for testing with Makefile.PL
8             our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY
9             our $VERSION = '0.0107';
10              
11 1     1   9 use Moose;
  1         2  
  1         9  
12 1     1   7378 use Types::Standard qw/ArrayRef/;
  1         87580  
  1         17  
13             with qw/
14             Dist::Zilla::Role::Author::CSSON::GithubActions
15             /;
16              
17             has run_before => (
18             is => 'ro',
19             isa => ArrayRef,
20             default => sub { [] },
21             traits => ['Array'],
22             documentation => q{Adds one or more steps before installing Perl modules},
23             handles => {
24             all_run_before => 'elements',
25             has_run_before => 'count',
26             },
27             );
28              
29             sub mvp_multivalue_args {
30             qw/
31             run_before
32             /;
33             };
34              
35 0     0 0 0 sub workflow_filename { 'workflow-test-with-makefile.yml' }
36              
37 0     0 0 0 sub distribution_name { 'Dist-Zilla-Plugin-Author-CSSON-GithubActions' }
38              
39             sub parse_custom_parameters {
40 6     6 0 20 my $self = shift;
41 6         15 my $yaml = shift;
42              
43 6 100       409 if ($self->has_run_before) {
44 1         5 splice @{ $yaml->{'jobs'}{'perl-job'}{'steps'} }, 1, 0, map { { run => $_ } } $self->all_run_before;
  1         76  
  1         7  
45             }
46 6         22 return $yaml;
47              
48             }
49              
50             __PACKAGE__->meta->make_immutable;
51              
52             1;
53              
54             __END__
55              
56             =pod
57              
58             =encoding UTF-8
59              
60             =head1 NAME
61              
62             Dist::Zilla::Plugin::Author::CSSON::GithubActions::Workflow::TestWithMakefile - Workflow for testing with Makefile.PL
63              
64             =head1 VERSION
65              
66             Version 0.0107, released 2020-12-30.
67              
68             =head1 SYNOPSIS
69              
70             In dist.ini:
71              
72             [Author::CSSON::GithubActions::Workflow::TestWithMakefile]
73             run_before = apt-get install nano
74              
75             =head1 DESCRIPTION
76              
77             This is an example workflow for L<Dist::Zilla::Plugin::Author::CSSON::GithubActions>. It is based
78             on L<https://perlmaven.com/setup-github-actions>.
79              
80             The actual workflow is defined in C<share/workflow-test-with-makefile.yml>.
81              
82             In addition to the parameters defined in L<Dist::Zilla::Role::Author::CSSON::GithubActions>, this workflow class adds one
83             additional parameter: C<run_before>. This parameter allows for the insertion of one or more steps before any Perl testing is being done.
84              
85             =head1 SOURCE
86              
87             L<https://github.com/Csson/p5-Dist-Zilla-Plugin-Author-CSSON-GithubActions>
88              
89             =head1 HOMEPAGE
90              
91             L<https://metacpan.org/release/Dist-Zilla-Plugin-Author-CSSON-GithubActions>
92              
93             =head1 AUTHOR
94              
95             Erik Carlsson <info@code301.com>
96              
97             =head1 COPYRIGHT AND LICENSE
98              
99             This software is copyright (c) 2020 by Erik Carlsson.
100              
101             This is free software; you can redistribute it and/or modify it under
102             the same terms as the Perl 5 programming language system itself.
103              
104             =cut