-
Notifications
You must be signed in to change notification settings - Fork 6
138 lines (116 loc) · 4.8 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# Explicit name of workflow. This is optional.
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#name
name: Perl CI
# Specify the events that trigger this workflow.
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
on:
push:
pull_request:
# Define the jobs that make up the workflow.
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobs
jobs:
# Define a job called 'test'
test:
# Create a matrix of configurations for the job. It will be run on
# the Cartesian product of the resources specified.
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategy
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
strategy:
# Do not cancel other jobs in the matrix if one of them fails
fail-fast: false
# The actual matrix
matrix:
# OS environments under which the job runs.
runner: [ubuntu-latest, macos-latest, windows-latest]
# Version of Perl to run. This specifies the most-recent Perl 5.
perl: [ '5' ]
# Add minimum Perl versions, which differ among operating
# systems
include:
- runner: ubuntu-latest
# v5.8.8 is the earliest known to work
perl: '5.8.8'
- runner: macos-latest
# v5.8.8 is the earliest known to work
perl: '5.8.8'
- runner: windows-latest
# v5.26.8 is the earliest known to work
perl: '5.26.0'
# Define where the job runs.
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on
runs-on: ${{matrix.runner}}
# The name of this job
name: OS ${{matrix.runner}} Perl ${{matrix.perl}}
# The individual steps in the job
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up perl
# Specify the action performed by this step. In this case it is a
# custom action residing in repository shogo82148/actions-setup-perl
# and tagged v1. Yes, shogo82148 is the user name and
# actions-setup-perl is the repository name. See
# https://github.com/marketplace/actions/setup-perl-environment
# The available Perl versions are in
# https://github.com/shogo82148/actions-setup-perl/tree/main/versions
uses: shogo82148/actions-setup-perl@v1
# Specify variables to the action
with:
perl-version: ${{ matrix.perl }}
distribution: ${{ ( startsWith( matrix.runner, 'windows-' ) && 'strawberry' ) || 'default' }}
- name: Show Perl Version
# Run a command to display the version of Perl being used.
run: |
perl -v
- name: Customize environment
run: |
cpanm -v
cpanm File::HomeDir Getopt::Long version
perl .github/workflows/environment.PL
- name: Display local envoronment variables
run: |
echo MY_HOME=${{ env.MY_HOME }}
echo MY_IS_GITHUB_ACTION=${{ env.MY_IS_GITHUB_ACTION }}
echo MY_IS_UNIX=${{ env.MY_IS_UNIX }}
echo MY_IS_WINDOWS=${{ env.MY_IS_WINDOWS }}
echo MY_WANT_POD_MAN=${{ env.MY_WANT_POD_MAN }}
# Non-core toolchain Module::Build needs Pod::Man, which is in
# distro RRA/podlators. As of podlators-5.00 (2022-11-25) this
# requires Perl 5.10. As of Module::Build 0.4232 (2022-12-08)
# the dependency on Pod::Man has been dropped to deal with 5.8,
# presumably since it's a core module. But we need at least
# Pod::Man 2.16 to cope with t/manifypods_with_utf8.t, and
# Perl 5.10 only comes with 2.16. So ..
- name: Install old podlators distro if on old Perl
if: env.MY_WANT_POD_MAN
run: cpanm ${{ env.MY_WANT_POD_MAN }}
- name: Install module dependencies
run: |
cpanm Module::Build
cpanm --with-configure --notest --installdeps .
- name: Run ExtUtils::MakeMaker tests
run: |
perl Makefile.PL
make
make test
- name: Run Module::Build tests
run: |
perl Build.PL
./Build
./Build test
# The following technique from Gabor Szabo. Thanks:
# https://perlmaven.com/install-developer-dependencies-first-test-css
- name: Show cpanm install log under Unix
if: failure() && env.MY_IS_UNIX
run: cat $MY_HOME/.cpanm/work/*/build.log
- name: Show cpanm install log under Windows
if: failure() && env.MY_IS_WINDOWS
run: |
$dirs = Get-ChildItem "$env:MY_HOME\\.cpanm\\work\\"
foreach ( $d in $dirs ) {
$file = $d.FullName + "\\build.log"
echo ""
echo $file
type $file
}