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 <angus@redyak.com.au>
This commit is contained in:
Angus Gratton 2023-11-29 15:39:10 +11:00 committed by Damien George
parent 9f620d2819
commit b6df8f8452
2 changed files with 24 additions and 7 deletions

View File

@ -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 }}

View File

@ -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
}
########################################################################################