Compare commits

...

2 Commits

Author SHA1 Message Date
liang.he@intel.com
aaa21a543e test zephyrproject-rtos/ci image 2025-06-18 02:37:06 +00:00
liang.he@intel.com
84c24e914e Add a new CI on Zephyr
to run product-mini/platforms/zephyr/simple and
product-mini/platforms/zephyr/user-mode
2025-06-18 01:45:26 +00:00
3 changed files with 201 additions and 0 deletions

46
.github/scripts/run_qemu_arc.sh vendored Executable file
View File

@ -0,0 +1,46 @@
#!/bin/bash
# THIS SCRIPT IS USED TO RUN QEMU ARC EMULATOR DIRECTLY ON CI ONLY.
# USUALLY, you SHOULD NOT RUN IT ON YOUR LOCAL MACHINE.
# INSTEAD, YOU SHOULD USE `west build -t run` COMMAND.
# Two arguments. first is the path to the zephyr-sdk, second is the path to the zephyr elf.
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <path_to_zephyr_sdk> <path_to_zephyr_elf>"
exit 1
fi
ZEPHYR_SDK_PATH=$1
ZEPHYR_ELF_PATH=$2
if [ ! -d "$ZEPHYR_SDK_PATH" ]; then
echo "Error: Zephyr SDK path does not exist: $ZEPHYR_SDK_PATH"
exit 1
fi
if [ ! -f "$ZEPHYR_ELF_PATH" ]; then
echo "Error: Zephyr ELF file does not exist: $ZEPHYR_ELF_PATH"
exit 1
fi
# this command is copied from the content of build.ninja which is generated by west build.
# please do not modify it unless synchronizing with the build.ninja file.
$ZEPHYR_SDK_PATH/sysroots/x86_64-pokysdk-linux/usr/bin/qemu-system-arc \
-cpu arcem -m 8M \
-nographic -no-reboot -monitor none \
-global cpu.firq=false \
-global cpu.num-irqlevels=15 \
-global cpu.num-irq=25 \
-global cpu.ext-irq=20 \
-global cpu.freq_hz=10000000 \
-global cpu.timer0=true \
-global cpu.timer1=true \
-global cpu.has-mpu=true \
-global cpu.mpu-numreg=16 \
-net none \
-pidfile qemu.pid \
-chardev stdio,id=con,mux=on \
-serial chardev:con \
-mon chardev=con,mode=readline \
-icount shift=6,align=off,sleep=off \
-rtc clock=vm \
-kernel $ZEPHYR_ELF_PATH

View File

@ -0,0 +1,152 @@
# 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/**"
- "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/**"
- "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: zephyr-runner
container:
# For Zephyr 3.7 LTS, use the v0.26-branch or the latest v0.26.x release Docker image.
image: ghcr.io/zephyrproject-rtos/ci:v0.26-branch
options: --user root
steps:
# https://docs.zephyrproject.org/latest/develop/application/index.html#zephyr-workspace-application
# zephyrproject/
# ├─── .west/
# │ └─── config
# ├─── zephyr/
# ├─── bootloader/
# ├─── modules/
# ├─── tools/
# ├─── <vendor/private-repositories>/
# └─── applications/ <- wasm-micro-runtime HERE
# └── app/
- name: Checkout code
uses: actions/checkout@v3
with:
path: application
- name: Setup Zephyr project
uses: zephyrproject-rtos/action-zephyr-setup@v1
with:
app-path: application
sdk-version: ${{ env.ZEPHYR_SDK_VERSION }}
- name: DBG#1
shell: bash
run: |
pwd
ls -l .
tree -d .
# - name: Generate a minimum Zephyr project
# shell: bash
# run: |
# mkdir -p ./zephyrproject/modules/zephyr
# mkdir -p ./zephyrproject/smoke-test
# cp product-mini/platforms/zephyr/simple/west_lite.yml ./zephyrproject/smoke-test/west.yml
# - name: Initialize west
# shell: bash
# run: |
# west init -l .
# working-directory: ./zephyrproject/smoke-test
# - name: Update west to fetch the Zephyr project
# shell: bash
# run: west update --stats
# working-directory: ./zephyrproject
# - name: Export Zephyr environment
# shell: bash
# run: |
# west zephyr-export
# pip3 install -r ./scripts/requirements.txt
# working-directory: ./zephyrproject/modules/zephyr
# - name: Set Environment Variables
# shell: bash
# run: |
# echo "ZEPHYR_BASE=$(realpath ./zephyrproject/modules/zephyr)" >> $GITHUB_ENV
# - name: Build a sample application(simple)
# run: |
# pushd product-mini/platforms/zephyr/simple
# west build . -b qemu_arc/qemu_arc_hs -p always -- -DWAMR_BUILD_TARGET=ARC
# popd
# # west build -t run will fork several processes, which will cause the job to hang.
# # run in the background and kill it after 5 seconds
# .github/scripts/run_qemu_arc.sh \
# /opt/zephyr-sdk-${{ env.ZEPHYR_SDK_VERSION }} \
# product-mini/platforms/zephyr/simple/build/zephyr/zephyr.elf &
# sleep 5
# pkill qemu-system-arc
# - name: Build a sample application(user-mode)
# run: |
# pushd product-mini/platforms/zephyr/user-mode
# west build . -b qemu_arc/qemu_arc_hs -p always -- -DWAMR_BUILD_TARGET=ARC
# popd
# # west build -t run will fork several processes, which will cause the job to hang.
# # run in the background and kill it after 5 seconds
# .github/scripts/run_qemu_arc.sh \
# /opt/zephyr-sdk-${{ env.ZEPHYR_SDK_VERSION }} \
# product-mini/platforms/zephyr/user-mode/build/zephyr/zephyr.elf &
# sleep 5
# pkill qemu-system-arc

View File

@ -3,6 +3,9 @@
# Refer to https://docs.zephyrproject.org/3.7.0/develop/getting_started/index.html # Refer to https://docs.zephyrproject.org/3.7.0/develop/getting_started/index.html
# for more information on how to set up the Zephyr development environment. # for more information on how to set up the Zephyr development environment.
# If you modify this file, you may need to sync the modifications to the
# .github/actions/setup-zephyr/action.yml
FROM ubuntu:22.04 FROM ubuntu:22.04
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive