DEV Community

Yuki Kimoto
Yuki Kimoto

Posted on • Edited on

1

Github Action Workflows for Perl Modules - Perl Club

Github Action workflows for Perl modules.

Github Action Workflows for Perl Modules - Perl Club

Although these Github Action workflows was created for the SPVM project of Perl Club, All Perl modules can use these without any changes.

Features

  • Supports Linux Ubuntu latest, Mac latest, Windows Server latest, Windows Server 2019
  • Supports 32bit on Linux/Ubuntu
  • Supports Perl 5.8.9 on Linux/Ubuntu
  • cpanm is downloaded in the workflow.
  • Resolves CPAN module dependencies.
  • ExtUtils::MakeMaker and make are used.
  • Each workflow is portable in all versions of Perl, Linux, Mac, Windows except for setting environment variables

Download by Command

This Github Action workflows can be downloaded using commands.

mkdir -p .github/workflows

# linux-ubuntu-latest
curl https://raw.githubusercontent.com/yuki-kimoto/SPVM/master/.github/workflows/linux-ubuntu-latest.yml > .github/workflows/linux-ubuntu-latest.yml

# linux-ubuntu-latest-32bit
curl https://raw.githubusercontent.com/yuki-kimoto/SPVM/master/.github/workflows/linux-ubuntu-latest-32bit.yml > .github/workflows/linux-ubuntu-latest-32bit.yml

# linux-ubuntu-latest-perl-5.8.9
curl https://raw.githubusercontent.com/yuki-kimoto/SPVM/master/.github/workflows/linux-ubuntu-latest-perl-5.8.9.yml > .github/workflows/linux-ubuntu-latest-perl-5.8.9.yml

# macos-latest
curl https://raw.githubusercontent.com/yuki-kimoto/SPVM/master/.github/workflows/macos-latest.yml > .github/workflows/macos-latest.yml

# windows-latest
curl https://raw.githubusercontent.com/yuki-kimoto/SPVM/master/.github/workflows/windows-latest.yml > .github/workflows/windows-latest.yml

# windows-2019
curl https://raw.githubusercontent.com/yuki-kimoto/SPVM/master/.github/workflows/windows-2019.yml > .github/workflows/windows-2019.yml

# Show Github Action workflows
ls -l .github/workflows
Enter fullscreen mode Exit fullscreen mode

Makefile.PL Example

An example of Makefile.PL. This is Makefile.PL that is generated by the spvmdist command.

use 5.008_007;
use ExtUtils::MakeMaker;
use strict;
use warnings;
use Config;
use Getopt::Long 'GetOptions';

GetOptions(
  'meta' => \my $meta,
);

unless ($meta) {
  # Do something such as environment check.
}

WriteMakefile(
  NAME              => 'Foo',
  VERSION_FROM      => 'lib/Foo.pm',
  LICENSE           => 'perl_5',
  ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
    (ABSTRACT_FROM  => 'lib/Foo.pm',
     AUTHOR         => 'USER_NAME<USER_MAIL>') : ()),
  test => {TESTS => 't/*.t t/*/*.t t/*/*/*.t'},
  clean => {FILES => []},
  META_MERGE => {
    'meta-spec' => { version => 2 },
    resources => {
      repository => {
        type => 'git',
        url  => '',
        web  => '',
      },
    },
    no_index => {
      directory => [],
    }
  },
  NORECURS => 1,
  CONFIGURE_REQUIRES => {
  },
  PREREQ_PM         => {
  },
  TEST_REQUIRES => {

  },
);

1;
Enter fullscreen mode Exit fullscreen mode

How to use this with Module::Build

Please replace ExtUtils::MakeMaker with Module::Build in the workflows.

And replace build process with the following command.

perl Build.PL
./Build
./Build disttest
Enter fullscreen mode Exit fullscreen mode

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)