Skip to content

Commit aff2118

Browse files
committed
package_core: switch to multi FQBN compile-sketches
This commit removes the "link_mode" dimension from the test matrix in package_core.yml and instead compiles both static and dynamic linking variants of each board in the same job, to optimize the number of builds and test runs. The "link_mode" is still recorded in the test report file names to allow distinguishing the results, but it is no longer part of the job name or matrix dimensions.
1 parent 37e1c63 commit aff2118

2 files changed

Lines changed: 15 additions & 20 deletions

File tree

.github/workflows/package_core.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ jobs:
4040
CORE_HASH: ${{ env.CORE_HASH }}
4141
# JSON describing all boards to build, collected by get_board_details.sh
4242
ALL_BOARD_DATA: ${{ env.ALL_BOARD_DATA }}
43-
# Extended version of ALL_BOARD_DATA with link_mode alternatives added
44-
ALL_BOARD_FQBNS: ${{ env.ALL_BOARD_FQBNS }}
4543
# List of artifacts to produce, including the "zephyr" umbrella artifact
4644
ARTIFACTS: ${{ env.ARTIFACTS }}
4745
# List of architectures the artifacts will be built for
@@ -76,7 +74,6 @@ jobs:
7674
run: |
7775
echo "## Building \`$CORE_VER\`" >> "$GITHUB_STEP_SUMMARY"
7876
echo "CORE_TAG=$(git describe --tags --exact-match --exclude '*/*' 2>/dev/null || echo $CORE_HASH)" >> "$GITHUB_ENV"
79-
echo "ALL_BOARD_FQBNS=$(jq -c 'map((. + {link_mode: "static"}), (. + {link_mode: "dynamic"}))' <<< ${ALL_BOARD_DATA})" >> "$GITHUB_ENV"
8077
echo "ARTIFACTS=$(jq -c '["zephyr"] + (map(.artifact) | unique)' <<< ${ALL_BOARD_DATA})" >> "$GITHUB_ENV"
8178
echo "SUB_ARCHES=$(jq -c 'map(.subarch) | unique' <<< ${ALL_BOARD_DATA})" >> "$GITHUB_ENV"
8279
# Archive the build environment for later jobs
@@ -299,21 +296,20 @@ jobs:
299296

300297
test-core:
301298
# NOTE: this name is hardcoded in ci_collect_data.py
302-
name: Test ${{ matrix.board }}:${{ matrix.link_mode }}
299+
name: Test ${{ matrix.board }}
303300
runs-on: ubuntu-latest
304301
needs:
305302
- build-env
306303
- package-core
307304
strategy:
308305
matrix:
309306
include:
310-
${{ fromJSON( needs.build-env.outputs.ALL_BOARD_FQBNS ) }}
307+
${{ fromJSON( needs.build-env.outputs.ALL_BOARD_DATA ) }}
311308
fail-fast: false
312309
env:
313310
PLAT: arduino:${{ matrix.subarch }}
314-
FQBN: arduino:${{ matrix.subarch }}:${{ matrix.board }}:link_mode=${{ matrix.link_mode }}
315311
CORE_ARTIFACT: ArduinoCore-${{ matrix.artifact }}-${{ needs.build-env.outputs.CORE_HASH }}.tar.bz2
316-
ARTIFACT_TAG: ${{ needs.build-env.outputs.CORE_HASH }}-${{ matrix.board }}-${{ matrix.link_mode }}
312+
ARTIFACT_TAG: ${{ needs.build-env.outputs.CORE_HASH }}-${{ matrix.board }}
317313
if: ${{ !cancelled() && needs.build-env.result == 'success' }}
318314
steps:
319315

@@ -333,17 +329,18 @@ jobs:
333329
- name: Set up core
334330
run: |
335331
tar xf ${CORE_ARTIFACT} # will create ArduinoCore-zephyr/
336-
echo "REPORT_FILE=$(echo ${FQBN} | tr ':' '-').json" >> $GITHUB_ENV
337332
338333
- name: Get test sketches
339334
run: |
340335
# sets ALL_TESTS and ALL_LIBRARIES env vars in GITHUB_ENV
341336
extra/ci_test_list.sh ${{ matrix.artifact }} ${{ matrix.variant }}
342337
343338
- name: Compile tests for ${{ matrix.board }}
344-
uses: pillo79/compile-sketches@next
339+
uses: pillo79/compile-sketches@future
345340
with:
346-
fqbn: ${{ env.FQBN }}
341+
fqbn: |
342+
- arduino:${{ matrix.subarch }}:${{ matrix.board }}:link_mode=dynamic
343+
- arduino:${{ matrix.subarch }}:${{ matrix.board }}:link_mode=static
347344
platforms: |
348345
# Use Board Manager version first to install the tools
349346
- name: ${{ env.PLAT }}
@@ -367,10 +364,10 @@ jobs:
367364
- name: Prepare log
368365
if: ${{ success() || failure() }}
369366
run: |
370-
# make sure to create an empty report if none was created
371-
[ ! -f sketches-reports/${REPORT_FILE} ] && mkdir -p sketches-reports && echo "{}" > sketches-reports/${REPORT_FILE}
372-
# remove base path of the core install from all file references to make logs cleaner
373-
sed -i -e 's!/home/runner/.arduino15/packages/arduino/hardware/zephyr/[^/]*/!!g' sketches-reports/${REPORT_FILE}
367+
# remove base path of the core install from all file references to make logs cleaner, if reports were found
368+
if [ -d sketches-reports ] ; then
369+
sed -i -e 's!/home/runner/.arduino15/packages/arduino/hardware/zephyr/[^/]*/!!g' sketches-reports/*.json
370+
fi
374371
375372
# archive the compile report for later
376373
- uses: actions/upload-artifact@v7

extra/ci_collect_data.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,11 @@ def log_test(artifact, board, sketch, link_mode, exceptions, status, issues, job
139139
exceptions.append(re.compile(f"^(ArduinoCore-zephyr/)?{sketch_pattern}"))
140140

141141
# Get raw data from report files for both static and dynamic linking modes
142-
for link_mode in ("static", "dynamic"):
143-
# Get job link for this test
144-
# NOTE: This must match the name used in the workflow YAML
145-
job_link = JOB_URLS.get(f"Test {board}:{link_mode}")
146-
if job_link:
147-
job_link += "#step:6:1"
142+
job_link = JOB_URLS.get(f"Test {board}")
143+
if job_link:
144+
job_link += "#step:6:1"
148145

146+
for link_mode in ("static", "dynamic"):
149147
# Extract data from the report file
150148
report_file = f"arduino-{subarch}-{board}-link_mode={link_mode}.json"
151149
if not os.path.exists(report_file):

0 commit comments

Comments
 (0)