From fea0b80d48c5a6c4e3c12a5eb395edf6ddd36446 Mon Sep 17 00:00:00 2001 From: Duncan Ferguson Date: Wed, 16 Oct 2024 09:21:26 +0100 Subject: [PATCH] GitHub actions (#161) --- .github/workflows/dzil_tester.yml | 69 ++++++++++++++++++++----------- Changes | 3 +- lib/App/ClusterSSH.pm | 2 +- lib/App/ClusterSSH/Base.pm | 15 +++---- lib/App/ClusterSSH/Window.pm | 2 +- t/pod-coverage.t | 15 ++----- 6 files changed, 61 insertions(+), 45 deletions(-) diff --git a/.github/workflows/dzil_tester.yml b/.github/workflows/dzil_tester.yml index f530973..e694228 100644 --- a/.github/workflows/dzil_tester.yml +++ b/.github/workflows/dzil_tester.yml @@ -13,33 +13,56 @@ jobs: fail-fast: false matrix: perl-version: - - latest - - 5.40 - - 5.38 - - 5.36 - - 5.34 - - 5.32 - - 5.30 - - 5.28 - - 5.26 - - 5.24 - - 5.22 - - 5.20 - - 5.18 - - 5.16 + - 'devel' + - 'latest' + - '5.40' + - '5.38' + - '5.36' + - '5.34' + - '5.32' + - '5.30' + - '5.28' + - '5.26' + - '5.24' + - '5.22' + - '5.20' + - '5.18' + - '5.16' + include: + - perl-version: '5.38' + os: ubuntu-latest + coverage: true container: image: perldocker/perl-tester:${{ matrix.perl-version }} name: Perl ${{ matrix.perl-version }} steps: - - uses: actions/checkout@v2 - - name: Regular tests - run: | - cpanm -n -f Pod::Coverage::TrustPod Test::Perl::Critic Test::Pod::Coverage Test::Pod - perl Build.PL - perl Build test + - uses: actions/checkout@main + - name: Amend PATH + run: echo "${GITHUB_WORKSPACE}/t/bin" >> $GITHUB_PATH + - name: Current env + run: env + - name: Perl info + run: perl -V + - name: CPAN test modules + run: cpanm -n Pod::Coverage::TrustPod Test::Perl::Critic Test::Pod::Coverage Test::Pod Test::Trap + - name: CPAN build modules + run: cpanm -n Tk X11::Protocol X11::Protocol::Other + - name: Initial Build + run: perl Build.PL + - name: Build the MANIFEST + run: perl Build manifest + - name: Test suite + if: ${{ !matrix.coverage }} + run: perl Build test env: - - COVERAGE=1 - - RELEASE_TESTING=1 - - AUTHOR_TESTING=1 + RELEASE_TESTING: 1 + AUTHOR_TESTING: 1 + - name: Coverage tests + if: ${{ matrix.coverage }} + run: perl Build test + env: + COVERAGE: 1 + RELEASE_TESTING: 1 + AUTHOR_TESTING: 1 diff --git a/Changes b/Changes index bd59447..f187331 100644 --- a/Changes +++ b/Changes @@ -1,8 +1,9 @@ Revision history for {{$dist->name}} -4.17_01 ????-??-?? Duncan Ferguson +4.17 2024-10-16 Duncan Ferguson - Swap the hostname lookup macro from DNS to using the system hostname (Github issue #158) - Swap from using Travis-CI to Github Actions +- Fix tests on perl 5.38 and 5.40 (Github Issue #153) 4.16 2020-06-20 Duncan Ferguson - Further fix for 'resolve_names' error when adding hosts via the UI diff --git a/lib/App/ClusterSSH.pm b/lib/App/ClusterSSH.pm index 563edd1..2cdeb1b 100644 --- a/lib/App/ClusterSSH.pm +++ b/lib/App/ClusterSSH.pm @@ -5,7 +5,7 @@ package App::ClusterSSH; # ABSTRACT: Cluster administration tool # ABSTRACT: Cluster administration tool -use version; our $VERSION = version->new('4.16'); +use version; our $VERSION = version->new('4.17'); =head1 SYNOPSIS diff --git a/lib/App/ClusterSSH/Base.pm b/lib/App/ClusterSSH/Base.pm index f5613ee..58a1d47 100644 --- a/lib/App/ClusterSSH/Base.pm +++ b/lib/App/ClusterSSH/Base.pm @@ -304,13 +304,13 @@ sub parent { sub sort { my $self = shift; - my $sort = sub { sort @_ }; - - return $sort unless $self->config()->{'use_natural_sort'}; - # if the user has asked for natural sorting we need to include an extra # module - if ( $self->config()->{'use_natural_sort'} ) { + my $config = $self->config(); + + # Make sure the configuration object has been set correctly before + # referencing anything + if ( ref $config eq "HASH" && $config->{'use_natural_sort'} ) { eval { Module::Load::load('Sort::Naturally'); }; if ($@) { warn( @@ -318,16 +318,17 @@ sub sort { ); } else { - $sort = sub { Sort::Naturally::nsort(@_) }; + my $sort = sub { Sort::Naturally::nsort(@_) }; + return $sort; } } + my $sort = sub { sort @_ }; return $sort; } 1; - =head1 METHODS These extra methods are provided on the object diff --git a/lib/App/ClusterSSH/Window.pm b/lib/App/ClusterSSH/Window.pm index 96559ff..27f8ca0 100644 --- a/lib/App/ClusterSSH/Window.pm +++ b/lib/App/ClusterSSH/Window.pm @@ -28,7 +28,7 @@ sub import { my ($class) = @_; # If we are building or in test here, just exit - # as travis build servers will not have Tk installed + # as the build servers will not have Tk installed if ($ENV{AUTHOR_TESTING} || $ENV{RELEASE_TESTING}) { print STDERR "skipping initialisation; AUTHOR_TESTING or RELEASE_TESTING are set\n"; return; diff --git a/t/pod-coverage.t b/t/pod-coverage.t index 035f113..995cd2f 100644 --- a/t/pod-coverage.t +++ b/t/pod-coverage.t @@ -2,18 +2,9 @@ use strict; use warnings; use Test::More; -# Ensure a recent version of Test::Pod::Coverage -my $min_tpc = 1.08; -eval "use Test::Pod::Coverage $min_tpc"; -plan skip_all => - "Test::Pod::Coverage $min_tpc required for testing POD coverage" - if $@; +eval "use Test::Pod::Coverage 1.00"; +plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@; -# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, -# but older versions don't recognize some common documentation styles -my $min_pc = 0.18; -eval "use Pod::Coverage $min_pc"; -plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" - if $@; +plan skip_all => "Skipping coverage tests" unless $ENV{COVERAGE}; all_pod_coverage_ok();