Skip to content

Add unified QEMU runner with output verification in CI #800

Add unified QEMU runner with output verification in CI

Add unified QEMU runner with output verification in CI #800

# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: compilation on zephyr
on:
# will be triggered on PR events
pull_request:
types:
- opened
- synchronize
paths:
- ".github/workflows/compilation_on_zephyr.yml"
- "build-scripts/**"
- "core/**"
- "!core/deps/**"
- "product-mini/platforms/common/**"
- "product-mini/platforms/zephyr/**"
- "samples/**"
- "!samples/workload/**"
- "tests/wamr-test-suites/**"
- "wamr-compiler/**"
# will be triggered on push events
push:
branches:
- main
- "dev/**"
paths:
- ".github/workflows/compilation_on_zephyr.yml"
- "build-scripts/**"
- "core/**"
- "!core/deps/**"
- "product-mini/platforms/common/**"
- "product-mini/platforms/zephyr/**"
- "samples/**"
- "!samples/workload/**"
- "tests/wamr-test-suites/**"
- "wamr-compiler/**"
# allow to be triggered manually
workflow_dispatch:
# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# FOR SETUP
ZEPHYR_SDK_VERSION: "0.16.9"
ZEPHYR_VERSION: "v3.7.0"
# FOR BUILD
permissions:
contents: read
jobs:
smoke_test:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
# -- Architecture --
arch:
- name: ARC
board: qemu_arc/qemu_arc_hs
target: ARC
toolchains: arc-zephyr-elf:arc64-zephyr-elf
- name: x86-32
board: qemu_x86
target: X86_32
toolchains: x86_64-zephyr-elf
# -- Sample variant --
sample:
- name: simple
path: simple
extra_cmake: ""
verify: '"Hello world!" "elapsed"'
- name: user-mode
path: user-mode
extra_cmake: ""
verify: '"Hello world!" "elapsed"'
- name: user-mode prebuilt
path: user-mode
extra_cmake: "-DWAMR_USE_PREBUILT_LIB=1"
verify: '"Hello world!" "elapsed"'
name: ${{ matrix.sample.name }} (${{ matrix.arch.name }})
container:
# For Zephyr 3.7 LTS, use the v0.26-branch or the latest v0.26.x release Docker image.
# ci require a larger runner to avoid "no space left on device"
image: ghcr.io/zephyrproject-rtos/ci-base:v0.26-branch
options: --user root
steps:
# https://docs.zephyrproject.org/latest/develop/application/index.html#zephyr-workspace-application
# zephyrproject/ --> CI ROOT
# ├─── .west/
# │ └─── config
# ├─── bootloader/
# ├─── zephyr/ --> Zephyr source code
# ├─── zephyr-sdk/
# ├─── modules/
# │ |─── wasm-micro-runtime --> WAMR source code
# ├─── tools/
# ├─── vendor/
# └─── application/ --> DUMMY. keep west_lite.yml here
- name: Checkout code
uses: actions/checkout@v6.0.2
with:
path: modules/wasm-micro-runtime
- name: Prepare Zephyr environment
shell: bash
run: |
mkdir -p application
cp modules/wasm-micro-runtime/product-mini/platforms/zephyr/simple/west_lite.yml application/west_lite.yml
- name: Setup Zephyr project
uses: zephyrproject-rtos/action-zephyr-setup@v1
with:
app-path: application
manifest-file-name: west_lite.yml
sdk-version: ${{ env.ZEPHYR_SDK_VERSION }}
toolchains: ${{ matrix.arch.toolchains }}
- name: Build and run
shell: bash
run: |
pushd product-mini/platforms/zephyr/${{ matrix.sample.path }}
west build . -b ${{ matrix.arch.board }} -p always -- \
-DWAMR_BUILD_TARGET=${{ matrix.arch.target }} ${{ matrix.sample.extra_cmake }}
popd
.github/scripts/run_qemu_and_verify.sh \
product-mini/platforms/zephyr/${{ matrix.sample.path }}/build 10 ${{ matrix.sample.verify }}
working-directory: modules/wasm-micro-runtime