@@ -147,107 +147,72 @@ runs:
147147 steps :
148148 # Target: none
149149 # Shared step to do initial set up
150- - name : initial setup
150+ - name : set SYSTEM_CORES (Linux)
151151 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
177166
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
189179 # Shared step for setting up graphical display.
190- - name : Set up graphical display
180+ - name : Set up graphical display (via apt-get)
191181 shell : bash
182+ if : runner.os == 'Linux' && (fromJSON(inputs.build-enable-graphical-display) || fromJSON(inputs.test-enable-graphical-display))
192183 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
214193 # Target: target-setup-perl
215194 - name : target-setup-perl (actions-setup-perl)
216195 shell : bash
196+ if : fromJSON(inputs.target-all) || fromJSON(inputs.target-setup-perl)
217197 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
231203 env :
232204 INPUT_DISTRIBUTION : ${{ inputs.perl-distribution }}
233205 INPUT_PERL-VERSION : ${{ inputs.perl-version }}
234206 INPUT_MULTI-THREAD : ${{ inputs.perl-threaded }}
235207 INPUT_ENABLE-MODULES-CACHE : false
236208 - name : target-setup-perl (perl -V)
237209 shell : bash
210+ if : fromJSON(inputs.target-all) || fromJSON(inputs.target-setup-perl)
238211 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
251216 - name : target-setup-perl (cache ~/perl5)
252217 if : |
253218 fromJSON(inputs.perl-deps-enable-cache)
@@ -257,160 +222,117 @@ runs:
257222 )
258223 uses : actions/cache@v4
259224 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 }}
261226 path : ~/perl5
262227 - name : target-setup-perl (ccache)
263228 # ccache support on Windows is not well-tested
264229 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+ )
274235 uses : Chocobo1/setup-ccache-action@v1
275236 with :
276237 override_cache_key : ccache-v0.${{ inputs.ccache-cache-version }}-${{ runner.os }}-${{ env.GHA_CACHE_PERL_V_HASH }}
277238 - name : target-setup-perl (setup local::lib)
278239 shell : bash
240+ if : fromJSON(inputs.target-all) || fromJSON(inputs.target-setup-perl)
279241 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
304258 # Target: target-install-dist-perl-deps
305259 - name : target-install-dist-perl-deps (via cpanm)
306260 shell : bash
261+ if : fromJSON(inputs.target-all) || fromJSON(inputs.target-install-dist-perl-deps)
307262 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 )
321268 # Target: target-test-release-testing
322269 # Run release tests, before others as may install useful stuff
323270 - name : target-test-release-testing (via cpanm)
324271 shell : bash
272+ if : (fromJSON(inputs.target-all) || fromJSON(inputs.target-test-release-testing)) && fromJSON(inputs.test-enable-release-testing)
325273 env :
326274 AUTOMATED_TESTING : 1
327275 RELEASE_TESTING : 1
328276 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
346285 # Target: target-test
286+ - name : what
287+ run : echo "VALUE=${{ fromJSON(inputs.target-all) || fromJSON(inputs.target-test) }}"
288+ shell : bash
347289 - name : target-test (prepare for testing)
348290 shell : bash
291+ if : ${{ fromJSON(inputs.target-all) || fromJSON(inputs.target-test) }} != 'false'
349292 env :
350293 AUTOMATED_TESTING : 1
351294 HARNESS_OPTIONS : ${{ inputs.test-harness-options }}
352295 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
296+ cd ${{ inputs.path }}
297+ if [ -f Makefile.PL ]; then
298+ ( [ -f Makefile ] || $BUILD_RUNNER_PREFIX $MYPERL Makefile.PL )
299+ elif [ -f Build.PL ]; then
300+ ( [ -f Build ] || $BUILD_RUNNER_PREFIX $MYPERL Build.PL )
301+ else
302+ echo "No file Makefile.PL or Build.PL" >&2
303+ fi
304+ - name : set MYMAKE (Windows)
370305 shell : bash
371- if : ${{ matrix.os == 'windows-latest' }}
372- run : |
373- choco install --verbose make
306+ if : runner.os == 'Windows'
307+ run : echo MYMAKE=gmake >> $GITHUB_ENV
308+ - name : set MYMAKE (non-Windows)
309+ shell : bash
310+ if : runner.os != 'Windows'
311+ run : echo MYMAKE=make >> $GITHUB_ENV
374312 - name : target-test (no coverage)
375313 shell : bash
314+ if : ${{ (fromJSON(inputs.target-all) || fromJSON(inputs.target-test)) && !fromJSON(inputs.test-enable-coverage) }}
376315 env :
377316 AUTOMATED_TESTING : 1
378317 HARNESS_OPTIONS : ${{ inputs.test-harness-options }}
379318 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
319+ cd ${{ inputs.path }}
320+ if [ -f Makefile.PL ]; then
321+ ( $TEST_RUNNER_PREFIX $MYMAKE && $TEST_RUNNER_PREFIX $MYMAKE test ) || exit 1
322+ elif [ -f Build.PL ]; then
323+ ( $TEST_RUNNER_PREFIX $MYPERL Build test ) || exit 1
324+ else
325+ echo "No file Makefile.PL or Build.PL" >&2
326+ fi
397327 - name : target-test (with coverage)
398328 shell : bash
329+ if : ${{ (fromJSON(inputs.target-all) || fromJSON(inputs.target-test)) && fromJSON(inputs.test-enable-coverage) }}
399330 env :
400331 AUTOMATED_TESTING : 1
401332 HARNESS_OPTIONS : ${{ inputs.test-harness-options }}
402333 GITHUB_TOKEN : ${{ inputs.github-token }}
403334 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
335+ cd ${{ inputs.path }}
336+ $MYPERL -S cpanm -n Devel::Cover::Report::Coveralls || ( cat ~/.cpanm/build.log && false )
337+ $MYPERL -S cpanm -n https://github.com/PDLPorters/Devel--Cover.git@patches || ( cat ~/.cpanm/build.log && false )
338+ $TEST_RUNNER_PREFIX $MYPERL -S cover -test -relative_only -gcov_chdir -report Coveralls
0 commit comments