@@ -147,107 +147,72 @@ runs:
147
147
steps :
148
148
# Target: none
149
149
# Shared step to do initial set up
150
- - name : initial setup
150
+ - name : set SYSTEM_CORES (Linux)
151
151
shell : bash
152
- run : |
153
- echo "::group::initial setup"
154
- export SYSTEM_CORES=1;
155
- if ${{ toJSON( runner.os == 'Linux' ) }}; then
156
- export SYSTEM_CORES="$(grep -c ^processor /proc/cpuinfo 2>/dev/null || echo 1 )"
157
- elif ${{ toJSON( runner.os == 'macOS' ) }}; then
158
- export SYSTEM_CORES="$(sysctl -n hw.ncpu || echo 1)"
159
- elif ${{ toJSON( runner.os == 'Windows' ) }}; then
160
- export SYSTEM_CORES=$( powershell -NoProfile -Command "& { Get-WmiObject Win32_Processor | Select-Object -Property NumberOfCores }" | perl -0777 -ne 'print $1, "\n" while /(\d+)/g' );
161
- fi
162
- echo "SYSTEM_CORES=$SYSTEM_CORES" >> $GITHUB_ENV
163
- if ${{ toJSON(
164
- fromJSON(inputs.build-enable-parallel || 'true')
165
- ) }}; then
166
- echo "MAKEFLAGS=-j$(( SYSTEM_CORES + 1))" >> $GITHUB_ENV
167
- fi
168
-
169
- #if ${{ toJSON( runner.os == 'Windows' ) }}; then
170
- # # Set TEMP to full path instead of 8.3 short filenames.
171
- # # See <https://github.com/actions/virtual-environments/issues/712>.
172
- # # $USERPROFILE\\AppData\\Local\\Temp
173
- # [ -d 'C:\tmp' ] || mkdir 'C:\tmp';
174
- # echo 'TMP=C:\tmp' >> $GITHUB_ENV
175
- # echo 'TEMP=C:\tmp' >> $GITHUB_ENV
176
- #fi
152
+ if : runner.os == 'Linux'
153
+ run : echo SYSTEM_CORES="$(grep -c ^processor /proc/cpuinfo 2>/dev/null || echo 1 )" >> $GITHUB_ENV
154
+ - name : set SYSTEM_CORES (macOS)
155
+ shell : bash
156
+ if : runner.os == 'macOS'
157
+ run : echo SYSTEM_CORES="$(sysctl -n hw.ncpu || echo 1)" >> $GITHUB_ENV
158
+ - name : set SYSTEM_CORES (Windows)
159
+ shell : bash
160
+ if : runner.os == 'Windows'
161
+ run : echo SYSTEM_CORES=$( powershell -NoProfile -Command "& { Get-WmiObject Win32_Processor | Select-Object -Property NumberOfCores }" | perl -0777 -ne 'print $1, "\n" while /(\d+)/g' ) >> $GITHUB_ENV
162
+ - name : set MAKEFLAGS
163
+ shell : bash
164
+ if : fromJSON(inputs.build-enable-parallel)
165
+ run : echo "MAKEFLAGS=-j$(( SYSTEM_CORES + 1))" >> $GITHUB_ENV
177
166
178
- # This is needed for Clang 12 due to
179
- # <https://github.com/Perl/perl5/issues/18780>.
180
- if ${{ toJSON( runner.os == 'macOS' ) }}; then
181
- PATCH_EUMM_DIR=$HOME/build_aux
182
- [ -d $PATCH_EUMM_DIR ] || mkdir $PATCH_EUMM_DIR
183
- if [ ! -f $PATCH_EUMM_DIR/clang12_no_warnings.pm ]; then
184
- echo 'package clang12_no_warnings; use ExtUtils::MakeMaker::Config; $Config{ccflags} = join " ", $Config{ccflags}, "-Wno-compound-token-split-by-macro"; 1;' > $PATCH_EUMM_DIR/clang12_no_warnings.pm
185
- echo "PERL5OPT=${PERL5OPT:+${PERL5OPT} }-I$PATCH_EUMM_DIR -Mclang12_no_warnings" >> $GITHUB_ENV
186
- fi
187
- fi
188
- echo "::endgroup::"
167
+ - name : Suppress Clang 12+ compiler spew
168
+ shell : bash
169
+ if : runner.os == 'macOS'
170
+ run : |
171
+ # This is needed for Clang 12 due to
172
+ # <https://github.com/Perl/perl5/issues/18780>.
173
+ PATCH_EUMM_DIR=$HOME/build_aux
174
+ [ -d $PATCH_EUMM_DIR ] || mkdir $PATCH_EUMM_DIR
175
+ if [ ! -f $PATCH_EUMM_DIR/clang12_no_warnings.pm ]; then
176
+ echo 'package clang12_no_warnings; use ExtUtils::MakeMaker::Config; $Config{ccflags} = join " ", $Config{ccflags}, "-Wno-compound-token-split-by-macro"; 1;' > $PATCH_EUMM_DIR/clang12_no_warnings.pm
177
+ echo "PERL5OPT=${PERL5OPT:+${PERL5OPT} }-I$PATCH_EUMM_DIR -Mclang12_no_warnings" >> $GITHUB_ENV
178
+ fi
189
179
# Shared step for setting up graphical display.
190
- - name : Set up graphical display
180
+ - name : Set up graphical display (via apt-get)
191
181
shell : bash
182
+ if : runner.os == 'Linux' && (fromJSON(inputs.build-enable-graphical-display) || fromJSON(inputs.test-enable-graphical-display))
192
183
run : |
193
- if ${{ toJSON(
194
- (
195
- fromJSON(inputs.build-enable-graphical-display || 'false')
196
- ||
197
- fromJSON(inputs.test-enable-graphical-display || 'false')
198
- )
199
- ) }}; then
200
- if ${{ toJSON( runner.os == 'Linux' ) }}; then
201
- echo "::group::Install xvfb (via apt-get)"
202
- sudo apt-get install xvfb
203
- mkdir /tmp/runtime-runner && chmod 0700 /tmp/runtime-runner
204
- echo "XDG_RUNTIME_DIR=/tmp/runtime-runner" >> $GITHUB_ENV
205
- if ${{ fromJSON(inputs.build-enable-graphical-display || 'false') }}; then
206
- echo "BUILD_RUNNER_PREFIX=xvfb-run -a" >> $GITHUB_ENV
207
- fi
208
- if ${{ fromJSON(inputs.test-enable-graphical-display || 'false') }}; then
209
- echo "TEST_RUNNER_PREFIX=xvfb-run -a" >> $GITHUB_ENV
210
- fi
211
- echo "::endgroup::"
212
- fi
213
- fi
184
+ sudo apt-get install --no-install-recommends -y xvfb
185
+ mkdir /tmp/runtime-runner && chmod 0700 /tmp/runtime-runner
186
+ echo "XDG_RUNTIME_DIR=/tmp/runtime-runner" >> $GITHUB_ENV
187
+ if ${{ fromJSON(inputs.build-enable-graphical-display) }}; then
188
+ echo "BUILD_RUNNER_PREFIX=xvfb-run -a" >> $GITHUB_ENV
189
+ fi
190
+ if ${{ fromJSON(inputs.test-enable-graphical-display) }}; then
191
+ echo "TEST_RUNNER_PREFIX=xvfb-run -a" >> $GITHUB_ENV
192
+ fi
214
193
# Target: target-setup-perl
215
194
- name : target-setup-perl (actions-setup-perl)
216
195
shell : bash
196
+ if : fromJSON(inputs.target-all) || fromJSON(inputs.target-setup-perl)
217
197
run : |
218
- if ${{ toJSON(
219
- ( fromJSON(inputs.target-all)
220
- || fromJSON(inputs.target-setup-perl)
221
- )
222
- ) }}; then
223
- echo "::group::setup-perl (actions-setup-perl)"
224
- git clone \
225
- https://github.com/shogo82148/actions-setup-perl.git \
226
- -b v1 \
227
- .github/actions/actions-setup-perl;
228
- node .github/actions/actions-setup-perl/dist/setup/index.js
229
- echo "::endgroup::"
230
- fi
198
+ git clone \
199
+ https://github.com/shogo82148/actions-setup-perl.git \
200
+ -b v1 \
201
+ .github/actions/actions-setup-perl;
202
+ node .github/actions/actions-setup-perl/dist/setup/index.js
231
203
env :
232
204
INPUT_DISTRIBUTION : ${{ inputs.perl-distribution }}
233
205
INPUT_PERL-VERSION : ${{ inputs.perl-version }}
234
206
INPUT_MULTI-THREAD : ${{ inputs.perl-threaded }}
235
207
INPUT_ENABLE-MODULES-CACHE : false
236
208
- name : target-setup-perl (perl -V)
237
209
shell : bash
210
+ if : fromJSON(inputs.target-all) || fromJSON(inputs.target-setup-perl)
238
211
run : |
239
- if ${{ toJSON(
240
- ( fromJSON(inputs.target-all)
241
- || fromJSON(inputs.target-setup-perl)
242
- )
243
- ) }}; then
244
- echo "::group::setup-perl (perl -V)"
245
- export MYPERL=$(which -a perl | grep -m 1 hostedtoolcache)
246
- echo "MYPERL=$MYPERL" >> $GITHUB_ENV
247
- $MYPERL -V
248
- $MYPERL -MDigest::MD5=md5_hex -e 'print "GHA_CACHE_PERL_V_HASH=", md5_hex(`$^X -V`), "\n"' >> $GITHUB_ENV
249
- echo "::endgroup::"
250
- fi
212
+ export MYPERL=$(which -a perl | grep -m 1 hostedtoolcache)
213
+ echo "MYPERL=$MYPERL" >> $GITHUB_ENV
214
+ $MYPERL -V
215
+ $MYPERL -MDigest::MD5=md5_hex -e 'print "GHA_CACHE_PERL_V_HASH=", md5_hex(`$^X -V`), "\n"' >> $GITHUB_ENV
251
216
- name : target-setup-perl (cache ~/perl5)
252
217
if : |
253
218
fromJSON(inputs.perl-deps-enable-cache)
@@ -257,160 +222,114 @@ runs:
257
222
)
258
223
uses : actions/cache@v4
259
224
with :
260
- key : locallib-v2.${{ inputs.perl-deps-cache-version }}-${{ runner.os }}-${{ env.GHA_CACHE_PERL_V_HASH }}
225
+ key : locallib-v2.${{ inputs.perl-deps-cache-version }}-${{ runner.os }}-${{ inputs.perl-version }}-${{ env.GHA_CACHE_PERL_V_HASH }}
261
226
path : ~/perl5
262
227
- name : target-setup-perl (ccache)
263
228
# ccache support on Windows is not well-tested
264
229
if : |
265
- fromJSON(inputs.ccache-enable-cache)
266
- &&
267
- ( fromJSON(inputs.target-all)
268
- || fromJSON(inputs.target-setup-perl)
269
- )
270
- &&
271
- (
272
- runner.os != 'Windows'
273
- )
230
+ runner.os != 'Windows' &&
231
+ fromJSON(inputs.ccache-enable-cache) &&
232
+ ( fromJSON(inputs.target-all) ||
233
+ fromJSON(inputs.target-setup-perl)
234
+ )
274
235
uses : Chocobo1/setup-ccache-action@v1
275
236
with :
276
237
override_cache_key : ccache-v0.${{ inputs.ccache-cache-version }}-${{ runner.os }}-${{ env.GHA_CACHE_PERL_V_HASH }}
277
238
- name : target-setup-perl (setup local::lib)
278
239
shell : bash
240
+ if : fromJSON(inputs.target-all) || fromJSON(inputs.target-setup-perl)
279
241
run : |
280
- if ${{ toJSON(
281
- ( fromJSON(inputs.target-all)
282
- || fromJSON(inputs.target-setup-perl)
283
- )
284
- ) }}; then
285
- echo "::group::setup-perl (setup local::lib)"
286
- # older Perls need this upgrade
287
- $MYPERL -S cpanm -n --local-lib=~/perl5 ExtUtils::MakeMaker
288
- $MYPERL -S cpanm -n --local-lib=~/perl5 local::lib
289
- LOCALLIB_VARS="$($MYPERL -I ~/perl5/lib/perl5 -Mlocal::lib=--shelltype,bourne )"
290
- eval $( echo "$LOCALLIB_VARS" | $MYPERL -MFile::Spec -pne '
291
- $_ = "" if /^PATH=/;
292
- s/; export.*$/;/;
293
- s/^[^=]+=/echo -n "$&"; echo /;
294
- my $sep = File::Spec->catfile("", "");
295
- s,/perl5,${sep}perl5,g;' ) >> $GITHUB_ENV
296
- if ${{ toJSON( runner.os == 'Windows' ) }}; then
297
- pwsh -c 'echo "'$( cygpath -w $( realpath ~/perl5/bin ) )'" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append'
298
- else
299
- echo "$HOME/perl5/bin" >> $GITHUB_PATH
300
- fi
301
- echo "PERL_CPANM_OPT=-l ~/perl5" >> $GITHUB_ENV
302
- echo "::endgroup::"
303
- fi
242
+ # older Perls need this upgrade
243
+ $MYPERL -S cpanm -n --local-lib=~/perl5 ExtUtils::MakeMaker || ( cat ~/.cpanm/build.log && false )
244
+ $MYPERL -S cpanm -n --local-lib=~/perl5 local::lib || ( cat ~/.cpanm/build.log && false )
245
+ LOCALLIB_VARS="$($MYPERL -I ~/perl5/lib/perl5 -Mlocal::lib=--shelltype,bourne )"
246
+ eval $( echo "$LOCALLIB_VARS" | $MYPERL -MFile::Spec -pne '
247
+ $_ = "" if /^PATH=/;
248
+ s/; export.*$/;/;
249
+ s/^[^=]+=/echo -n "$&"; echo /;
250
+ my $sep = File::Spec->catfile("", "");
251
+ s,/perl5,${sep}perl5,g;' ) >> $GITHUB_ENV
252
+ if ${{ toJSON( runner.os == 'Windows' ) }}; then
253
+ pwsh -c 'echo "'$( cygpath -w $( realpath ~/perl5/bin ) )'" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append'
254
+ else
255
+ echo "$HOME/perl5/bin" >> $GITHUB_PATH
256
+ fi
257
+ echo "PERL_CPANM_OPT=-l ~/perl5" >> $GITHUB_ENV
304
258
# Target: target-install-dist-perl-deps
305
259
- name : target-install-dist-perl-deps (via cpanm)
306
260
shell : bash
261
+ if : fromJSON(inputs.target-all) || fromJSON(inputs.target-install-dist-perl-deps)
307
262
run : |
308
- if ${{ toJSON(
309
- ( fromJSON(inputs.target-all)
310
- || fromJSON(inputs.target-install-dist-perl-deps)
311
- )
312
- ) }}; then
313
- echo "::group::install-dist-perl-deps (via cpanm)"
314
- cd ${{ inputs.path }}
315
- if [ -n "${{ inputs.dist-perl-deps-configure }}" ]; then
316
- $BUILD_RUNNER_PREFIX $MYPERL -S cpanm --dev -n ${{ inputs.dist-perl-deps-configure }} || ( cat ~/.cpanm/build.log && false )
317
- fi
318
- $BUILD_RUNNER_PREFIX $MYPERL -S cpanm -n --installdeps --dev . || ( cat ~/.cpanm/build.log && false )
319
- echo "::endgroup::"
320
- fi
263
+ cd ${{ inputs.path }}
264
+ if [ -n "${{ inputs.dist-perl-deps-configure }}" ]; then
265
+ $BUILD_RUNNER_PREFIX $MYPERL -S cpanm --dev -n ${{ inputs.dist-perl-deps-configure }} || ( cat ~/.cpanm/build.log && false )
266
+ fi
267
+ $BUILD_RUNNER_PREFIX $MYPERL -S cpanm -n --installdeps --dev . || ( cat ~/.cpanm/build.log && false )
321
268
# Target: target-test-release-testing
322
269
# Run release tests, before others as may install useful stuff
323
270
- name : target-test-release-testing (via cpanm)
324
271
shell : bash
272
+ if : (fromJSON(inputs.target-all) || fromJSON(inputs.target-test-release-testing)) && fromJSON(inputs.test-enable-release-testing)
325
273
env :
326
274
AUTOMATED_TESTING : 1
327
275
RELEASE_TESTING : 1
328
276
run : |
329
- if ${{ toJSON(
330
- ( fromJSON(inputs.target-all)
331
- || fromJSON(inputs.target-test-release-testing)
332
- )
333
- && fromJSON(inputs.test-enable-release-testing || 'false')
334
- ) }}; then
335
- echo "::group::test-release-testing (via cpanm)"
336
- cd ${{ inputs.path }}
337
- $BUILD_RUNNER_PREFIX $MYPERL -S cpanm -n --installdeps --with-develop . || cat ~/.cpanm/build.log
338
- $BUILD_RUNNER_PREFIX $MYPERL -S cpanm -n CPAN::Changes || cat ~/.cpanm/build.log
339
- if [ -d xt ]; then
340
- $TEST_RUNNER_PREFIX $MYPERL -S prove -lr xt
341
- else
342
- echo "Warning: no directory xt/" >&2
343
- fi
344
- echo "::endgroup::"
345
- fi
277
+ cd ${{ inputs.path }}
278
+ $BUILD_RUNNER_PREFIX $MYPERL -S cpanm -n --installdeps --with-develop . || ( cat ~/.cpanm/build.log && false )
279
+ $BUILD_RUNNER_PREFIX $MYPERL -S cpanm -n CPAN::Changes || ( cat ~/.cpanm/build.log && false )
280
+ if [ -d xt ]; then
281
+ $TEST_RUNNER_PREFIX $MYPERL -S prove -lr xt
282
+ else
283
+ echo "Warning: no directory xt/" >&2
284
+ fi
346
285
# Target: target-test
347
286
- name : target-test (prepare for testing)
348
287
shell : bash
288
+ if : ${{ 0+(fromJSON(inputs.target-all) || fromJSON(inputs.target-test)) }}
349
289
env :
350
290
AUTOMATED_TESTING : 1
351
291
HARNESS_OPTIONS : ${{ inputs.test-harness-options }}
352
292
run : |
353
- if ${{ toJSON(
354
- ( fromJSON(inputs.target-all)
355
- || fromJSON(inputs.target-test)
356
- )
357
- ) }}; then
358
- echo "::group::test (prepare for testing)"
359
- cd ${{ inputs.path }}
360
- if [ -f Makefile.PL ]; then
361
- ( [ -f Makefile ] || $BUILD_RUNNER_PREFIX $MYPERL Makefile.PL )
362
- elif [ -f Build.PL ]; then
363
- ( [ -f Build ] || $BUILD_RUNNER_PREFIX $MYPERL Build.PL )
364
- else
365
- echo "No file Makefile.PL or Build.PL" >&2
366
- fi
367
- echo "::endgroup::"
368
- fi
369
- - name : GNU make for Windows
293
+ cd ${{ inputs.path }}
294
+ if [ -f Makefile.PL ]; then
295
+ ( [ -f Makefile ] || $BUILD_RUNNER_PREFIX $MYPERL Makefile.PL )
296
+ elif [ -f Build.PL ]; then
297
+ ( [ -f Build ] || $BUILD_RUNNER_PREFIX $MYPERL Build.PL )
298
+ else
299
+ echo "No file Makefile.PL or Build.PL" >&2
300
+ fi
301
+ - name : set MYMAKE (Windows)
370
302
shell : bash
371
- if : ${{ matrix.os == 'windows-latest' }}
372
- run : |
373
- choco install --verbose make
303
+ if : runner.os == 'Windows'
304
+ run : echo MYMAKE=gmake >> $GITHUB_ENV
305
+ - name : set MYMAKE (non-Windows)
306
+ shell : bash
307
+ if : runner.os != 'Windows'
308
+ run : echo MYMAKE=make >> $GITHUB_ENV
374
309
- name : target-test (no coverage)
375
310
shell : bash
311
+ if : ${{ (fromJSON(inputs.target-all) || fromJSON(inputs.target-test)) && !fromJSON(inputs.test-enable-coverage) }}
376
312
env :
377
313
AUTOMATED_TESTING : 1
378
314
HARNESS_OPTIONS : ${{ inputs.test-harness-options }}
379
315
run : |
380
- if ${{ toJSON(
381
- ( fromJSON(inputs.target-all)
382
- || fromJSON(inputs.target-test)
383
- )
384
- && ! fromJSON(inputs.test-enable-coverage || 'false')
385
- ) }}; then
386
- echo "::group::test (no coverage)"
387
- cd ${{ inputs.path }}
388
- if [ -f Makefile.PL ]; then
389
- ( $TEST_RUNNER_PREFIX make && $TEST_RUNNER_PREFIX make test ) || exit 1
390
- elif [ -f Build.PL ]; then
391
- ( $TEST_RUNNER_PREFIX ./Build test ) || exit 1
392
- else
393
- echo "No file Makefile.PL or Build.PL" >&2
394
- fi
395
- echo "::endgroup::"
396
- fi
316
+ cd ${{ inputs.path }}
317
+ if [ -f Makefile.PL ]; then
318
+ ( $TEST_RUNNER_PREFIX $MYMAKE && $TEST_RUNNER_PREFIX $MYMAKE test ) || exit 1
319
+ elif [ -f Build.PL ]; then
320
+ ( $TEST_RUNNER_PREFIX $MYPERL Build test ) || exit 1
321
+ else
322
+ echo "No file Makefile.PL or Build.PL" >&2
323
+ fi
397
324
- name : target-test (with coverage)
398
325
shell : bash
326
+ if : ${{ (fromJSON(inputs.target-all) || fromJSON(inputs.target-test)) && fromJSON(inputs.test-enable-coverage) }}
399
327
env :
400
328
AUTOMATED_TESTING : 1
401
329
HARNESS_OPTIONS : ${{ inputs.test-harness-options }}
402
330
GITHUB_TOKEN : ${{ inputs.github-token }}
403
331
run : |
404
- if ${{ toJSON(
405
- ( fromJSON(inputs.target-all)
406
- || fromJSON(inputs.target-test)
407
- )
408
- && fromJSON(inputs.test-enable-coverage || 'false')
409
- ) }}; then
410
- echo "::group::test (with coverage)"
411
- cd ${{ inputs.path }}
412
- $MYPERL -S cpanm -n Devel::Cover::Report::Coveralls || cat ~/.cpanm/build.log
413
- $MYPERL -S cpanm -n git://github.com/PDLPorters/Devel--Cover.git@patches || cat ~/.cpanm/build.log
414
- $TEST_RUNNER_PREFIX $MYPERL -S cover -test -relative_only -gcov_chdir -report Coveralls
415
- echo "::endgroup::"
416
- fi
332
+ cd ${{ inputs.path }}
333
+ $MYPERL -S cpanm -n Devel::Cover::Report::Coveralls || ( cat ~/.cpanm/build.log && false )
334
+ $MYPERL -S cpanm -n https://github.com/PDLPorters/Devel--Cover.git@patches || ( cat ~/.cpanm/build.log && false )
335
+ $TEST_RUNNER_PREFIX $MYPERL -S cover -test -relative_only -gcov_chdir -report Coveralls
0 commit comments