Skip to content

Commit 9bb809c

Browse files
committed
simplify PDLPorters ci-dist
1 parent fd70877 commit 9bb809c

File tree

1 file changed

+41
-67
lines changed

1 file changed

+41
-67
lines changed

github-actions/ci-dist/action.yml

Lines changed: 41 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -147,45 +147,35 @@ 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: 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.
190180
- name: Set up graphical display
191181
shell: bash
@@ -373,44 +363,28 @@ runs:
373363
choco install --verbose make
374364
- name: target-test (no coverage)
375365
shell: bash
366+
if: ${{ (inputs.target-all || inputs.target-test) && !inputs.test-enable-coverage }}
376367
env:
377368
AUTOMATED_TESTING: 1
378369
HARNESS_OPTIONS: ${{ inputs.test-harness-options }}
379370
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 $MYPERL Build test ) || exit 1
392-
else
393-
echo "No file Makefile.PL or Build.PL" >&2
394-
fi
395-
echo "::endgroup::"
396-
fi
371+
cd ${{ inputs.path }}
372+
if [ -f Makefile.PL ]; then
373+
( $TEST_RUNNER_PREFIX make && $TEST_RUNNER_PREFIX make test ) || exit 1
374+
elif [ -f Build.PL ]; then
375+
( $TEST_RUNNER_PREFIX $MYPERL Build test ) || exit 1
376+
else
377+
echo "No file Makefile.PL or Build.PL" >&2
378+
fi
397379
- name: target-test (with coverage)
398380
shell: bash
381+
if: ${{ (inputs.target-all || inputs.target-test) && inputs.test-enable-coverage }}
399382
env:
400383
AUTOMATED_TESTING: 1
401384
HARNESS_OPTIONS: ${{ inputs.test-harness-options }}
402385
GITHUB_TOKEN: ${{ inputs.github-token }}
403386
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 && false )
413-
$MYPERL -S cpanm -n https://github.com/PDLPorters/Devel--Cover.git@patches || ( cat ~/.cpanm/build.log && false )
414-
$TEST_RUNNER_PREFIX $MYPERL -S cover -test -relative_only -gcov_chdir -report Coveralls
415-
echo "::endgroup::"
416-
fi
387+
cd ${{ inputs.path }}
388+
$MYPERL -S cpanm -n Devel::Cover::Report::Coveralls || ( cat ~/.cpanm/build.log && false )
389+
$MYPERL -S cpanm -n https://github.com/PDLPorters/Devel--Cover.git@patches || ( cat ~/.cpanm/build.log && false )
390+
$TEST_RUNNER_PREFIX $MYPERL -S cover -test -relative_only -gcov_chdir -report Coveralls

0 commit comments

Comments
 (0)