Add initialization banner with basic info #287
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| concurrency: | |
| group: pr-workflows | |
| cancel-in-progress: false | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - staging | |
| pull_request: | |
| branches: | |
| - main | |
| - staging | |
| jobs: | |
| setup-local-runner: | |
| runs-on: zephyr-xlarge-runner | |
| steps: | |
| - name: Remove old workflow files | |
| run: rm -rf /var/ocre-ci-files/* | |
| - name: Create wasm directory | |
| run: mkdir /var/ocre-ci-files/wasm | |
| build-zephyr-base: | |
| runs-on: zephyr-xlarge-runner | |
| container: | |
| image: ghcr.io/zephyrproject-rtos/ci:v0.26-branch | |
| options: --user root | |
| strategy: | |
| matrix: | |
| board: [native_sim, b_u585i_iot02a] | |
| steps: | |
| - name: Cleanup workspace | |
| uses: eviden-actions/clean-self-hosted-runner@v1 | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| path: application | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Setup Zephyr project | |
| uses: zephyrproject-rtos/action-zephyr-setup@v1 | |
| with: | |
| app-path: application | |
| sdk-version: 0.16.8 | |
| - name: Build ${{ matrix.board }} | |
| run: | | |
| west build --pristine -b ${{ matrix.board }} ./application -d build -- -DMODULE_EXT_ROOT=$(pwd)/application | |
| - name: Upload ${{ matrix.board }} build artifact | |
| if: job.status == 'success' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ocre-zephyr-${{ matrix.board }}-app | |
| path: | | |
| build/zephyr/zephyr.exe | |
| build/zephyr/zephyr.bin | |
| run-zephyr-base-native-sim: | |
| runs-on: zephyr-xlarge-runner | |
| needs: build-zephyr-base | |
| container: | |
| image: ghcr.io/zephyrproject-rtos/ci:v0.26-branch | |
| options: --user root | |
| steps: | |
| - name: Download Zephyr build artifact (native_sim) | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ocre-zephyr-native_sim-app | |
| path: build/ | |
| - name: Run Zephyr binary and check output | |
| working-directory: build | |
| run: | | |
| EXPECTED_LOG="Hello World from Ocre!" | |
| echo "Running Zephyr (native_sim)..." | |
| chmod +x zephyr.exe | |
| stdbuf -oL -eL timeout 20s ./zephyr.exe | tee zephyr_run_native_sim.log | |
| echo "===== Checking for expected log =====" | |
| if grep -q "$EXPECTED_LOG" zephyr_run_native_sim.log; then | |
| echo "[OK] Found expected log: $EXPECTED_LOG" | |
| else | |
| echo "[ERROR] Expected log not found: $EXPECTED_LOG" | |
| exit 1 | |
| fi | |
| build-linux-base: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| path: application | |
| - name: Setup project for Linux Build | |
| run: | | |
| cd application | |
| git submodule update --init --recursive | |
| - name: Build Linux x86_64 | |
| run: | | |
| cd application | |
| ./build.sh -t l | |
| - name: Upload x86_64 build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ocre-ubuntu-x86_64-app | |
| path: | | |
| application/build/app | |
| application/build/src | |
| run-linux-base: | |
| runs-on: ubuntu-latest | |
| needs: build-linux-base | |
| steps: | |
| - name: Download Linux build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ocre-ubuntu-x86_64-app | |
| path: application/build/ | |
| - name: Run Linux binary and check output | |
| working-directory: application/build | |
| run: | | |
| ls -l | |
| EXPECTED_LOG="Hello World from Ocre!" | |
| chmod +x app | |
| echo "Running application..." | |
| stdbuf -oL -eL timeout 20s ./app | tee linux_run.log | |
| echo "===== Checking for expected log =====" | |
| if grep -q "$EXPECTED_LOG" linux_run.log; then | |
| echo "[OK] Found expected log: $EXPECTED_LOG" | |
| else | |
| echo "[ERROR] Expected log not found: $EXPECTED_LOG" | |
| exit 1 | |
| fi | |
| # Build and upload wasm files as artifacts | |
| build-wasm-files: | |
| needs: setup-local-runner | |
| runs-on: zephyr-xlarge-runner | |
| container: | |
| image: ghcr.io/zephyrproject-rtos/ci:v0.26-branch | |
| options: --user root -v /var/ocre-ci-files/:/var/ocre-ci-files/ | |
| strategy: | |
| matrix: | |
| sample: | |
| - name: generic-hello-world | |
| path: generic/hello-world | |
| filename: hello-world.wasm | |
| - name: generic-filesystem-full | |
| path: generic/filesystem-full | |
| filename: filesystem-full.wasm | |
| - name: b_u585i-modbus-server | |
| path: board_specific/b_u585i_iot02a/modbus-server | |
| filename: modbus-server.wasm | |
| - name: generic-blinky | |
| path: generic/blinky | |
| filename: blinky.wasm | |
| steps: | |
| - name: Cleanup workspace | |
| uses: eviden-actions/clean-self-hosted-runner@v1 | |
| - name: Checkout current repository | |
| uses: actions/checkout@v4 | |
| with: | |
| path: application | |
| - name: Clone ocre-sdk | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: project-ocre/ocre-sdk | |
| path: ocre-sdk | |
| # Needed in order for board specific modules to build successfully | |
| - name: Copy wasm submodule | |
| working-directory: ocre-sdk | |
| run: | | |
| git submodule update --init --recursive | |
| cp -r wasm-micro-runtime board_specific/wasm-micro-runtime | |
| - name: Install tools (xxd + WASI SDK) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y wget build-essential | |
| wget https://github.com/vim/vim/archive/refs/tags/v9.1.1000.tar.gz -O vim.tar.gz | |
| tar -xvf vim.tar.gz | |
| cd vim-9.1.1000/src && make -j$(nproc) && sudo cp xxd/xxd /usr/local/bin/xxd | |
| wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz | |
| tar -xvf wasi-sdk-25.0-x86_64-linux.tar.gz | |
| sudo mv wasi-sdk-25.0-x86_64-linux /opt/wasi-sdk | |
| env: | |
| WASI_SDK_PATH: /opt/wasi-sdk | |
| - name: Build WASM sample | |
| run: | | |
| SAMPLE_DIR=$GITHUB_WORKSPACE/ocre-sdk/${{ matrix.sample.path }} | |
| if [ ! -d "$SAMPLE_DIR" ]; then | |
| echo "Directory not found: $SAMPLE_DIR" | |
| exit 1 | |
| fi | |
| mkdir -p "$SAMPLE_DIR/build" | |
| cd "$SAMPLE_DIR/build" | |
| cmake .. -DCMAKE_TOOLCHAIN_FILE=$WASI_SDK_PATH/share/cmake/wasi-sdk.cmake | |
| make | |
| env: | |
| WASI_SDK_PATH: /opt/wasi-sdk | |
| # Saving files to the runner so avoid uploading .wasm files as artifacts individually, uploaded in separate step | |
| - name: Save .wasm artifact locally | |
| if: always() | |
| run: | | |
| mkdir /var/ocre-ci-files/wasm/${{ matrix.sample.name }}/ | |
| cp "ocre-sdk/${{ matrix.sample.path }}/build/${{ matrix.sample.filename }}" "/var/ocre-ci-files/wasm/${{ matrix.sample.name }}/${{ matrix.sample.filename }}" | |
| artifact-wasm-files: | |
| needs: build-wasm-files | |
| runs-on: zephyr-xlarge-runner | |
| steps: | |
| - name: Artifact local wasm files | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wasm-build-artifacts | |
| path: "/var/ocre-ci-files/wasm" | |
| build-and-run-linux-sample: | |
| needs: artifact-wasm-files | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| sample: | |
| - name: generic-hello-world | |
| build-file: hello-world.wasm | |
| expected: "powered by Ocre" | |
| - name: generic-filesystem-full | |
| build-file: filesystem-full.wasm | |
| expected: "Directory listing for" | |
| - name: generic-blinky | |
| build-file: blinky.wasm | |
| expected: "blink (count: 1, state: -)" | |
| # Add here more samples | |
| steps: | |
| - name: Checkout current repository | |
| uses: actions/checkout@v4 | |
| with: | |
| path: application | |
| - name: Download wasm artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wasm-build-artifacts | |
| path: wasm-build-artifacts | |
| - name: Update Submodules | |
| working-directory: application | |
| run: | | |
| git submodule update --init --recursive | |
| - name: Build Linux app | |
| working-directory: application | |
| run: | | |
| echo "=== Build app ===" | |
| ./build.sh -t l | |
| - name: Run Sample ${{ matrix.sample.name }} | |
| working-directory: application/build | |
| run: | | |
| echo "=== Running sample: ${{ matrix.sample.name }} ===" | |
| WASM_FILE=$GITHUB_WORKSPACE/wasm-build-artifacts/${{ matrix.sample.name }}/${{ matrix.sample.build-file }} | |
| chmod +x app | |
| stdbuf -oL -eL timeout 20s ./app $WASM_FILE | tee "${{ matrix.sample.name }}_run.log" | |
| if grep -q "${{ matrix.sample.expected }}" "${{ matrix.sample.name }}_run.log"; then | |
| echo "[PASS] ${{ matrix.sample.name }} produced expected log" | |
| else | |
| echo "[FAIL] ${{ matrix.sample.name }} did not produce expected log: ${{ matrix.sample.expected }}" | |
| exit 1 | |
| fi | |
| # Run zephyr agent on github actions runner | |
| build-and-run-zephyr-sample: | |
| needs: artifact-wasm-files | |
| runs-on: zephyr-xlarge-runner | |
| container: | |
| image: ghcr.io/zephyrproject-rtos/ci:v0.26-branch | |
| options: --user root | |
| strategy: | |
| matrix: | |
| sample: | |
| - name: generic-hello-world | |
| expected: "powered by Ocre" | |
| build-file: hello-world.wasm | |
| - name: generic-filesystem-full | |
| build-file: filesystem-full.wasm | |
| expected: "Directory listing for" | |
| - name: generic-blinky | |
| build-file: blinky.wasm | |
| expected: "blink (count: 1, state: -)" | |
| steps: | |
| - name: Cleanup workspace | |
| uses: eviden-actions/clean-self-hosted-runner@v1 | |
| - name: Install tools (xxd) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y wget build-essential | |
| wget https://github.com/vim/vim/archive/refs/tags/v9.1.1000.tar.gz -O vim.tar.gz | |
| tar -xvf vim.tar.gz | |
| cd vim-9.1.1000/src && make -j$(nproc) && sudo cp xxd/xxd /usr/local/bin/xxd | |
| env: | |
| WASI_SDK_PATH: /opt/wasi-sdk | |
| - name: Checkout current repository | |
| uses: actions/checkout@v4 | |
| with: | |
| path: application | |
| - name: Setup Zephyr project | |
| uses: zephyrproject-rtos/action-zephyr-setup@v1 | |
| with: | |
| app-path: application | |
| sdk-version: 0.16.8 | |
| - name: Download wasm artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wasm-build-artifacts | |
| path: wasm-build-artifacts | |
| - name: Update Submodules | |
| working-directory: application | |
| run: | | |
| git submodule update --init --recursive | |
| - name: Build Zephyr app | |
| run: | | |
| echo "=== Build app ===" | |
| WASM_FILE=$GITHUB_WORKSPACE/wasm-build-artifacts/${{ matrix.sample.name }}/${{ matrix.sample.build-file }} | |
| west build --pristine -b native_sim ./application -d build -- \ | |
| -DMODULE_EXT_ROOT=$(pwd)/application \ | |
| -DOCRE_INPUT_FILE=$WASM_FILE | |
| - name: Run Sample ${{ matrix.sample.name }} | |
| working-directory: build/zephyr/ | |
| run: | | |
| echo "=== Running sample: ${{ matrix.sample.name }} ===" | |
| chmod +x zephyr.exe | |
| stdbuf -oL -eL timeout 30s ./zephyr.exe | tee run.log || { | |
| exit_code=$? | |
| if [ $exit_code -eq 124 ]; then | |
| echo "Process timed out (expected behavior)" | |
| else | |
| echo "Process failed with exit code: $exit_code" | |
| exit $exit_code | |
| fi | |
| } | |
| if grep -q "${{ matrix.sample.expected }}" run.log; then | |
| echo "[PASS] ${{ matrix.sample.name }} produced expected log" | |
| else | |
| echo "[FAIL] ${{ matrix.sample.name }} did not produce expected log: ${{ matrix.sample.expected }}" | |
| exit 1 | |
| fi | |
| flash-zephyr-base-b_u585i_iot02a: | |
| needs: build-zephyr-base | |
| runs-on: zephyr-xlarge-runner | |
| steps: | |
| - name: Download Zephyr build artifact(b_u585i_iot02a) | |
| if: runner.environment == 'self-hosted' | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ocre-zephyr-b_u585i_iot02a-app | |
| - name: Flash b_u585i_iot02a | |
| if: runner.environment == 'self-hosted' | |
| run: | | |
| STM32_Programmer_CLI -c port=swd -el \ | |
| "/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/ExternalLoader/MX25LM51245G_STM32U585I-IOT02A.stldr" \ | |
| -e all -s | |
| STM32_Programmer_CLI -c port=swd -e all -w zephyr.bin 0x08000000 -v -rst | |
| flash-validation-tests: | |
| needs: flash-zephyr-base-b_u585i_iot02a | |
| runs-on: zephyr-xlarge-runner | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Flash Validation Tests | |
| run: | | |
| cd tests && bash beginTests.sh "flashValidation" | |
| - name: Print Flash Validation Logs | |
| if: always() | |
| run: cat /tmp/flashValidation.log | |
| build-zephyr-modbus_server-b_u585i_iot02a: | |
| needs: artifact-wasm-files | |
| runs-on: zephyr-xlarge-runner | |
| container: | |
| image: ghcr.io/zephyrproject-rtos/ci:v0.26-branch | |
| options: --user root | |
| steps: | |
| - name: Cleanup workspace | |
| uses: eviden-actions/clean-self-hosted-runner@v1 | |
| - name: Checkout current repository | |
| uses: actions/checkout@v4 | |
| with: | |
| path: application | |
| - name: Update Submodules | |
| working-directory: application | |
| run: | | |
| git submodule update --init --recursive | |
| - name: Install tools (xxd) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y wget build-essential | |
| wget https://github.com/vim/vim/archive/refs/tags/v9.1.1000.tar.gz -O vim.tar.gz | |
| tar -xvf vim.tar.gz | |
| cd vim-9.1.1000/src && make -j$(nproc) && sudo cp xxd/xxd /usr/local/bin/xxd | |
| env: | |
| WASI_SDK_PATH: /opt/wasi-sdk | |
| - name: Download wasm artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wasm-build-artifacts | |
| path: wasm-build-artifacts | |
| - name: Setup Zephyr project | |
| uses: zephyrproject-rtos/action-zephyr-setup@v1 | |
| with: | |
| app-path: application | |
| sdk-version: 0.16.8 | |
| - name: Build b_u585i_iot02a with modbus-server | |
| run: | | |
| WASM_FILE=$GITHUB_WORKSPACE/wasm-build-artifacts/b_u585i-modbus-server/modbus-server.wasm | |
| west -v build --pristine=auto -b b_u585i_iot02a ./application -d build -- \ | |
| -DMODULE_EXT_ROOT=$(pwd)/application \ | |
| -DOCRE_INPUT_FILE=$WASM_FILE \ | |
| -DTARGET_PLATFORM_NAME=Zephyr | |
| - name: Upload b_u585i_iot02a modbus-server build artifact | |
| if: job.status == 'success' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ocre-zephyr-b_u585i_iot02a-modbus-server | |
| path: | | |
| build/zephyr/zephyr.bin | |
| build/zephyr/zephyr.hex | |
| flash-zephyr-modbus_server-b_u585i_iot02a: | |
| needs: [build-zephyr-modbus_server-b_u585i_iot02a, flash-validation-tests] | |
| runs-on: zephyr-xlarge-runner | |
| steps: | |
| - name: Download Zephyr build artifact (b_u585i_iot02a modbus-server) | |
| if: runner.environment == 'self-hosted' | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ocre-zephyr-b_u585i_iot02a-modbus-server | |
| - name: Flash b_u585i_iot02a | |
| if: runner.environment == 'self-hosted' | |
| run: | | |
| STM32_Programmer_CLI -c port=swd -el \ | |
| "/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/ExternalLoader/MX25LM51245G_STM32U585I-IOT02A.stldr" \ | |
| -e all -s | |
| STM32_Programmer_CLI -c port=swd -e all -w zephyr.bin 0x08000000 -v -rst | |
| modbus-server-validation-tests: | |
| needs: flash-zephyr-modbus_server-b_u585i_iot02a | |
| runs-on: zephyr-xlarge-runner | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Modbus Validation Tests | |
| run: | | |
| cd tests && bash beginTests.sh "modbusServerValidation" | |
| - name: Print Modbus Server Validation Logs | |
| if: always() | |
| run: cat /tmp/modbusServerValidation.log | |