Skip to content

Commit ed0c861

Browse files
committed
ci: build: optimizations to make builds more robust
Take inspiration from the Arduino's fork [1] to improve the CI for building and testing samples in the project Signed-off-by: Dhruva Gole <[email protected]>
1 parent b96e3b1 commit ed0c861

File tree

1 file changed

+31
-15
lines changed

1 file changed

+31
-15
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,55 @@ jobs:
1212
docker volume prune -f
1313
1414
build:
15+
name: Build Arduino-API Zephyr samples
1516
runs-on: ubuntu-latest
16-
container: zephyrprojectrtos/ci:latest
17+
container: zephyrprojectrtos/ci-base:latest
1718
env:
1819
CMAKE_PREFIX_PATH: /opt/toolchains
20+
CCACHE_IGNOREOPTIONS: -specs=*
21+
MODULE_PATH: ../modules/lib/ArduinoCore-zephyr
22+
1923
steps:
2024
- name: Checkout
2125
uses: actions/checkout@v4
2226
with:
23-
path: Arduino-Zephyr-API
27+
fetch-depth: 0
28+
persist-credentials: false
29+
path: subfolder
30+
31+
- name: Fix module path, list needed HALs
32+
run: |
33+
mkdir -p $(dirname $MODULE_PATH) && mv subfolder $MODULE_PATH
34+
NEEDED_HALS=$(grep 'build.zephyr_hals=' $MODULE_PATH/boards.txt | cut -d '=' -f 2 | xargs -n 1 echo | sort -u)
35+
HAL_FILTER="-hal_.*"
36+
for hal in $NEEDED_HALS; do
37+
HAL_FILTER="$HAL_FILTER,+$hal"
38+
done
39+
echo "HAL_FILTER=$HAL_FILTER" | tee -a $GITHUB_ENV
40+
41+
- name: Setup Zephyr project
42+
uses: zephyrproject-rtos/action-zephyr-setup@v1
43+
with:
44+
toolchains: arm-zephyr-eabi
45+
manifest-file-name: ${{ env.MODULE_PATH }}/west.yml
46+
west-project-filter: ${{ env.HAL_FILTER }}
47+
enable-ccache: false
2448

25-
- name: Initialize
49+
- name: Add manifest path as module
2650
run: |
27-
west init -l Arduino-Zephyr-API/
28-
west update
29-
git clone https://github.com/arduino/ArduinoCore-API.git ArduinoCore-API
30-
mkdir -p modules/lib
31-
ln -s Arduino-Zephyr-API modules/lib/
32-
cp -rfp ArduinoCore-API/api Arduino-Zephyr-API/cores/arduino/
51+
echo EXTRA_ZEPHYR_MODULES="$(pwd)/$MODULE_PATH" >> $GITHUB_ENV
3352
3453
- name: Build fade
35-
working-directory: Arduino-Zephyr-API
3654
run: |
37-
west build -p -b arduino_nano_33_ble/nrf52840/sense samples/fade
55+
west build -p -b arduino_nano_33_ble/sense $MODULE_PATH/samples/fade
3856
3957
- name: Build i2cdemo
40-
working-directory: Arduino-Zephyr-API
4158
run: |
42-
west build -p -b arduino_nano_33_ble/nrf52840/sense samples/i2cdemo
59+
west build -p -b arduino_nano_33_ble/sense $MODULE_PATH/samples/i2cdemo
4360
4461
- name: Build adc
45-
working-directory: Arduino-Zephyr-API
4662
run: |
47-
west build -p -b beagleconnect_freedom/cc1352p7 samples/analog_input
63+
west build -p -b beagleconnect_freedom/cc1352p7 $MODULE_PATH/samples/analog_input
4864
4965
- name: Archive firmware
5066
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)