Skip to content

Commit b8300ff

Browse files
committed
workflow: Add minimal Zephyr unit tests workflow for SOF CI
This commit introduces a basic GitHub Actions workflow to establish the foundation for running SOF unit tests that have been ported from cmocka to Zephyr ztest framework. The workflow currently includes: - Basic checkout step with proper fetch depth and tree filtering - West initialization and workspace setup - Environment verification step for debugging This is the first iteration of the workflow, designed to validate the basic environment setup before implementing the full test execution pipeline. The workflow will be expanded in subsequent commits to include: - Zephyr SDK installation - Complete environment configuration - Unit test compilation and execution using west twister - Test result collection and reporting Testing approach: - Triggers only on pull requests for safe testing - Minimal resource usage during initial validation - Debug output to verify workspace structure The workflow follows SOF CI patterns and prepares the groundwork for integrating ztest unit tests into the continuous integration pipeline. Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
1 parent f7724e4 commit b8300ff

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
name: "Unit tests"
3+
on:
4+
pull_request:
5+
branches:
6+
- 'main'
7+
8+
permissions:
9+
contents: read
10+
11+
# Specifies group name that stops previous workflows if the name matches
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
zephyr-utests:
18+
name: Zephyr Unit Tests (ZTest)
19+
runs-on: ubuntu-22.04
20+
timeout-minutes: 10
21+
22+
steps:
23+
- name: Install build tools
24+
run: |
25+
sudo apt-get update
26+
sudo apt-get -y install clang llvm ninja-build device-tree-compiler \
27+
python3-pyelftools
28+
# Install multilib packages required for native_sim i386 target
29+
sudo apt-get install gcc-multilib g++-multilib
30+
31+
- name: Checkout SOF repository
32+
uses: actions/checkout@v4
33+
with:
34+
path: ./workspace/sof
35+
fetch-depth: 2
36+
filter: 'tree:0'
37+
38+
- name: West update
39+
run: |
40+
cd workspace/sof
41+
pip3 install west
42+
west init -l
43+
west update --narrow --fetch-opt=--filter=tree:0
44+
45+
- name: Install Python dependencies
46+
run: |
47+
cd workspace/zephyr
48+
pip3 install --user -r scripts/requirements.txt
49+
50+
# - name: Install Zephyr SDK
51+
# run: |
52+
# cd workspace/zephyr
53+
# west sdk install --version 0.16.9 -t x86_64-zephyr-elf
54+
55+
- name: Build and run unit tests
56+
run: |
57+
cd workspace
58+
export ZEPHYR_TOOLCHAIN_VARIANT=llvm
59+
west twister --testsuite-root sof/test/ztest/unit/ --platform native_sim --verbose \
60+
--inline-logs

0 commit comments

Comments
 (0)