14 PERL_MIN_VERSION: '5.12'
18 name: Make distribution using Dist::Zilla
19 runs-on: ubuntu-latest
21 # Build the dist using Dist::Zilla.
23 uses: actions/checkout@v3
25 uses: actions/cache@v3
27 key: ${{ runner.os }}-dist-locallib
34 curl -L https://cpanmin.us | perl - --sudo App::cpanminus
35 - name: Install local::lib
37 cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
38 - name: Install Dist::Zilla
41 eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
43 dzil authordeps --missing | cpanm -n
44 - name: Make distribution
47 eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
48 dzil build --in build-dir
49 - name: Upload artifact
50 uses: actions/upload-artifact@v3
54 # Get Perl versions to test.
55 - uses: shogo82148/actions-setup-perl@v1
56 - id: set-perl-versions
57 name: Get Perl versions to test (minimum and median)
61 use List::Util qw(uniqstr first);
63 die 'Minimum version not specified as major version 5.xyz' unless $ENV{PERL_MIN_VERSION} =~ /^5\.[0-9]+$/;
64 my $min_perl = $ENV{PERL_MIN_VERSION};
65 info("Minimum Perl version is $min_perl");
66 set_output(min => $min_perl);
68 my @non_patch_versions = uniqstr map { /^(\d+\.\d+)/ } perl_versions( platform => 'linux' );
69 my $min_idx = first { $non_patch_versions[$_] eq $min_perl } 0..$#non_patch_versions;
70 my $median_perl = $non_patch_versions[int($min_idx/2)];
71 info("Median Perl version is $median_perl");
72 set_output(med => $median_perl );
74 min-perl-version: ${{ steps.set-perl-versions.outputs.min }}
75 med-perl-version: ${{ steps.set-perl-versions.outputs.med }}
79 runs-on: ${{ matrix.os }}
82 os: [macos-latest, windows-latest, ubuntu-latest]
84 author-testing: [false]
86 - { os: 'ubuntu-latest', perl: "5" , author-testing: true , coverage: true }
87 - { os: 'ubuntu-latest', perl: "${{ needs.dist.outputs.med-perl-version }}" }
88 - { os: 'ubuntu-latest', perl: "${{ needs.dist.outputs.min-perl-version }}" }
89 name: Perl ${{ matrix.perl }} on ${{ matrix.os }}, author (${{ matrix.author-testing || 'false' }}), coverage (${{ matrix.coverage }})
92 - name: Get dist artifact
93 uses: actions/download-artifact@v3
98 - name: Setup system deps (apt)
99 if: runner.os == 'Linux' && env.PKG_DEPS_UBUNTU
101 sudo apt-get -y update && sudo apt-get install -y --no-install-recommends ${{ env.PKG_DEPS_UBUNTU }}
104 uses: shogo82148/actions-setup-perl@v1
105 if: matrix.os != 'windows-latest'
107 perl-version: ${{ matrix.perl }}
108 - name: Set up perl (Strawberry)
109 uses: shogo82148/actions-setup-perl@v1
110 if: matrix.os == 'windows-latest'
112 distribution: 'strawberry'
116 - name: Install Perl deps
118 cpanm --notest --installdeps .
120 - name: Install Perl develop deps
121 if: matrix.author-testing
123 cpanm --notest --installdeps --with-develop .
125 - name: Install Perl coverage deps
128 cpanm --notest Devel::Cover::Report::Coveralls
130 - name: Set AUTHOR_TESTING
131 if: matrix.author-testing
134 echo "AUTHOR_TESTING=1" >> $GITHUB_ENV
136 - name: Run tests (no coverage)
137 if: ${{ ! matrix.coverage }}
139 cpanm --verbose --test-only .
141 - name: Run tests (with coverage)
144 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
145 HARNESS_PERL_SWITCHES: -MDevel::Cover
147 cpanm --verbose --test-only .
148 cover -report Coveralls
152 runs-on: ubuntu-latest
153 container: ${{ matrix.container }}
157 container: ['debian:bullseye', 'debian:bookworm']
159 - name: Get dist artifact
160 uses: actions/download-artifact@v3
163 - name: Setup system deps (apt)
164 if: ${{ startsWith(matrix.container, 'debian:') }}
166 apt-get -y update && apt-get install -y --no-install-recommends perl cpanminus make apt-file
168 apt-get install -y --no-install-recommends \
169 ${{ env.PKG_DEPS_DEBIAN }} \
170 $( cpanm -q --showdeps . | perl -MConfig -MCwd=abs_path '-M5;@prefixes = map abs_path($_), @Config{qw(vendorlibexp vendorarchexp)}' -lpe 's,~.*$,,; s,::,/,g; $mod = $_; $_ = join qq{\n}, map { qq{$_/${mod}.pm} } @prefixes' | apt-file search -lFf - )
174 cpanm --verbose --test-only .