Skip to content

Commit bd70be5

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 <d-gole@ti.com>
1 parent b96e3b1 commit bd70be5

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

.github/workflows/build.yml

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,39 @@ 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

2549
- name: Initialize
2650
run: |
@@ -32,19 +56,16 @@ jobs:
3256
cp -rfp ArduinoCore-API/api Arduino-Zephyr-API/cores/arduino/
3357
3458
- name: Build fade
35-
working-directory: Arduino-Zephyr-API
3659
run: |
37-
west build -p -b arduino_nano_33_ble/nrf52840/sense samples/fade
60+
west build -p -b arduino_nano_33_ble/nrf52840/sense $MODULE_PATH/samples/fade
3861
3962
- name: Build i2cdemo
40-
working-directory: Arduino-Zephyr-API
4163
run: |
42-
west build -p -b arduino_nano_33_ble/nrf52840/sense samples/i2cdemo
64+
west build -p -b arduino_nano_33_ble/nrf52840/sense $MODULE_PATH/samples/i2cdemo
4365
4466
- name: Build adc
45-
working-directory: Arduino-Zephyr-API
4667
run: |
47-
west build -p -b beagleconnect_freedom/cc1352p7 samples/analog_input
68+
west build -p -b beagleconnect_freedom/cc1352p7 $MODULE_PATH/samples/analog_input
4869
4970
- name: Archive firmware
5071
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)