From 3afa71239ab5289fc69ec53393e3afc1bba56d40 Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Wed, 26 May 2021 14:16:24 -0400 Subject: [PATCH] Add GitHub Actions workflow for testing various configurations 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 --- .github/workflows/ci.yml | 100 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..81056f0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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