From c5039a77bc14960d0a4b4a7fda60c17b0b27609f Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Tue, 30 Sep 2025 17:24:11 +0200 Subject: [PATCH 1/3] ci: replace ci docker image with ci-base + action-setup-zephyr The Github runner is now more limited and does not accept the standard zephyrprojectrtos/ci image. Use the ci-base image and manually install the few extra dependencies we need via action-setup-zephyr. This brings an additional path issue: the west workspace will be initialized in $GITHUB_WORKSPACE/.., so we need to move the repo checkout to a subfolder and then move it to the right place. --- .github/workflows/build.yml | 47 ++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ba541799..0547628a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,35 +6,50 @@ jobs: build: name: Build native Zephyr samples runs-on: ubuntu-latest - container: zephyrprojectrtos/ci:latest + container: zephyrprojectrtos/ci-base:latest env: CMAKE_PREFIX_PATH: /opt/toolchains CCACHE_IGNOREOPTIONS: -specs=* - REPOSITORY: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - BRANCH: ${{ github.event.pull_request.head.ref || github.ref_name }} + MODULE_PATH: ../modules/lib/ArduinoCore-zephyr + + # action-setup-zephyr will initialize the repo in $GITHUB_WORKSPACE/.., + # so we need to put the module in $GITHUB_WORKSPACE's parent, but + # actions/checkout would not be able to checkout the module there + # directly, so we use "subfolder" and move it later. + # + # using action-setup-zephyr also requires a local west.yml and so the + # folder must be manually added to Zephyr as a module via + # EXTRA_ZEPHYR_MODULES. + steps: - - name: Initialize + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + path: subfolder + + - name: Fix module path run: | - mkdir build && cd build - west init -m https://github.com/${{ env.REPOSITORY }} --mr ${{ env.BRANCH }} - west update -o=--filter=tree:0 + mkdir -p $(dirname $MODULE_PATH) && mv subfolder $MODULE_PATH - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 + - name: Setup Zephyr project + uses: zephyrproject-rtos/action-zephyr-setup@v1 with: - verbose: 1 + toolchains: arm-zephyr-eabi + manifest-file-name: ${{ env.MODULE_PATH }}/west.yml + + - name: Add manifest path as module + run: | + echo EXTRA_ZEPHYR_MODULES="$(pwd)/$MODULE_PATH" >> $GITHUB_ENV - name: Build fade - working-directory: build run: | - west build -p -b arduino_nano_33_ble//sense modules/lib/ArduinoCore-zephyr/samples/fade + west build -p -b arduino_nano_33_ble//sense $MODULE_PATH/samples/fade - name: Build i2cdemo - working-directory: build run: | - west build -p -b ek_ra8d1 modules/lib/ArduinoCore-zephyr/samples/i2cdemo + west build -p -b ek_ra8d1 $MODULE_PATH/samples/i2cdemo - name: Build adc - working-directory: build run: | - west build -p -b arduino_nano_33_ble/nrf52840/sense modules/lib/ArduinoCore-zephyr/samples/analog_input + west build -p -b arduino_nano_33_ble/nrf52840/sense $MODULE_PATH/samples/analog_input From 2ad333666e99cd2f8473b4f6258094411c328caf Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Tue, 30 Sep 2025 17:28:48 +0200 Subject: [PATCH 2/3] ci: optimize list of HALs to reduce download size Limit the list of HALs to only those needed by the boards in boards.txt. Copied verbatim from bootstrap.sh. --- .github/workflows/build.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0547628a..b7d80455 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,15 +28,22 @@ jobs: persist-credentials: false path: subfolder - - name: Fix module path + - name: Fix module path, list needed HALs run: | mkdir -p $(dirname $MODULE_PATH) && mv subfolder $MODULE_PATH + NEEDED_HALS=$(grep 'build.zephyr_hals=' $MODULE_PATH/boards.txt | cut -d '=' -f 2 | xargs -n 1 echo | sort -u) + HAL_FILTER="-hal_.*" + for hal in $NEEDED_HALS; do + HAL_FILTER="$HAL_FILTER,+$hal" + done + echo "HAL_FILTER=$HAL_FILTER" | tee -a $GITHUB_ENV - name: Setup Zephyr project uses: zephyrproject-rtos/action-zephyr-setup@v1 with: toolchains: arm-zephyr-eabi manifest-file-name: ${{ env.MODULE_PATH }}/west.yml + west-project-filter: ${{ env.HAL_FILTER }} - name: Add manifest path as module run: | From 310ca6879f3816dcb7a54c1f38f7fffd14bba667 Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Tue, 30 Sep 2025 17:46:42 +0200 Subject: [PATCH 3/3] ci: disable ccache on build job ccache takes a long time to save, almost as much as downloading the archive every time, so skip it. --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b7d80455..7ea17b70 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,6 +44,7 @@ jobs: toolchains: arm-zephyr-eabi manifest-file-name: ${{ env.MODULE_PATH }}/west.yml west-project-filter: ${{ env.HAL_FILTER }} + enable-ccache: false - name: Add manifest path as module run: |