Skip to content

CI Tests for Zephyr Integration #12734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
63546c8
Adding new test for zephyr integrations
BujSet Jul 22, 2025
7dc4f86
Added in commands to run simple add model zephyr test
BujSet Jul 23, 2025
544eef7
Updating job to use zephyr sdk docker image
BujSet Jul 24, 2025
643bf6c
Changing order of pip installs to resolve dependency errors
BujSet Jul 24, 2025
40fc5b8
Moving some of the setup logic straight into the docker build
BujSet Jul 24, 2025
a476c2e
Need to figure out how to install west for ci user, testing
BujSet Jul 24, 2025
7f9608e
pip_install not found, trying to source utils to use pip to install west
BujSet Jul 25, 2025
eb158a6
Seems like I can git clone in the docker build process, moving it dir…
BujSet Jul 25, 2025
250fbe3
Seems like CI runner doesn't have write permissions to top level dire…
BujSet Jul 25, 2025
9649620
Forgot that zephyr folder already exists in et repo, making a zephyr_…
BujSet Jul 25, 2025
0d4344e
Almost made it to build, reusing exisitng scripts as much as possible
BujSet Jul 25, 2025
21cf931
Relative pathing is killing me, setting some path variables to help
BujSet Jul 25, 2025
464987c
SDK setup is not visible when set up in docker image, moving setup to…
BujSet Jul 28, 2025
d7c9740
Adding missing dependency of elftools to zephyr docker image
BujSet Jul 28, 2025
59324ac
Test seems to have passed, adding some error checking and clean up
BujSet Jul 28, 2025
3eae268
Refactor CI job to decompose test steps into reusable script functions
BujSet Jul 28, 2025
a7389d3
Removing comments
BujSet Jul 29, 2025
364ffc3
Minor typo fix in zephyr add ci test
BujSet Jul 29, 2025
5e1a389
Using grep to test for correctness, need to look for fixed string result
BujSet Jul 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions .ci/docker/common/install_zephyr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

set -ex

# shellcheck source=/dev/null
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"

# Double check if the NDK version is set
[ -n "${ZEPHYR_SDK}" ]

Expand Down Expand Up @@ -77,16 +80,8 @@ install_prerequiresites() {
chmod +x kitware-archive.sh && \
./kitware-archive.sh && \
rm -f kitware-archive.sh
useradd -d /home/zephyruser -m -s /bin/bash zephyruser
}

install_sdk() {
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.0/zephyr-sdk-0.16.0_linux-x86_64.tar.xz && \
tar -xf zephyr-sdk-0.16.0_linux-x86_64.tar.xz && \
rm -f zephyr-sdk-0.16.0_linux-x86_64.tar.xz && \
cd zephyr-sdk-0.16.0/ && \
./setup.sh -c -t arm-zephyr-eabi
pip_install --no-cache-dir west
pip_install pyelftools
}

install_prerequiresites
install_sdk
3 changes: 2 additions & 1 deletion .ci/docker/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ ARG ARM_SDK

ARG ZEPHYR_SDK
COPY ./common/install_zephyr.sh install_zephyr.sh
COPY ./common/utils.sh utils.sh
RUN if [ -n "${ZEPHYR_SDK}" ]; then bash ./install_zephyr.sh; fi
RUN rm install_zephyr.sh
RUN rm install_zephyr.sh utils.sh

ARG QNN_SDK

Expand Down
19 changes: 19 additions & 0 deletions .ci/scripts/zephyr-utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

download_arm_zephyr_sdk () {
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.0/zephyr-sdk-0.16.0_linux-x86_64.tar.xz
tar -xf zephyr-sdk-0.16.0_linux-x86_64.tar.xz
rm -f zephyr-sdk-0.16.0_linux-x86_64.tar.xz
}

setup_zephyr_et_module () {
git clone --branch executorch-module-integration https://github.com/BujSet/zephyr.git
west init -l zephyr
west config manifest.project-filter -- +executorch
west -v update
}
43 changes: 43 additions & 0 deletions .github/workflows/trunk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,49 @@ jobs:
# Build and test executorch
PYTHON_EXECUTABLE=python ${CONDA_RUN} bash .ci/scripts/test_model.sh "${MODEL_NAME}" "${BUILD_TOOL}" "${BACKEND}"

test-models-arm-zephyr:
name: test-models-arm-zephyr
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
strategy:
matrix:
model: [add]
fail-fast: false
with:
runner: linux.2xlarge
docker-image: ci-image:executorch-ubuntu-22.04-zephyr-sdk
submodules: 'recursive'
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
timeout: 120
script: |
MODEL_NAME=${{ matrix.model }}
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
conda activate "${CONDA_ENV}"

source .ci/scripts/utils.sh
source .ci/scripts/zephyr-utils.sh
mkdir -p zephyr_scratch/
cd zephyr_scratch
export ZEPHYR_PROJ_ROOT=$(realpath $(pwd))

download_arm_zephyr_sdk
./zephyr-sdk-0.16.0/setup.sh -c -t arm-zephyr-eabi

cd $ZEPHYR_PROJ_ROOT
setup_zephyr_et_module

cd $ZEPHYR_PROJ_ROOT/modules/lib/executorch
install_executorch "--use-pt-pinned-commit"
.ci/scripts/setup-arm-baremetal-tools.sh --target-toolchain zephyr
source examples/arm/ethos-u-scratch/setup_path.sh
source $ZEPHYR_PROJ_ROOT/zephyr/zephyr-env.sh
cd $ZEPHYR_PROJ_ROOT/zephyr/samples/modules/executorch/arm/hello_world
west build -p always -b mps3/corstone300/fvp
FVP_Corstone_SSE-300_Ethos-U55 -a build/zephyr/zephyr.elf -C mps3_board.visualisation.disable-visualisation=1 -C mps3_board.telnetterminal0.start_telnet=0 -C mps3_board.uart0.out_file='sim.out' -C cpu0.CFGITCMSZ=15 -C cpu0.CFGDTCMSZ=15 --simlimit 120

grep -qF "Output[0][0]: (float) 2.000000" sim.out
exit_status=$? #store 0 if found (success), 1 if not (failure)
exit $exit_status

test-models-linux-aarch64:
name: test-models-linux-aarch64
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
Expand Down
Loading