Skip to content

Commit c3a27a6

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 c3a27a6

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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: System dependencies
24+
run: |
25+
sudo apt-get update
26+
sudo apt-get install gcc-multilib g++-multilib
27+
28+
- name: Checkout SOF repository
29+
uses: actions/checkout@v4
30+
with:
31+
path: ./workspace/sof
32+
fetch-depth: 2
33+
filter: 'tree:0'
34+
35+
- name: West update
36+
run: |
37+
cd workspace/sof
38+
pip3 install west
39+
west init -l
40+
west update --narrow --fetch-opt=--filter=tree:0
41+
42+
- name: Install Python dependencies
43+
run: |
44+
cd workspace
45+
pip3 install --user -r zephyr/scripts/requirements.txt
46+
47+
- name: Install Zephyr SDK
48+
run: |
49+
cd workspace/zephyr
50+
west sdk install --version 0.16.9 -t x86_64-zephyr-elf
51+
52+
- name: Build and run unit tests
53+
run: |
54+
cd workspace
55+
west twister --testsuite-root sof/test/ztest/unit/ --platform native_sim --verbose \
56+
--inline-logs

0 commit comments

Comments
 (0)