Skip to content

t/Root/RootIO.t: mark LWP::Protocol::https as prerequesite for test (… #19

t/Root/RootIO.t: mark LWP::Protocol::https as prerequesite for test (…

t/Root/RootIO.t: mark LWP::Protocol::https as prerequesite for test (… #19

Workflow file for this run

name: Run Tests
on:
push:
branches:
- '*'
pull_request:
env:
PKG_DEPS_UBUNTU: >-
libdb-dev
PKG_DEPS_DEBIAN: >-
libdb-dev
PERL_MIN_VERSION: '5.12'
jobs:
dist:
name: Make distribution using Dist::Zilla
runs-on: ubuntu-latest
steps:
# Build the dist using Dist::Zilla.
- name: Checkout code
uses: actions/checkout@v3
- name: Cache ~/perl5
uses: actions/cache@v3
with:
key: ${{ runner.os }}-dist-locallib
path: ~/perl5
- name: Perl version
run: |
perl -v
- name: Install cpanm
run: |
curl -L https://cpanmin.us | perl - --sudo App::cpanminus
- name: Install local::lib
run: |
cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
- name: Install Dist::Zilla
shell: bash
run: |
eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
cpanm -n Dist::Zilla
dzil authordeps --missing | cpanm -n
- name: Make distribution
shell: bash
run: |
eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
dzil build --in build-dir
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: dist
path: ./build-dir
# Get Perl versions to test.
- uses: shogo82148/actions-setup-perl@v1
- id: set-perl-versions
name: Get Perl versions to test (minimum and median)
shell: perl {0}
run: |
use Actions::Core;
use List::Util qw(uniqstr first);
die 'Minimum version not specified as major version 5.xyz' unless $ENV{PERL_MIN_VERSION} =~ /^5\.[0-9]+$/;
my $min_perl = $ENV{PERL_MIN_VERSION};
info("Minimum Perl version is $min_perl");
set_output(min => $min_perl);
my @non_patch_versions = uniqstr map { /^(\d+\.\d+)/ } perl_versions( platform => 'linux' );
my $min_idx = first { $non_patch_versions[$_] eq $min_perl } 0..$#non_patch_versions;
my $median_perl = $non_patch_versions[int($min_idx/2)];
info("Median Perl version is $median_perl");
set_output(med => $median_perl );
outputs:
min-perl-version: ${{ steps.set-perl-versions.outputs.min }}
med-perl-version: ${{ steps.set-perl-versions.outputs.med }}
test:
needs: dist
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
perl: ['5']
author-testing: [false]
include:
- { os: 'ubuntu-latest', perl: "5" , author-testing: true , coverage: true }
- { os: 'ubuntu-latest', perl: "${{ needs.dist.outputs.med-perl-version }}" }
- { os: 'ubuntu-latest', perl: "${{ needs.dist.outputs.min-perl-version }}" }
name: Perl ${{ matrix.perl }} on ${{ matrix.os }}, author (${{ matrix.author-testing || 'false' }}), coverage (${{ matrix.coverage }})
steps:
- name: Get dist artifact
uses: actions/download-artifact@v3
with:
name: dist
# Setup system deps
- name: Setup system deps (apt)
if: runner.os == 'Linux' && env.PKG_DEPS_UBUNTU
run: |
sudo apt-get -y update && sudo apt-get install -y --no-install-recommends ${{ env.PKG_DEPS_UBUNTU }}
- name: Set up perl
uses: shogo82148/actions-setup-perl@v1
if: matrix.os != 'windows-latest'
with:
perl-version: ${{ matrix.perl }}
- name: Set up perl (Strawberry)
uses: shogo82148/actions-setup-perl@v1
if: matrix.os == 'windows-latest'
with:
distribution: 'strawberry'
- run: perl -V
- name: Install Perl deps
run: |
cpanm --notest --installdeps .
- name: Install Perl develop deps
if: matrix.author-testing
run: |
cpanm --notest --installdeps --with-develop .
- name: Install Perl coverage deps
if: matrix.coverage
run: |
cpanm --notest Devel::Cover::Report::Coveralls
- name: Set AUTHOR_TESTING
if: matrix.author-testing
shell: bash
run: |
echo "AUTHOR_TESTING=1" >> $GITHUB_ENV
- name: Run tests (no coverage)
if: ${{ ! matrix.coverage }}
run: |
cpanm --verbose --test-only .
- name: Run tests (with coverage)
if: matrix.coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HARNESS_PERL_SWITCHES: -MDevel::Cover
run: |
cpanm --verbose --test-only .
cover -report Coveralls
containers:
needs: dist
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
container: ['debian:bullseye', 'debian:bookworm']
steps:
- name: Get dist artifact
uses: actions/download-artifact@v3
with:
name: dist
- name: Setup system deps (apt)
if: ${{ startsWith(matrix.container, 'debian:') }}
run: |
apt-get -y update && apt-get install -y --no-install-recommends perl cpanminus make apt-file
apt-file update
apt-get install -y --no-install-recommends \
${{ env.PKG_DEPS_DEBIAN }} \
$( 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 - )
- name: Run tests
run: |
cpanm --verbose --test-only .