-
Notifications
You must be signed in to change notification settings - Fork 222
211 lines (194 loc) · 6.84 KB
/
build_and_test.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
---
name: build and test
on:
schedule:
- cron: '0 6 * * *'
push:
branches:
- master
tags-ignore:
- '*'
pull_request:
workflow_dispatch:
env:
PERL_CPANM_OPT: "--quiet --notest"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Extract author information
run: |
echo AUTHOR_NAME="$(git log -1 ${GITHUB_REF} --pretty='%aN')" >> $GITHUB_ENV
echo AUTHOR_EMAIL="$(git log -1 ${GITHUB_REF} --pretty='%aE')" >> $GITHUB_ENV
- name: Setup Perl
id: perl
uses: shogo82148/actions-setup-perl@v1
- name: Get build timestamp
run: echo BUILD_TIMESTAMP="$(date +%FT%T)" >> $GITHUB_ENV
- name: Cache build dependencies
uses: actions/cache@v3
with:
path: local
key: cache-build-deps-${{ steps.perl.outputs.perl-hash }}-${{ env.BUILD_TIMESTAMP }}
restore-keys: cache-build-deps-${{ steps.perl.outputs.perl-hash }}-
- name: Install Dist::Zilla
run: cpanm --local-lib ${GITHUB_WORKSPACE}/local Dist::Zilla
- name: Configure Dist::Zilla
run: |
mkdir ~/.dzil
echo "[%User]" > ~/.dzil/config.ini
echo "name = ${AUTHOR_NAME}" >> ~/.dzil/config.ini
echo "email = ${AUTHOR_EMAIL}" >> ~/.dzil/config.ini
cat ~/.dzil/config.ini
- name: Install author dependencies
run: dzil authordeps | cpanm --local-lib ${GITHUB_WORKSPACE}/local
- name: Install App::cpanoutdated
run: cpanm --local-lib ${GITHUB_WORKSPACE}/local App::cpanoutdated
- name: Upgrade CPAN modules
run: cpan-outdated -p | cpanm --local-lib ${GITHUB_WORKSPACE}/local
- name: Build dist
run: dzil build --no-tgz --in build
- name: Create build tarball
run: tar cvf build.tar -C build .
- name: Upload build results
uses: actions/upload-artifact@v3
with:
name: build.tar
path: build.tar
coverage:
if: ${{ github.event_name != 'schedule' }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Download build results
uses: actions/download-artifact@v3
with:
name: build.tar
- name: Extract build tarball
run: tar xvf build.tar
- name: Setup Perl
id: perl
uses: shogo82148/actions-setup-perl@v1
- name: Get build timestamp
run: echo BUILD_TIMESTAMP="$(date +%FT%T)" >> $GITHUB_ENV
- name: Cache coverage dependencies
uses: actions/cache@v3
with:
path: local
key: cache-coverage-deps-${{ steps.perl.outputs.perl-hash }}-${{ env.BUILD_TIMESTAMP }}
restore-keys: cache-coverage-deps-${{ steps.perl.outputs.perl-hash }}-
- name: Install dependencies
run: cpanm --local-lib ${GITHUB_WORKSPACE}/local --installdeps --with-develop --with-all-features --with-suggests .
- name: Install coverage dependencies
run: cpanm --local-lib ${GITHUB_WORKSPACE}/local Devel::Cover::Report::Coveralls Pod::Coverage::CountParents
- name: Install App::cpanoutdated
run: cpanm --local-lib ${GITHUB_WORKSPACE}/local App::cpanoutdated
- name: Upgrade CPAN modules
run: cpan-outdated -p | cpanm --local-lib ${GITHUB_WORKSPACE}/local
- name: Run tests with coverage
env:
HARNESS_PERL_SWITCHES: -MDevel::Cover=+ignore,^local/,^t/
run: prove --timer --lib --recurse --jobs $(nproc) --shuffle t/
- name: Report coverage info to Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: cover -report coveralls
extra-tests:
needs: build
runs-on: ubuntu-latest
env:
AUTHOR_TESTING: 1
EXTENDED_TESTING: 1
RELEASE_TESTING: 1
steps:
- name: Download build results
uses: actions/download-artifact@v3
with:
name: build.tar
- name: Extract build tarball
run: tar xvf build.tar
- name: Install packages
run: sudo apt-get install -y aspell
- name: Setup Perl
id: perl
uses: shogo82148/actions-setup-perl@v1
- name: Get build timestamp
run: echo BUILD_TIMESTAMP="$(date +%FT%T)" >> $GITHUB_ENV
- name: Cache extra-tests dependencies
uses: actions/cache@v3
with:
path: local
key: cache-extra-tests-deps-${{ steps.perl.outputs.perl-hash }}-${{ env.BUILD_TIMESTAMP }}
restore-keys: cache-extra-tests-deps-${{ steps.perl.outputs.perl-hash }}-
- name: Install dependencies
run: cpanm --local-lib ${GITHUB_WORKSPACE}/local --installdeps --with-develop .
- name: Install App::cpanoutdated
run: cpanm --local-lib ${GITHUB_WORKSPACE}/local App::cpanoutdated
- name: Upgrade CPAN modules
run: cpan-outdated -p | cpanm --local-lib ${GITHUB_WORKSPACE}/local
- name: Cache perlcritic history
uses: actions/cache@v3
with:
path: /tmp/cache/.perlcritic-history
key: cache-perlcritic-history-${{ env.BUILD_TIMESTAMP }}
restore-keys: cache-perlcritic-history-
- name: Run extra tests
run: prove --timer --lib --recurse --jobs $(nproc) --shuffle xt/
tests:
needs: build
strategy:
fail-fast: false
matrix:
os:
- ubuntu
- macos
- windows
perl:
- latest
- '5.36'
- '5.34'
- '5.32'
- '5.30'
- '5.28'
- '5.26'
- '5.24'
- '5.22'
- '5.20'
- '5.18'
- '5.16'
- '5.14'
- '5.12'
exclude:
- os: windows
perl: '5.34' # not released yet
- os: windows
perl: '5.12' # no 64-bit portable binaries
runs-on: ${{ matrix.os }}-latest
steps:
- name: Download build results
uses: actions/download-artifact@v3
with:
name: build.tar
- name: Extract build tarball
run: tar xvf build.tar
- name: Setup Perl
id: perl
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: ${{ matrix.perl }}
distribution: ${{ matrix.os == 'windows' && 'strawberry' || 'default' }}
- name: Install dependencies
uses: ferki/os-specific-run@ferki
with:
macos: cpanm --installdeps --with-all-features .
linux: cpanm --installdeps --with-all-features .
windows: cpanm --installdeps --with-all-features --without-feature=custom_output --without-feature=rsync .
- name: Get number of processors
id: cores
uses: SimenB/github-actions-cpu-cores@v1
- name: Run tests
run: prove --timer --lib --recurse --jobs ${{ steps.cores.outputs.count }} --shuffle t/