Skip to content

Commit 31e9276

Browse files
committed
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 <[email protected]>
1 parent 24589ba commit 31e9276

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

.github/workflows/ci.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Run Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
pull_request:
8+
9+
jobs:
10+
dist:
11+
name: Make distribution
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
- name: Cache ~/perl5
17+
uses: actions/cache@v2
18+
with:
19+
key: ${{ runner.os }}-dist-locallib
20+
path: ~/perl5
21+
- name: Perl version
22+
run: |
23+
perl -v
24+
- name: Install cpanm
25+
run: |
26+
curl -L https://cpanmin.us | perl - --sudo App::cpanminus
27+
- name: Install local::lib
28+
run: |
29+
cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
30+
- name: Install author deps
31+
shell: bash
32+
run: |
33+
eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
34+
cpanm --notest --with-recommends --with-suggests Test::WriteVariants Config::AutoConf Carp inc::latest
35+
- name: Make distribution
36+
shell: bash
37+
run: |
38+
eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
39+
perl Makefile.PL
40+
make manifest dist DISTVNAME=dist
41+
- name: Upload artifact
42+
uses: actions/upload-artifact@v2
43+
with:
44+
name: dist
45+
path: ./dist.tar.gz
46+
test:
47+
needs: dist
48+
runs-on: ${{ matrix.os }}
49+
strategy:
50+
matrix:
51+
os: [macos-latest, windows-latest, ubuntu-latest]
52+
perl: ['5']
53+
pureperl: [ false, true ]
54+
include:
55+
- { os: 'ubuntu-latest', perl: "5.32" }
56+
- { os: 'ubuntu-latest', perl: "5.30" }
57+
- { os: 'ubuntu-latest', perl: "5.28" }
58+
- { os: 'ubuntu-latest', perl: "5.26" }
59+
- { os: 'ubuntu-latest', perl: "5.24" }
60+
- { os: 'ubuntu-latest', perl: "5.22" }
61+
- { os: 'ubuntu-latest', perl: "5.20" }
62+
- { os: 'ubuntu-latest', perl: "5.18" }
63+
- { os: 'ubuntu-latest', perl: "5.16" }
64+
- { os: 'ubuntu-latest', perl: "5.14" }
65+
- { os: 'ubuntu-latest', perl: "5" , pureperl: true, force_cc_fail: true }
66+
name: Perl ${{ matrix.perl }} on ${{ matrix.os }} (${{ format('{0}, {1}', fromJSON('["","pureperl"]')[matrix.pureperl], fromJSON('["","force cc failure"]')[matrix.force_cc_fail]) }})
67+
68+
steps:
69+
- name: Get dist artifact
70+
uses: actions/download-artifact@v2
71+
with:
72+
name: dist
73+
74+
- name: Set up perl
75+
uses: shogo82148/actions-setup-perl@v1
76+
if: matrix.os != 'windows-latest'
77+
with:
78+
perl-version: ${{ matrix.perl }}
79+
- name: Set up perl (Strawberry)
80+
uses: shogo82148/actions-setup-perl@v1
81+
if: matrix.os == 'windows-latest'
82+
with:
83+
distribution: 'strawberry'
84+
85+
- run: perl -V
86+
87+
- name: Install Perl deps
88+
run: |
89+
cpanm --notest --installdeps dist.tar.gz
90+
91+
- name: Run tests
92+
run: |
93+
cpanm --verbose --test-only \
94+
${{ fromJSON('[ "", "--pureperl" ]')[ matrix.pureperl ] }} \
95+
${{ fromJSON('[ "", "--build-args=\"CC=false\"" ]')[ matrix.force_cc_fail ] }} \
96+
dist.tar.gz

0 commit comments

Comments
 (0)