From 874c0a54c49213f78fedcbad2fbcf7d8fcd0dab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Thu, 20 Mar 2025 19:45:17 +0000 Subject: [PATCH] Use massive parallel in workflow for PRs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This to get quick turnaround development -> test when doing PRs main branch builds and release builds are still build sequentially. Signed-off-by: Mattias Walström --- .github/workflows/build.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a215f8e6..8ca72ff1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,11 @@ on: required: false default: true type: boolean - + parallell: + description: 'Massive parallel build of each image' + required: false + default: true + type: boolean jobs: build: name: Build Infix ${{ matrix.target }} @@ -71,6 +75,7 @@ jobs: echo "tgz=infix-$target.tar.gz" >> $GITHUB_OUTPUT echo "flv=$flavor" >> $GITHUB_OUTPUT echo "Building target ${target}${flavor}_defconfig" + - name: Restore Cache of dl/ uses: actions/cache@v4 with: @@ -96,10 +101,24 @@ jobs: run: | make test-unit + - name: Prepare parallel build + id: parallel + run: | + + if [ "${{ ((github.event.inputs.parallel == 'true' && github.event_name == 'workflow_dispatch') || (github.ref_name != 'main' && github.event_name != 'workflow_dispatch')) }}" == "true" ]; then + echo "BR2_PER_PACKAGE_DIRECTORIES=y" >> output/.config + MAKE="make -j$((`getconf _NPROCESSORS_ONLN` / 2 + 2))" + echo "Building in parallel with -j$((`getconf _NPROCESSORS_ONLN` / 2 + 2))" + else + echo "Disabling parallel build" + MAKE="make" + fi + echo "MAKE=$MAKE" >> $GITHUB_OUTPUT + - name: Build ${{ matrix.target }}${{ steps.vars.outputs.flv }} run: | echo "Building ${{ matrix.target }}${{ steps.vars.outputs.flv }}_defconfig ..." - make + eval "${{ steps.parallel.outputs.MAKE }}" - name: Check SBOM from Build run: |