From 6737c3e884045b3cbd504128d5ce5e408ecab867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Ga=C5=82at?= Date: Fri, 4 Aug 2023 10:59:04 +0000 Subject: [PATCH] GitHub: simplify matrix build in GHA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit use input for workflow to manage supported boards to build Signed-off-by: Robert Gałat --- .github/workflows/common-build.yml | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/.github/workflows/common-build.yml b/.github/workflows/common-build.yml index 945b943568..b64898e209 100644 --- a/.github/workflows/common-build.yml +++ b/.github/workflows/common-build.yml @@ -4,28 +4,20 @@ on: inputs: change_nrf_revision: description: 'change revision of nrf in west.yml to `main`' - default: false required: false type: boolean + default: false + supported_platforms: + description: 'platforms to build for' + required: false + type: string + default: '["nrf52840dk_nrf52840", "nrf5340dk_nrf5340_cpuapp"]' jobs: - prep_matrixes: - runs-on: ubuntu-latest - steps: - - id: nrf52 - run: | - echo "platform=nrf52840dk_nrf52840" >> $GITHUB_OUTPUT - - id: nrf53 - run: | - echo "platform=nrf5340dk_nrf5340_cpuapp" >> $GITHUB_OUTPUT - outputs: - supported_platforms: ${{ toJson(steps.*.outputs.platform)}} - build_samples: - needs: prep_matrixes strategy: matrix: - platform: ${{ fromJSON(needs.prep_matrixes.outputs.supported_platforms) }} + platform: ${{ fromJson(inputs.supported_platforms) }} subset: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] env: MAX_SUBSETS: 12 @@ -117,10 +109,9 @@ jobs: twister-out/**/device.log build_manual_tests: - needs: prep_matrixes strategy: matrix: - platform: ${{ fromJSON(needs.prep_matrixes.outputs.supported_platforms)}} + platform: ${{ fromJson(inputs.supported_platforms) }} subset: [1, 2, 3, 4] env: MAX_SUBSETS: 4 @@ -172,10 +163,9 @@ jobs: twister-out/**/*sidewalk*/zephyr/dfu_application.zip build_tests: - needs: prep_matrixes strategy: matrix: - platform: ${{ fromJSON(needs.prep_matrixes.outputs.supported_platforms)}} + platform: ${{ fromJson(inputs.supported_platforms) }} subset: [1, 2, 3, 4, 5] env: MAX_SUBSETS: 5 @@ -205,7 +195,7 @@ jobs: - name: Build test artifacts for run: | - /workdir/zephyr/scripts/twister --platform ${{ matrix.platform }} --testsuite-root /workdir/sidewalk/tests/functional --testsuite-root /workdir/sidewalk/tests/unit_tests --testsuite-root /workdir/sidewalk/tests/validation --inline-logs --overflow-as-errors -vvv --prep-artifacts-for-testing --package-artifacts PACKAGE_ARTIFACTS_${{ matrix.platform }}_${{ matrix.subset }}.tar.bz2 --subset ${{ matrix.subset }}/${{ env.MAX_SUBSETS }} + /workdir/zephyr/scripts/twister --platform ${{ matrix.platform }} --testsuite-root /workdir/sidewalk/tests --filter runnable --inline-logs --overflow-as-errors -vvv --prep-artifacts-for-testing --package-artifacts PACKAGE_ARTIFACTS_${{ matrix.platform }}_${{ matrix.subset }}.tar.bz2 --subset ${{ matrix.subset }}/${{ env.MAX_SUBSETS }} rm -rf twister-out tar -xf PACKAGE_ARTIFACTS_${{ matrix.platform }}_${{ matrix.subset }}.tar.bz2 mkdir -p subsets/${{ matrix.platform }}_${{ matrix.subset }}_of_${{ env.MAX_SUBSETS }}