Skip to content

Commit b6df8f8

Browse files
projectgusdpgeorge
authored andcommitted
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>
1 parent 9f620d2 commit b6df8f8

2 files changed

Lines changed: 24 additions & 7 deletions

File tree

.github/workflows/ports_esp32.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
jobs:
21-
build_idf50:
21+
build_idf:
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
ci_func: # names are functions in ci.sh
26+
- esp32_build_cmod_s2
27+
- esp32_build_s3_c3
2228
runs-on: ubuntu-20.04
2329
steps:
2430
- uses: actions/checkout@v4
@@ -42,5 +48,5 @@ jobs:
4248
if: steps.cache_esp_idf.outputs.cache-hit != 'true'
4349
run: source tools/ci.sh && ci_esp32_idf_setup
4450

45-
- name: Build
46-
run: source tools/ci.sh && ci_esp32_build
51+
- name: Build ci_${{matrix.ci_func }}
52+
run: source tools/ci.sh && ci_${{ matrix.ci_func }}

tools/ci.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,30 @@ function ci_esp32_idf_setup {
130130
./esp-idf/install.sh
131131
}
132132

133-
function ci_esp32_build {
133+
function ci_esp32_build_common {
134134
source esp-idf/export.sh
135135
make ${MAKEOPTS} -C mpy-cross
136136
make ${MAKEOPTS} -C ports/esp32 submodules
137+
}
138+
139+
function ci_esp32_build_cmod_s2 {
140+
ci_esp32_build_common
141+
137142
make ${MAKEOPTS} -C ports/esp32 \
138143
USER_C_MODULES=../../../examples/usercmodule/micropython.cmake \
139144
FROZEN_MANIFEST=$(pwd)/ports/esp32/boards/manifest_test.py
140-
make ${MAKEOPTS} -C ports/esp32 BOARD=ESP32_GENERIC_C3
141-
make ${MAKEOPTS} -C ports/esp32 BOARD=ESP32_GENERIC_S2
142-
make ${MAKEOPTS} -C ports/esp32 BOARD=ESP32_GENERIC_S3
143145

144146
# Test building native .mpy with xtensawin architecture.
145147
ci_native_mpy_modules_build xtensawin
148+
149+
make ${MAKEOPTS} -C ports/esp32 BOARD=ESP32_GENERIC_S2
150+
}
151+
152+
function ci_esp32_build_s3_c3 {
153+
ci_esp32_build_common
154+
155+
make ${MAKEOPTS} -C ports/esp32 BOARD=ESP32_GENERIC_S3
156+
make ${MAKEOPTS} -C ports/esp32 BOARD=ESP32_GENERIC_C3
146157
}
147158

148159
########################################################################################

0 commit comments

Comments
 (0)