From 04bc43590c665035e60ae408338a63bc6e8a1ed7 Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sun, 2 Jun 2024 19:28:30 -0400 Subject: [PATCH] GitHub Action: upload cpanm logs --- .github/workflows/multiperl-test.yml | 27 +++++++++++---- lib/Dist/Zilla/Util/AuthorDeps.pm | 50 ++++++++++++++++++---------- 2 files changed, 53 insertions(+), 24 deletions(-) diff --git a/.github/workflows/multiperl-test.yml b/.github/workflows/multiperl-test.yml index 1a51d4eca..8c6abf90e 100644 --- a/.github/workflows/multiperl-test.yml +++ b/.github/workflows/multiperl-test.yml @@ -24,15 +24,30 @@ jobs: chmod u+x /tmp/cpanm - name: Install Dist::Zilla run: sudo apt-get install -y libdist-zilla-perl - - name: Install prereqs - # This could probably be made more efficient by looking at what it's - # installing via cpanm that could, instead, be installed from apt. I - # may do that later, but for now, it's fine! -- rjbs, 2023-01-07 + - name: Install authordeps run: | - dzil authordeps --missing > /tmp/deps-phase-1.txt + dzil authordeps --missing | grep -v Dist::Zilla::Plugin::CPANFile > /tmp/deps-phase-1.txt + echo "---BEGIN AUTHORDEPS---" + cat /tmp/deps-phase-1.txt + echo "---END AUTHORDEPS---" /tmp/cpanm --notest -S < /tmp/deps-phase-1.txt - dzil listdeps --author --missing >> /tmp/deps-phase-2.txt + - name: Upload cpanm logs for authordeps + uses: actions/upload-artifact@v4 + with: + name: cpanm-authordeps.log + path: ~/.cpanm/build.log + - name: Install missing prereqs + run: | + dzil listdeps --author --missing > /tmp/deps-phase-2.txt + echo "---BEGIN PREREQS---" + cat /tmp/deps-phase-2.txt + echo "---END PREREQS---" /tmp/cpanm --notest -S < /tmp/deps-phase-2.txt + - name: Upload cpanm logs for prereqs + uses: actions/upload-artifact@v4 + with: + name: cpanm-prereqs.log + path: ~/.cpanm/build.log - name: Build tarball run: | dzil build --in Dist-To-Test diff --git a/lib/Dist/Zilla/Util/AuthorDeps.pm b/lib/Dist/Zilla/Util/AuthorDeps.pm index e960301a5..468a81cea 100644 --- a/lib/Dist/Zilla/Util/AuthorDeps.pm +++ b/lib/Dist/Zilla/Util/AuthorDeps.pm @@ -107,24 +107,38 @@ sub extract_author_deps { if ($missing) { require Module::Runtime; - @packages = - grep { - $_ eq 'perl' - ? ! ($vermap->{perl} && eval "use $vermap->{perl}; 1") - : do { - my $m = $_; - ! eval { - local @INC = @INC; push @INC, "$root"; - # This will die if module is missing - Module::Runtime::require_module($m); - my $v = $vermap->{$m}; - # This will die if VERSION is too low - !$v || $m->VERSION($v); - # Success! - 1 - } - } - } @packages; + my @new_packages; + PACKAGE: for my $package (@packages) { + if ($package eq 'perl') { + # This is weird, perl can never really be a prereq to fulfill but... + # it was like this. -- rjbs, 2024-06-02 + if ($vermap->{perl} && ! eval "use $vermap->{perl}; 1") { + push @new_packages, 'perl'; + } + + next PACKAGE; + } + + my $ok = eval { + local @INC = (@INC, "$root"); + + # This will die if module is missing + Module::Runtime::require_module($package); + my $v = $vermap->{$package}; + + # This will die if VERSION is too low + !$v || $package->VERSION($v); + + # Success! + 1; + }; + + unless ($ok) { + push @new_packages, $package; + } + } + + @packages = @new_packages; } # Now that we have a sorted list of packages, use that to build an array of