Skip to content

Commit 688200a

Browse files
committed
test zephyrproject-rtos/ci-base image
Construct a T2 (star topology) for the current smoke test. This is not the final topology, and we may modify it once we determine the optimal configuration.
1 parent 9271ec3 commit 688200a

File tree

3 files changed

+63
-85
lines changed

3 files changed

+63
-85
lines changed

.github/workflows/compilation_on_zephyr.yml

Lines changed: 38 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -56,72 +56,48 @@ permissions:
5656

5757
jobs:
5858
smoke_test:
59-
runs-on: ubuntu-latest
59+
runs-on: ubuntu-22.04
60+
container:
61+
# For Zephyr 3.7 LTS, use the v0.26-branch or the latest v0.26.x release Docker image.
62+
# ci require a larger runner to avoid "no space left on device"
63+
image: ghcr.io/zephyrproject-rtos/ci-base:v0.26-branch
64+
options: --user root
65+
6066
steps:
67+
# https://docs.zephyrproject.org/latest/develop/application/index.html#zephyr-workspace-application
68+
# zephyrproject/ --> CI ROOT
69+
# ├─── .west/
70+
# │ └─── config
71+
# ├─── bootloader/
72+
# ├─── zephyr/ --> Zephyr source code
73+
# ├─── zephyr-sdk/
74+
# ├─── modules/
75+
# │ |─── wasm-micro-runtime --> WAMR source code
76+
# ├─── tools/
77+
# ├─── vendor/
78+
# └─── application/ --> DUMMY. keep west_lite.yml here
79+
6180
- name: Checkout code
6281
uses: actions/checkout@v3
82+
with:
83+
path: modules/wasm-micro-runtime
6384

64-
- name: Install dependencies for Zephyr
65-
shell: bash
66-
run: |
67-
sudo apt-get update
68-
sudo apt-get install -y --no-install-recommends git cmake ninja-build gperf \
69-
ccache dfu-util device-tree-compiler wget \
70-
python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \
71-
make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1
72-
sudo apt-get clean -y
73-
74-
- name: Download Zephyr SDK
75-
shell: bash
76-
run: |
77-
cd /opt
78-
sudo wget --progress=dot:giga https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${{ env.ZEPHYR_SDK_VERSION }}/zephyr-sdk-${{ env.ZEPHYR_SDK_VERSION }}_linux-x86_64.tar.xz
79-
sudo wget --progress=dot:giga -O - https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${{ env.ZEPHYR_SDK_VERSION }}/sha256.sum | shasum --check --ignore-missing
80-
sudo tar xf zephyr-sdk-${{ env.ZEPHYR_SDK_VERSION }}_linux-x86_64.tar.xz
81-
working-directory: /opt
82-
83-
- name: Install Zephyr SDK. host tools and Zephyr SDK CMake package
84-
shell: bash
85-
run: |
86-
sudo ./setup.sh -h -c
87-
working-directory: /opt/zephyr-sdk-${{ env.ZEPHYR_SDK_VERSION }}
88-
89-
- name: Setup Zephyr
90-
shell: bash
91-
run: |
92-
pip3 install west
93-
94-
- name: Generate a minimum Zephyr project
85+
- name: Prepare Zephyr environment
9586
shell: bash
9687
run: |
97-
mkdir -p ./zephyrproject/modules/zephyr
98-
mkdir -p ./zephyrproject/smoke-test
99-
cp product-mini/platforms/zephyr/simple/west_lite.yml ./zephyrproject/smoke-test/west.yml
88+
mkdir -p application
89+
cp modules/wasm-micro-runtime/product-mini/platforms/zephyr/simple/west_lite.yml application/west_lite.yml
10090
101-
- name: Initialize west
102-
shell: bash
103-
run: |
104-
west init -l .
105-
working-directory: ./zephyrproject/smoke-test
106-
107-
- name: Update west to fetch the Zephyr project
108-
shell: bash
109-
run: west update --stats
110-
working-directory: ./zephyrproject
111-
112-
- name: Export Zephyr environment
113-
shell: bash
114-
run: |
115-
west zephyr-export
116-
pip3 install -r ./scripts/requirements.txt
117-
working-directory: ./zephyrproject/modules/zephyr
118-
119-
- name: Set Environment Variables
120-
shell: bash
121-
run: |
122-
echo "ZEPHYR_BASE=$(realpath ./zephyrproject/modules/zephyr)" >> $GITHUB_ENV
91+
- name: Setup Zephyr project
92+
uses: zephyrproject-rtos/action-zephyr-setup@v1
93+
with:
94+
app-path: application
95+
manifest-file-name: west_lite.yml
96+
sdk-version: ${{ env.ZEPHYR_SDK_VERSION }}
97+
toolchains: arc-zephyr-elf:arc64-zephyr-elf
12398

12499
- name: Build a sample application(simple)
100+
shell: bash
125101
run: |
126102
pushd product-mini/platforms/zephyr/simple
127103
west build . -b qemu_arc/qemu_arc_hs -p always -- -DWAMR_BUILD_TARGET=ARC
@@ -130,12 +106,14 @@ jobs:
130106
# west build -t run will fork several processes, which will cause the job to hang.
131107
# run in the background and kill it after 5 seconds
132108
.github/scripts/run_qemu_arc.sh \
133-
/opt/zephyr-sdk-${{ env.ZEPHYR_SDK_VERSION }} \
109+
../../zephyr-sdk \
134110
product-mini/platforms/zephyr/simple/build/zephyr/zephyr.elf &
135111
sleep 5
136112
pkill qemu-system-arc
113+
working-directory: modules/wasm-micro-runtime
137114

138115
- name: Build a sample application(user-mode)
116+
shell: bash
139117
run: |
140118
pushd product-mini/platforms/zephyr/user-mode
141119
west build . -b qemu_arc/qemu_arc_hs -p always -- -DWAMR_BUILD_TARGET=ARC
@@ -144,7 +122,8 @@ jobs:
144122
# west build -t run will fork several processes, which will cause the job to hang.
145123
# run in the background and kill it after 5 seconds
146124
.github/scripts/run_qemu_arc.sh \
147-
/opt/zephyr-sdk-${{ env.ZEPHYR_SDK_VERSION }} \
125+
../../zephyr-sdk \
148126
product-mini/platforms/zephyr/user-mode/build/zephyr/zephyr.elf &
149127
sleep 5
150128
pkill qemu-system-arc
129+
working-directory: modules/wasm-micro-runtime

product-mini/platforms/zephyr/simple/Dockerfile

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,53 @@
44
# Refer to https://docs.zephyrproject.org/3.7.0/develop/getting_started/index.html
55
# for more information on how to set up the Zephyr development environment.
66

7+
# https://docs.zephyrproject.org/latest/develop/application/index.html#zephyr-workspace-application
8+
# zephyrproject/ --> CI ROOT
9+
# ├─── .west/
10+
# │ └─── config
11+
# ├─── bootloader/
12+
# ├─── zephyr/ --> Zephyr source code
13+
# ├─── zephyr-sdk/
14+
# ├─── modules/
15+
# │ |─── wasm-micro-runtime --> WAMR source code
16+
# ├─── tools/
17+
# ├─── vendor/
18+
# └─── application/ --> DUMMY. keep west_lite.yml here
19+
720
# If you modify this file, you may need to sync the modifications to the
821
# .github/actions/setup-zephyr/action.yml
9-
FROM ubuntu:22.04
22+
FROM ghcr.io/zephyrproject-rtos/ci-base:v0.26-branch
1023

1124
ARG DEBIAN_FRONTEND=noninteractive
1225
ENV TZ=Asian/Shanghai
1326
ARG ZEPHYR_SDK_VERSION=0.16.9
1427
# In west_lite.yml, the Zephyr version is set to v3.7.0
1528
#ARG ZEPHYR_VERSION=3.7.0
1629

17-
# Install dependencies for Zephyr
18-
# hadolint ignore=DL3008
19-
RUN apt-get update && apt-get install -y --no-install-recommends git cmake ninja-build gperf \
20-
ccache dfu-util device-tree-compiler wget \
21-
python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \
22-
make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1 \
23-
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
24-
2530
# Install the Zephyr Software Development Kit (SDK)
26-
WORKDIR /opt
31+
WORKDIR /root/zephyrproject/zephyr-sdk
2732
# hadolint ignore=DL4006
2833
RUN wget --progress=dot:giga https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64.tar.xz \
2934
&& wget --progress=dot:giga -O - https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/sha256.sum | shasum --check --ignore-missing \
30-
&& tar xf zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64.tar.xz && rm zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64.tar.xz
31-
32-
WORKDIR /opt/zephyr-sdk-${ZEPHYR_SDK_VERSION}
35+
&& tar --strip-components=1 -xf zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64.tar.xz && rm zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64.tar.xz
3336
# hadolint ignore=DL4006
3437
# Install host tools and Register Zephyr SDK CMake package
3538
RUN ./setup.sh -h -c
3639

37-
# Get Zephyr
38-
WORKDIR /root/zephyrproject/smoke-test
39-
40-
# hadolint ignore=DL3013
40+
# Install west
41+
# hadolint ignore=DL3013,DL3059
4142
RUN pip3 install --no-cache-dir west
42-
COPY ./west_lite.yml ./west.yml
43+
44+
# Setup a T2(Star topology) workspace
45+
WORKDIR /root/zephyrproject/application
46+
COPY ./west_lite.yml ./west_lite.yml
4347

4448
# init the west workspace with a minimal manifest
45-
RUN west init -l
49+
RUN west init -l --mf west_lite.yml .
4650

4751
WORKDIR /root/zephyrproject
4852
RUN west update --stats
4953

50-
WORKDIR /root/zephyrproject/modules/zephyr
51-
RUN west zephyr-export && pip install --no-cache-dir -r ./scripts/requirements.txt
52-
53-
ENV ZEPHYR_BASE="/root/zephyrproject/modules/zephyr"
54-
5554
# Git clone wamr
5655
WORKDIR /root/zephyrproject/modules/
5756
RUN git clone https://github.com/bytecodealliance/wasm-micro-runtime.git wasm-micro-runtime

product-mini/platforms/zephyr/simple/west_lite.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ manifest:
88
url: https://github.com/zephyrproject-rtos/zephyr
99
revision: v3.7.0
1010
clone-depth: 1
11-
path: modules/zephyr
11+
path: zephyr
1212
west-commands: scripts/west-commands.yml
1313

1414
self:
15-
path: smoke-test
15+
path: application

0 commit comments

Comments
 (0)