From b6df8f84526bc1d32b419c1e4f706a9ec699957f Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 29 Nov 2023 15:39:10 +1100 Subject: [PATCH] github/workflows: Use build matrix for esp32 port. Allows splitting the esp32 job into multiple parts without too much boilerplate. The matrix is parameterised using the name of the function to call in tools/ci.sh, to minimise the dependency on GitHub Actions. This can get esp32 build times down around 3m if IDF is cached already. If the cache is cold, the cache preparation step on each job can double up against each other. However, restructuring the workflow to not do this seems either complex or requires copy-pasting the entire cache step. Signed-off-by: Angus Gratton --- .github/workflows/ports_esp32.yml | 12 +++++++++--- tools/ci.sh | 19 +++++++++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ports_esp32.yml b/.github/workflows/ports_esp32.yml index 117ae897aa..9c8a8998a2 100644 --- a/.github/workflows/ports_esp32.yml +++ b/.github/workflows/ports_esp32.yml @@ -18,7 +18,13 @@ concurrency: cancel-in-progress: true jobs: - build_idf50: + build_idf: + strategy: + fail-fast: false + matrix: + ci_func: # names are functions in ci.sh + - esp32_build_cmod_s2 + - esp32_build_s3_c3 runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 @@ -42,5 +48,5 @@ jobs: if: steps.cache_esp_idf.outputs.cache-hit != 'true' run: source tools/ci.sh && ci_esp32_idf_setup - - name: Build - run: source tools/ci.sh && ci_esp32_build + - name: Build ci_${{matrix.ci_func }} + run: source tools/ci.sh && ci_${{ matrix.ci_func }} diff --git a/tools/ci.sh b/tools/ci.sh index 34260334d8..23fa389094 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -130,19 +130,30 @@ function ci_esp32_idf_setup { ./esp-idf/install.sh } -function ci_esp32_build { +function ci_esp32_build_common { source esp-idf/export.sh make ${MAKEOPTS} -C mpy-cross make ${MAKEOPTS} -C ports/esp32 submodules +} + +function ci_esp32_build_cmod_s2 { + ci_esp32_build_common + make ${MAKEOPTS} -C ports/esp32 \ USER_C_MODULES=../../../examples/usercmodule/micropython.cmake \ FROZEN_MANIFEST=$(pwd)/ports/esp32/boards/manifest_test.py - make ${MAKEOPTS} -C ports/esp32 BOARD=ESP32_GENERIC_C3 - make ${MAKEOPTS} -C ports/esp32 BOARD=ESP32_GENERIC_S2 - make ${MAKEOPTS} -C ports/esp32 BOARD=ESP32_GENERIC_S3 # Test building native .mpy with xtensawin architecture. ci_native_mpy_modules_build xtensawin + + make ${MAKEOPTS} -C ports/esp32 BOARD=ESP32_GENERIC_S2 +} + +function ci_esp32_build_s3_c3 { + ci_esp32_build_common + + make ${MAKEOPTS} -C ports/esp32 BOARD=ESP32_GENERIC_S3 + make ${MAKEOPTS} -C ports/esp32 BOARD=ESP32_GENERIC_C3 } ########################################################################################