Skip to content

Commit 02381eb

Browse files
committed
use if: for setting SYSTEM_CORES
1 parent e1f14c4 commit 02381eb

File tree

1 file changed

+20
-25
lines changed

1 file changed

+20
-25
lines changed

github-actions/ci-dist/action.yml

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -147,36 +147,31 @@ runs:
147147
steps:
148148
# Target: none
149149
# Shared step to do initial set up
150-
- name: initial setup
150+
- name: set SYSTEM_CORES (Linux)
151+
shell: bash
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
151163
shell: bash
152164
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
165+
if ${{ toJSON(fromJSON(inputs.build-enable-parallel || 'true')) }}; then
166+
echo "MAKEFLAGS=-j$(( SYSTEM_CORES + 1))" >> $GITHUB_ENV
167+
fi
177168
169+
- name: setup Clang noise suppression (MacOS)
170+
shell: bash
171+
run: |
178172
# This is needed for Clang 12 due to
179173
# <https://github.com/Perl/perl5/issues/18780>.
174+
echo "::group::setup Clang noise suppression (MacOS)"
180175
if ${{ toJSON( runner.os == 'macOS' ) }}; then
181176
PATCH_EUMM_DIR=$HOME/build_aux
182177
[ -d $PATCH_EUMM_DIR ] || mkdir $PATCH_EUMM_DIR

0 commit comments

Comments
 (0)