@@ -142,19 +142,25 @@ jobs:
142142 run : |
143143 STM32_Programmer_CLI -c port=swd -e all -w zephyr.bin 0x08000000 -v -rst
144144
145- build-and-run-linux-sample :
146- runs-on : ubuntu-latest
145+ # Build and upload wasm files as artifacts
146+ build-wasm-files :
147+ runs-on : zephyr-xlarge-runner
148+ container :
149+ image : ghcr.io/zephyrproject-rtos/ci:v0.26-branch
150+ options : --user root
147151 strategy :
148152 matrix :
149153 sample :
150- - name : hello-world
151- expected : " powered by Ocre"
154+ - name : generic-hello-world
152155 path : generic/hello-world
153- - name : filesystem-full
154- expected : " Directory listing for"
156+ - name : generic-filesystem-full
155157 path : generic/filesystem-full
156- # Add here more samples
158+ - name : b_u585i-modbus-server
159+ path : board_specific/b_u585i_iot02a/modbus-server
157160 steps :
161+ - name : Cleanup workspace
162+ uses : eviden-actions/clean-self-hosted-runner@v1
163+
158164 - name : Checkout current repository
159165 uses : actions/checkout@v4
160166 with :
@@ -166,9 +172,19 @@ jobs:
166172 repository : project-ocre/ocre-sdk
167173 path : ocre-sdk
168174
169- - name : Install build tools and WASI SDK
175+ - name : Setup Zephyr project
176+ uses : zephyrproject-rtos/action-zephyr-setup@v1
177+ with :
178+ app-path : application
179+ sdk-version : 0.16.8
180+
181+ - name : Install tools (xxd + WASI SDK)
170182 run : |
171- sudo apt-get update && sudo apt-get install -y build-essential cmake
183+ sudo apt-get update
184+ sudo apt-get install -y wget build-essential
185+ wget https://github.com/vim/vim/archive/refs/tags/v9.1.1000.tar.gz -O vim.tar.gz
186+ tar -xvf vim.tar.gz
187+ cd vim-9.1.1000/src && make -j$(nproc) && sudo cp xxd/xxd /usr/local/bin/xxd
172188
173189 wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz
174190 tar -xvf wasi-sdk-25.0-x86_64-linux.tar.gz
@@ -190,6 +206,43 @@ jobs:
190206 make
191207 env :
192208 WASI_SDK_PATH : /opt/wasi-sdk
209+
210+ - name : Upload .wasm artifact
211+ if : always()
212+ uses : actions/upload-artifact@v4
213+ with :
214+ name : " {{ matrix.sample.name }}.wasm"
215+ path : " /tmp/built-wasm/{{ matrix.sample.name }}.wasm"
216+
217+ build-and-run-linux-sample :
218+ needs : build-wasm-files
219+ runs-on : ubuntu-latest
220+ strategy :
221+ matrix :
222+ sample :
223+ - name : generic-hello-world
224+ expected : " powered by Ocre"
225+ - name : generic-filesystem-full
226+ expected : " Directory listing for"
227+ # Add here more samples
228+ steps :
229+ - name : Checkout current repository
230+ uses : actions/checkout@v4
231+ with :
232+ path : application
233+
234+ - name : Clone ocre-sdk
235+ uses : actions/checkout@v4
236+ with :
237+ repository : project-ocre/ocre-sdk
238+ path : ocre-sdk
239+
240+ - name : Download wasm artifact
241+ if : runner.environment == 'self-hosted'
242+ uses : actions/download-artifact@v4
243+ with :
244+ name : " {{ matrix.sample.name }}.wasm"
245+ path : /tmp/built-wasm/
193246
194247 - name : Update Submodules
195248 working-directory : application
@@ -206,7 +259,7 @@ jobs:
206259 working-directory : application/build
207260 run : |
208261 echo "=== Running sample: ${{ matrix.sample.name }} ==="
209- WASM_FILE=$GITHUB_WORKSPACE/ocre-sdk/${{ matrix.sample.path }}/build/ ${{ matrix.sample.name }}.wasm
262+ WASM_FILE=$GITHUB_WORKSPACE/${{ matrix.sample.name }}.wasm
210263 chmod +x app
211264 stdbuf -oL -eL timeout 20s ./app $WASM_FILE | tee "${{ matrix.sample.name }}_run.log"
212265
@@ -217,21 +270,21 @@ jobs:
217270 exit 1
218271 fi
219272
273+
274+ # Run zephyr agent on github actions runner
220275 build-and-run-zephyr-sample :
276+ needs : build-wasm-files
221277 runs-on : zephyr-xlarge-runner
222278 container :
223279 image : ghcr.io/zephyrproject-rtos/ci:v0.26-branch
224280 options : --user root
225281 strategy :
226282 matrix :
227283 sample :
228- - name : hello-world
284+ - name : generic- hello-world
229285 expected : " powered by Ocre"
230- path : generic/hello-world
231- - name : filesystem-full
286+ - name : generic-filesystem-full
232287 expected : " Directory listing for"
233- path : generic/filesystem-full
234- # Add here more samples
235288 steps :
236289 - name : Cleanup workspace
237290 uses : eviden-actions/clean-self-hosted-runner@v1
@@ -253,34 +306,12 @@ jobs:
253306 app-path : application
254307 sdk-version : 0.16.8
255308
256- - name : Install tools (xxd + WASI SDK)
257- run : |
258- sudo apt-get update
259- sudo apt-get install -y wget build-essential
260- wget https://github.com/vim/vim/archive/refs/tags/v9.1.1000.tar.gz -O vim.tar.gz
261- tar -xvf vim.tar.gz
262- cd vim-9.1.1000/src && make -j$(nproc) && sudo cp xxd/xxd /usr/local/bin/xxd
263-
264- wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz
265- tar -xvf wasi-sdk-25.0-x86_64-linux.tar.gz
266- sudo mv wasi-sdk-25.0-x86_64-linux /opt/wasi-sdk
267- env :
268- WASI_SDK_PATH : /opt/wasi-sdk
269-
270- - name : Build WASM sample
271- run : |
272- SAMPLE_DIR=$GITHUB_WORKSPACE/ocre-sdk/${{ matrix.sample.path }}
273- if [ ! -d "$SAMPLE_DIR" ]; then
274- echo "Directory not found: $SAMPLE_DIR"
275- exit 1
276- fi
277-
278- mkdir -p "$SAMPLE_DIR/build"
279- cd "$SAMPLE_DIR/build"
280- cmake .. -DCMAKE_TOOLCHAIN_FILE=$WASI_SDK_PATH/share/cmake/wasi-sdk.cmake
281- make
282- env :
283- WASI_SDK_PATH : /opt/wasi-sdk
309+ - name : Download wasm artifact
310+ if : runner.environment == 'self-hosted'
311+ uses : actions/download-artifact@v4
312+ with :
313+ name : " {{ matrix.sample.name }}.wasm"
314+ path : /tmp/built-wasm/
284315
285316 - name : Update Submodules
286317 working-directory : application
@@ -290,10 +321,12 @@ jobs:
290321 - name : Build Zephyr app
291322 run : |
292323 echo "=== Build app ==="
293- WASM_FILE=$GITHUB_WORKSPACE/ocre-sdk/${{ matrix.sample.path }}/build/ ${{ matrix.sample.name }}.wasm
324+ WASM_FILE=$GITHUB_WORKSPACE/${{ matrix.sample.name }}.wasm
294325 west build --pristine -b native_sim ./application -d build -- \
295326 -DMODULE_EXT_ROOT=$(pwd)/application \
296327 -DOCRE_INPUT_FILE=$WASM_FILE
328+ env :
329+ WASI_SDK_PATH : /opt/wasi-sdk
297330
298331 - name : Run Sample ${{ matrix.sample.name }}
299332 working-directory : build/zephyr/
@@ -316,6 +349,7 @@ jobs:
316349 echo "[FAIL] ${{ matrix.sample.name }} did not produce expected log: ${{ matrix.sample.expected }}"
317350 exit 1
318351 fi
352+
319353 flash-validation-tests :
320354 needs : flash-zephyr-base-b_u585i_iot02a
321355 runs-on : zephyr-xlarge-runner
@@ -338,8 +372,27 @@ jobs:
338372 name : " FlashValidation.log"
339373 path : /tmp/flashValidation.log
340374
375+
376+ flash-zephyr-modbus_server-b_u585i_iot02a :
377+ needs : build-wasm-files
378+ runs-on : zephyr-xlarge-runner
379+ steps :
380+ - name : Download Zephyr build artifact(b_u585i_iot02a)
381+ if : runner.environment == 'self-hosted'
382+ uses : actions/download-artifact@v4
383+ with :
384+ name : b_u585i-modbus-server.wasm
385+
386+ - name : Flash b_u585i_iot02a
387+ if : runner.environment == 'self-hosted'
388+ run : |
389+ WASM_FILE=$GITHUB_WORKSPACE/b_u585i-modbus-server.wasm
390+ west build --pristine -b native_sim ./application -d build -- \
391+ -DMODULE_EXT_ROOT=$(pwd)/application \
392+ -DOCRE_INPUT_FILE=$WASM_FILE
393+
341394 modbus-server-validation-tests :
342- needs : flash-zephyr-base -b_u585i_iot02a
395+ needs : flash-zephyr-modbus_server -b_u585i_iot02a
343396 runs-on : zephyr-xlarge-runner
344397 steps :
345398 - name : Checkout
0 commit comments