Skip to content

rename src/ to lab/ as legacy algorithm laboratory #175

rename src/ to lab/ as legacy algorithm laboratory

rename src/ to lab/ as legacy algorithm laboratory #175

Workflow file for this run

---
name: Perl
# yamllint disable rule:line-length
on: # yamllint disable-line rule:truthy
push:
paths: ['lab/perl/**', '.github/workflows/test-perl.yml']
pull_request:
paths: ['lab/perl/**', '.github/workflows/test-perl.yml']
workflow_dispatch:
# schedule:
# - cron: '42 5 * * *'
jobs:
test:
strategy:
fail-fast: false
matrix:
# runner: [ubuntu-latest, macos-latest, windows-latest]
runner: [ubuntu-latest, macos-latest]
perl: ['5.24', '5.30', '5.36']
exclude:
- runner: windows-latest
perl: '5.36'
runs-on: ${{matrix.runner}}
name: OS ${{matrix.runner}} Perl ${{matrix.perl}}
steps:
- uses: actions/checkout@v3
- name: Set up perl
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: ${{ matrix.perl }}
distribution: ${{ ( startsWith( matrix.runner, 'windows-' ) && 'strawberry' ) || 'default' }}
- name: Show Perl Version
run: |
perl -v
- name: Install Dist::Zilla
run: |
cpanm -v
cpanm --dev --notest ExtUtils::MakeMaker
cpanm --notest Dist::Zilla Test::Pod Pod::Markdown Test::Vars
dzil --version
- name: Install Modules
shell: perl {0}
run: |
use feature qw(say);
use POSIX qw(getcwd);
sub do_cpanm {
my @args = @_;
my @deps;
for my $dep (@args) {
chomp $dep;
push @deps, $dep;
}
if (scalar @deps) {
say ">>> install: ".join(" ", @deps);
}
my $retcode = system( "cpanm", "--notest", @deps );
return (($retcode >> 8) == 0);
}
chdir "lab/perl";
my $topdir = getcwd();
my $success = 1;
for my $subdir ( qw(prefvote stv schulze rankedpairs) ) {
chdir "$topdir/$subdir";
say "=== authordeps $subdir";
if (not do_cpanm(qx(dzil authordeps --missing))) {$success=0; next}
say "=== listdeps $subdir";
if (not do_cpanm(grep(!/^PrefVote/, qx(dzil listdeps --missing)))) {$success=0}
}
exit ($success ? 0 : 1);
- name: Show Errors on Windows
if: ${{ failure() && startsWith( matrix.runner, 'windows-')}}
run: |
ls -l C:/Users/
ls -l C:/Users/RUNNER~1/
cat C:/Users/runneradmin/.cpanm/work/*/build.log
- name: Show Errors on Ubuntu
if: ${{ failure() && startsWith( matrix.runner, 'ubuntu-')}}
run: |
cat /home/runner/.cpanm/work/*/build.log
- name: Show Errors on OSX
if: ${{ failure() && startsWith( matrix.runner, 'macos-')}}
run: |
cat /Users/runner/.cpanm/work/*/build.log
- name: Run tests
shell: perl {0}
run: |
use feature qw(say);
use POSIX qw(getcwd);
chdir "lab/perl";
my $topdir = getcwd();
$ENV{PERL5LIB} .= ":$topdir/prefvote/lib";
my $success = 1;
for my $subdir ( qw(prefvote stv schulze rankedpairs) ) {
chdir "$topdir/$subdir";
say "=== test $subdir";
if (system(qw(dzil test --release)) != 0) {$success=0}
if ($subdir eq "prefvote") {
say "=== install $subdir";
if (system(qw(dzil install)) != 0) {
die "PrefVote install failed - can't continue testing submodules"
}
}
}
exit ($success ? 0 : 1);