line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::TestRelease 6.029; |
2
|
|
|
|
|
|
|
# ABSTRACT: extract archive and run tests before releasing the dist |
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
2635
|
use Moose; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
28
|
|
5
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::BeforeRelease'; |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
21340
|
use Dist::Zilla::Pragmas; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
28
|
|
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
33
|
use namespace::autoclean; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
28
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
12
|
|
|
|
|
|
|
#pod |
13
|
|
|
|
|
|
|
#pod This plugin runs before a release happens. It will extract the to-be-released |
14
|
|
|
|
|
|
|
#pod archive into a temporary directory and use the TestRunner plugins to run its |
15
|
|
|
|
|
|
|
#pod tests. If the tests fail, the release is aborted and the temporary directory |
16
|
|
|
|
|
|
|
#pod is left in place. If the tests pass, the temporary directory is cleaned up and |
17
|
|
|
|
|
|
|
#pod the release process continues. |
18
|
|
|
|
|
|
|
#pod |
19
|
|
|
|
|
|
|
#pod This will set the RELEASE_TESTING and AUTHOR_TESTING env vars while running the |
20
|
|
|
|
|
|
|
#pod test suite. |
21
|
|
|
|
|
|
|
#pod |
22
|
|
|
|
|
|
|
#pod =head1 CREDITS |
23
|
|
|
|
|
|
|
#pod |
24
|
|
|
|
|
|
|
#pod This plugin was originally contributed by Christopher J. Madsen. |
25
|
|
|
|
|
|
|
#pod |
26
|
|
|
|
|
|
|
#pod =cut |
27
|
|
|
|
|
|
|
|
28
|
3
|
|
|
3
|
|
274
|
use File::pushd (); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
87
|
|
29
|
3
|
|
|
3
|
|
21
|
use Dist::Zilla::Path; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
40
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub before_release { |
32
|
1
|
|
|
1
|
0
|
25
|
my ($self, $tgz) = @_; |
33
|
1
|
|
|
|
|
44
|
$tgz = $tgz->absolute; |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
360
|
my $build_root = $self->zilla->root->child('.build'); |
36
|
1
|
50
|
|
|
|
98
|
$build_root->mkpath unless -d $build_root; |
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
|
|
526
|
my $tmpdir = path( File::Temp::tempdir(DIR => $build_root) ); |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
79
|
$self->log("Extracting $tgz to $tmpdir"); |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
2170
|
require Archive::Tar; |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
94030
|
my @files = do { |
45
|
1
|
|
|
|
|
18
|
my $wd = File::pushd::pushd($tmpdir); |
46
|
1
|
|
|
|
|
272
|
Archive::Tar->extract_archive("$tgz"); |
47
|
|
|
|
|
|
|
}; |
48
|
|
|
|
|
|
|
|
49
|
1
|
50
|
|
|
|
62093
|
$self->log_fatal([ "Failed to extract archive: %s", Archive::Tar->error ]) |
50
|
|
|
|
|
|
|
unless @files; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# Run tests on the extracted tarball: |
53
|
1
|
|
|
|
|
134
|
my $target = $tmpdir->child( $self->zilla->dist_basename ); |
54
|
|
|
|
|
|
|
|
55
|
1
|
|
|
|
|
187
|
local $ENV{RELEASE_TESTING} = 1; |
56
|
1
|
|
|
|
|
16
|
local $ENV{AUTHOR_TESTING} = 1; |
57
|
1
|
|
|
|
|
49
|
$self->zilla->run_tests_in($target); |
58
|
|
|
|
|
|
|
|
59
|
1
|
|
|
|
|
135
|
$self->log("all's well; removing $tmpdir"); |
60
|
1
|
|
|
|
|
959
|
$tmpdir->remove_tree({ safe => 0 }); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
__END__ |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=pod |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=encoding UTF-8 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 NAME |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Dist::Zilla::Plugin::TestRelease - extract archive and run tests before releasing the dist |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 VERSION |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
version 6.029 |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 DESCRIPTION |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This plugin runs before a release happens. It will extract the to-be-released |
83
|
|
|
|
|
|
|
archive into a temporary directory and use the TestRunner plugins to run its |
84
|
|
|
|
|
|
|
tests. If the tests fail, the release is aborted and the temporary directory |
85
|
|
|
|
|
|
|
is left in place. If the tests pass, the temporary directory is cleaned up and |
86
|
|
|
|
|
|
|
the release process continues. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This will set the RELEASE_TESTING and AUTHOR_TESTING env vars while running the |
89
|
|
|
|
|
|
|
test suite. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 PERL VERSION |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This module should work on any version of perl still receiving updates from |
94
|
|
|
|
|
|
|
the Perl 5 Porters. This means it should work on any version of perl released |
95
|
|
|
|
|
|
|
in the last two to three years. (That is, if the most recently released |
96
|
|
|
|
|
|
|
version is v5.40, then this module should work on both v5.40 and v5.38.) |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Although it may work on older versions of perl, no guarantee is made that the |
99
|
|
|
|
|
|
|
minimum required version will not be increased. The version may be increased |
100
|
|
|
|
|
|
|
for any reason, and there is no promise that patches will be accepted to lower |
101
|
|
|
|
|
|
|
the minimum required perl. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 CREDITS |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This plugin was originally contributed by Christopher J. Madsen. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 AUTHOR |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Ricardo SIGNES 😏 <cpan@semiotic.systems> |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This software is copyright (c) 2022 by Ricardo SIGNES. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
116
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |