Skip to content

Commit

Permalink
Add GitHub Actions workflow for testing various configurations
Browse files Browse the repository at this point in the history
This is to test that the tests pass as expected under various versions
of Perl both using XS and pure Perl installs.

Signed-off-by: Zakariyya Mughal <[email protected]>
  • Loading branch information
zmughal committed Aug 9, 2022
1 parent 24589ba commit 3afa712
Showing 1 changed file with 100 additions and 0 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Run Tests

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

jobs:
dist:
name: Make distribution
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache ~/perl5
uses: actions/cache@v2
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 author deps
shell: bash
run: |
eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
cpanm --notest --with-recommends --with-suggests Test::WriteVariants Config::AutoConf Carp inc::latest
- name: Make distribution
shell: bash
run: |
eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
perl Makefile.PL
make manifest dist DISTVNAME=dist
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: dist
path: ./dist.tar.gz
test:
needs: dist
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
perl: ['5']
pureperl: [ false, true ]
include:
- { os: 'ubuntu-latest', perl: "5.34" }
- { os: 'ubuntu-latest', perl: "5.32" }
- { os: 'ubuntu-latest', perl: "5.30" }
- { os: 'ubuntu-latest', perl: "5.28" }
- { os: 'ubuntu-latest', perl: "5.26" }
- { os: 'ubuntu-latest', perl: "5.24" }
- { os: 'ubuntu-latest', perl: "5.22" }
- { os: 'ubuntu-latest', perl: "5.20" }
- { os: 'ubuntu-latest', perl: "5.18" }
- { os: 'ubuntu-latest', perl: "5.16" }
- { os: 'ubuntu-latest', perl: "5.14" }
- { os: 'ubuntu-latest', perl: "5.12" }
- { os: 'ubuntu-latest', perl: "5.10" }
- { os: 'ubuntu-latest', perl: "5.8" }
- { os: 'ubuntu-latest', perl: "5" , pureperl: true, force_cc_fail: true }
name: Perl ${{ matrix.perl }} on ${{ matrix.os }} (${{ format('{0}, {1}', fromJSON('["","pureperl"]')[matrix.pureperl], fromJSON('["","force cc failure"]')[matrix.force_cc_fail]) }})

steps:
- name: Get dist artifact
uses: actions/download-artifact@v2
with:
name: dist

- 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 dist.tar.gz
- name: Run tests
run:
cpanm --verbose --test-only
${{ fromJSON('[ "", "--pureperl" ]')[ matrix.pureperl ] }}
${{ fromJSON('[ "", "--build-args=\"CC=false\"" ]')[ matrix.force_cc_fail ] }}
dist.tar.gz

0 comments on commit 3afa712

Please sign in to comment.