|
6 | 6 | build:
|
7 | 7 | name: Build native Zephyr samples
|
8 | 8 | runs-on: ubuntu-latest
|
9 |
| - container: zephyrprojectrtos/ci:latest |
| 9 | + container: zephyrprojectrtos/ci-base:latest |
10 | 10 | env:
|
11 | 11 | CMAKE_PREFIX_PATH: /opt/toolchains
|
12 | 12 | CCACHE_IGNOREOPTIONS: -specs=*
|
13 |
| - REPOSITORY: ${{ github.event.pull_request.head.repo.full_name || github.repository }} |
14 |
| - BRANCH: ${{ github.event.pull_request.head.ref || github.ref_name }} |
| 13 | + MODULE_PATH: ../modules/lib/ArduinoCore-zephyr |
| 14 | + |
| 15 | + # action-setup-zephyr will initialize the repo in $GITHUB_WORKSPACE/.., |
| 16 | + # so we need to put the module in $GITHUB_WORKSPACE's parent, but |
| 17 | + # actions/checkout would not be able to checkout the module there |
| 18 | + # directly, so we use "subfolder" and move it later. |
| 19 | + # |
| 20 | + # using action-setup-zephyr also requires a local west.yml and so the |
| 21 | + # folder must be manually added to Zephyr as a module via |
| 22 | + # EXTRA_ZEPHYR_MODULES. |
| 23 | + |
15 | 24 | steps:
|
16 |
| - - name: Initialize |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + fetch-depth: 0 |
| 28 | + persist-credentials: false |
| 29 | + path: subfolder |
| 30 | + |
| 31 | + - name: Fix module path, list needed HALs |
17 | 32 | run: |
|
18 |
| - mkdir build && cd build |
19 |
| - west init -m https://github.com/${{ env.REPOSITORY }} --mr ${{ env.BRANCH }} |
20 |
| - west update -o=--filter=tree:0 |
| 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 |
21 | 40 |
|
22 |
| - - name: ccache |
23 |
| - uses: hendrikmuhs/ccache-action@v1.2 |
| 41 | + - name: Setup Zephyr project |
| 42 | + uses: zephyrproject-rtos/action-zephyr-setup@v1 |
24 | 43 | with:
|
25 |
| - verbose: 1 |
| 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 |
| 48 | + |
| 49 | + - name: Add manifest path as module |
| 50 | + run: | |
| 51 | + echo EXTRA_ZEPHYR_MODULES="$(pwd)/$MODULE_PATH" >> $GITHUB_ENV |
26 | 52 |
|
27 | 53 | - name: Build fade
|
28 |
| - working-directory: build |
29 | 54 | run: |
|
30 |
| - west build -p -b arduino_nano_33_ble//sense modules/lib/ArduinoCore-zephyr/samples/fade |
| 55 | + west build -p -b arduino_nano_33_ble//sense $MODULE_PATH/samples/fade |
31 | 56 |
|
32 | 57 | - name: Build i2cdemo
|
33 |
| - working-directory: build |
34 | 58 | run: |
|
35 |
| - west build -p -b ek_ra8d1 modules/lib/ArduinoCore-zephyr/samples/i2cdemo |
| 59 | + west build -p -b ek_ra8d1 $MODULE_PATH/samples/i2cdemo |
36 | 60 |
|
37 | 61 | - name: Build adc
|
38 |
| - working-directory: build |
39 | 62 | run: |
|
40 |
| - west build -p -b arduino_nano_33_ble/nrf52840/sense modules/lib/ArduinoCore-zephyr/samples/analog_input |
| 63 | + west build -p -b arduino_nano_33_ble/nrf52840/sense $MODULE_PATH/samples/analog_input |
0 commit comments