name: linux-ubuntu-latest-perl-v5.20.3

on:
  push:
    branches:
      - '*'
    tags-ignore:
      - '*'
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: shogo82148/actions-setup-perl@v1
        with:
          perl-version: '5.20.3'
      - name: Perl version
        run: perl -V
      - name: Perl config
        run: perl -MConfig -MData::Dumper -e 'local $Data::Dumper::Sortkeys = 1;warn Dumper \%Config;'
      - name: Set PERL5LIB
        run: echo "PERL5LIB=$HOME/mylib/lib/perl5:$HOME/mylib/lib/perl5/$(perl -MConfig -e 'print $Config{archname}')" >> $GITHUB_ENV
      - name: Show PERL5LIB
        run: echo $PERL5LIB
      - name: Download cpanm
        run: perl -0777 -Mstrict -Mwarnings -MIO::Socket::INET -e 'my $socket = IO::Socket::INET->new(  Proto => qq(tcp),  PeerAddr => qq(cpanmin.us),  PeerPort => 80,) or die $!;print $socket join qq(\r\n),  qq(GET / HTTP/1.1),  qq(Connection:close),  qq(Host:cpanmin.us),  qq(\r\n);my $res = <$socket>;$res =~ m(^HTTP/1\.1 200 OK\r\n) or die $res;$res =~ s/.*?\r\n\r\n//s;open my $out, qq(>), qq(cpanm) or die $!;print $out $res'
      - name: cpanm installs ExtUtils::MakeMaker
        run: perl cpanm -v -n -L ~/mylib ExtUtils::MakeMaker
      - name: cpanm installs dependent modules
        run: perl cpanm -v -n -L ~/mylib --installdeps . --configure-args="--meta"
      - name: Show MYMETA.json
        run: cat MYMETA.json
      - run: perl Makefile.PL
      - run: make disttest
