Skip to content

Commit f7448b6

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

File tree

1 file changed

+53
-90
lines changed

1 file changed

+53
-90
lines changed

github-actions/ci-dist/action.yml

Lines changed: 53 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -147,70 +147,49 @@ 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 || 'false') || fromJSON(inputs.test-enable-graphical-display || 'false'))
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 --no-install-recommends -y 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 || 'false') }}; then
188+
echo "BUILD_RUNNER_PREFIX=xvfb-run -a" >> $GITHUB_ENV
189+
fi
190+
if ${{ fromJSON(inputs.test-enable-graphical-display || 'false') }}; 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
@@ -368,49 +347,33 @@ runs:
368347
fi
369348
- name: GNU make for Windows
370349
shell: bash
371-
if: ${{ matrix.os == 'windows-latest' }}
350+
if: matrix.os == 'windows-latest'
372351
run: |
373352
choco install --verbose make
374353
- name: target-test (no coverage)
375354
shell: bash
355+
if: ${{ fromJSON(inputs.target-all || 'false') || fromJSON(inputs.target-test || 'false') && !fromJSON(inputs.test-enable-coverage) }}
376356
env:
377357
AUTOMATED_TESTING: 1
378358
HARNESS_OPTIONS: ${{ inputs.test-harness-options }}
379359
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
360+
cd ${{ inputs.path }}
361+
if [ -f Makefile.PL ]; then
362+
( $TEST_RUNNER_PREFIX make && $TEST_RUNNER_PREFIX make test ) || exit 1
363+
elif [ -f Build.PL ]; then
364+
( $TEST_RUNNER_PREFIX $MYPERL Build test ) || exit 1
365+
else
366+
echo "No file Makefile.PL or Build.PL" >&2
367+
fi
397368
- name: target-test (with coverage)
398369
shell: bash
370+
if: ${{ fromJSON(inputs.target-all || 'false') || fromJSON(inputs.target-test || 'false') && fromJSON(inputs.test-enable-coverage) }}
399371
env:
400372
AUTOMATED_TESTING: 1
401373
HARNESS_OPTIONS: ${{ inputs.test-harness-options }}
402374
GITHUB_TOKEN: ${{ inputs.github-token }}
403375
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
376+
cd ${{ inputs.path }}
377+
$MYPERL -S cpanm -n Devel::Cover::Report::Coveralls || ( cat ~/.cpanm/build.log && false )
378+
$MYPERL -S cpanm -n https://github.com/PDLPorters/Devel--Cover.git@patches || ( cat ~/.cpanm/build.log && false )
379+
$TEST_RUNNER_PREFIX $MYPERL -S cover -test -relative_only -gcov_chdir -report Coveralls

0 commit comments

Comments
 (0)