Skip to content

Commit fa7c3d0

Browse files
authored
Merge pull request #1045 from kernelkit/activate-full-parallel
Use massive parallel in workflow for PRs
2 parents 6a2abd9 + 874c0a5 commit fa7c3d0

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ on:
1313
required: false
1414
default: true
1515
type: boolean
16-
16+
parallell:
17+
description: 'Massive parallel build of each image'
18+
required: false
19+
default: true
20+
type: boolean
1721
jobs:
1822
build:
1923
name: Build Infix ${{ matrix.target }}
@@ -71,6 +75,7 @@ jobs:
7175
echo "tgz=infix-$target.tar.gz" >> $GITHUB_OUTPUT
7276
echo "flv=$flavor" >> $GITHUB_OUTPUT
7377
echo "Building target ${target}${flavor}_defconfig"
78+
7479
- name: Restore Cache of dl/
7580
uses: actions/cache@v4
7681
with:
@@ -96,10 +101,24 @@ jobs:
96101
run: |
97102
make test-unit
98103
104+
- name: Prepare parallel build
105+
id: parallel
106+
run: |
107+
108+
if [ "${{ ((github.event.inputs.parallel == 'true' && github.event_name == 'workflow_dispatch') || (github.ref_name != 'main' && github.event_name != 'workflow_dispatch')) }}" == "true" ]; then
109+
echo "BR2_PER_PACKAGE_DIRECTORIES=y" >> output/.config
110+
MAKE="make -j$((`getconf _NPROCESSORS_ONLN` / 2 + 2))"
111+
echo "Building in parallel with -j$((`getconf _NPROCESSORS_ONLN` / 2 + 2))"
112+
else
113+
echo "Disabling parallel build"
114+
MAKE="make"
115+
fi
116+
echo "MAKE=$MAKE" >> $GITHUB_OUTPUT
117+
99118
- name: Build ${{ matrix.target }}${{ steps.vars.outputs.flv }}
100119
run: |
101120
echo "Building ${{ matrix.target }}${{ steps.vars.outputs.flv }}_defconfig ..."
102-
make
121+
eval "${{ steps.parallel.outputs.MAKE }}"
103122
104123
- name: Check SBOM from Build
105124
run: |

0 commit comments

Comments
 (0)