Skip to content

Commit ba57692

Browse files
Setup CI to build and test machine_learning_applications repo
1 parent a1de285 commit ba57692

File tree

3 files changed

+193
-14
lines changed

3 files changed

+193
-14
lines changed

.github/workflows/ci.yml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: Continuous Integration for Machine Learning Applications
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- feature/*
7+
tags:
8+
- v*
9+
pull_request:
10+
branches:
11+
- main
12+
- feature/*
13+
workflow_dispatch:
14+
15+
permissions:
16+
id-token: write
17+
contents: read
18+
19+
jobs:
20+
generate-matrix:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
matrix: ${{ steps.set-matrix.outputs.matrix }}
24+
steps:
25+
- uses: actions/checkout@v5
26+
27+
- name: Generate dynamic matrix from templates.xml
28+
id: set-matrix
29+
run: |
30+
matrix=$(python3 .github/workflows/scripts/generate_matrix.py | jq -c .)
31+
echo "matrix=$matrix" >> $GITHUB_OUTPUT
32+
33+
get-sdk:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Clone GSDK and ai-ml app
37+
shell: bash
38+
run: |
39+
set -e
40+
mkdir src
41+
echo "==> Creating developer directories..."
42+
cd src
43+
echo "==> Cloning public GSDK"
44+
git clone https://github.com/SiliconLabs/simplicity_sdk.git gsdk
45+
cd gsdk
46+
git checkout v2025.6.2
47+
mkdir extension
48+
cd extension
49+
git clone --recurse-submodules https://github.com/SiliconLabsSoftware/aiml-extension.git aiml-extension
50+
cd aiml-extension
51+
git checkout v2.1.2
52+
git submodule update --init --recursive
53+
git lfs pull || true
54+
55+
- name: Checkout machine_learning_applications (this repo)
56+
uses: actions/checkout@v5
57+
with:
58+
path: src/gsdk/extension/machine_learning_applications
59+
60+
- name: Upload SDK
61+
uses: actions/upload-artifact@v5
62+
with:
63+
name: sisdk-and-extensions
64+
path: .
65+
include-hidden-files: true
66+
67+
get-tools:
68+
runs-on: ubuntu-latest
69+
steps:
70+
- name: Download ARM-GNU and SLC toolchain
71+
run: |
72+
mkdir -p tools && cd tools
73+
wget -q https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz
74+
tar -xf arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz
75+
mv arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi armgnu
76+
rm arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz
77+
wget -q https://www.silabs.com/documents/public/software/slc_cli_linux.zip
78+
unzip -q slc_cli_linux.zip -d slc_cli
79+
rm slc_cli_linux.zip
80+
81+
- name: Upload Tools
82+
uses: actions/upload-artifact@v5
83+
with:
84+
name: arm-gnu-toolchain-and-slc
85+
path: .
86+
include-hidden-files: true
87+
88+
build:
89+
runs-on: ubuntu-latest
90+
needs: [generate-matrix, get-sdk, get-tools]
91+
strategy:
92+
fail-fast: false
93+
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
94+
steps:
95+
- name: Download GSDK
96+
uses: actions/download-artifact@v5
97+
with:
98+
name: sisdk-and-extensions
99+
path: .
100+
101+
- name: Download ARM-GNU and SLC toolchain
102+
uses: actions/download-artifact@v5
103+
with:
104+
name: arm-gnu-toolchain-and-slc
105+
path: .
106+
107+
- name: Install Java 21
108+
uses: actions/setup-java@v4
109+
with:
110+
distribution: temurin
111+
java-version: '21'
112+
check-latest: true
113+
114+
- name: Configure SLC,ARM-GNU, JAVA paths
115+
run: |
116+
set -e
117+
tree -L 3
118+
chmod -R +x ${{ github.workspace }}/tools/armgnu
119+
echo "ARM_GCC_DIR=${{ github.workspace }}/tools/armgnu" >> "$GITHUB_ENV"
120+
echo "${{ github.workspace }}/tools/armgnu/bin/" >> "$GITHUB_PATH"
121+
122+
SLC_DIR="${{ github.workspace }}/tools/slc_cli/slc_cli/bin/slc-cli"
123+
chmod +x "$SLC_DIR/slc-cli"
124+
ln -sf "$SLC_DIR/slc-cli" "$SLC_DIR/slc"
125+
echo "UC_CLI_DIR=$SLC_DIR" >> "$GITHUB_ENV"
126+
echo "$SLC_DIR" >> "$GITHUB_PATH"
127+
128+
echo "SLC_JAVA_HOME=$JAVA_HOME" >> "$GITHUB_ENV"
129+
130+
- name: Trust sdk's
131+
run: |
132+
set -e
133+
slc configuration --sdk "${{ github.workspace }}/src/gsdk"
134+
slc signature trust --sdk "${{ github.workspace }}/src/gsdk"
135+
slc signature trust --extension-path "${{ github.workspace }}/src/gsdk/extension/aiml-extension"
136+
slc signature trust --extension-path "${{ github.workspace }}/src/gsdk/extension/machine_learning_applications"
137+
138+
- name: Generate + Build
139+
working-directory: ${{ github.workspace }}/src/gsdk/extension/machine_learning_applications
140+
env:
141+
APP: ${{ matrix.app }}
142+
BOARD: ${{ matrix.board }}
143+
run: |
144+
set -e
145+
echo "App: $APP"
146+
echo "BOARD: $BOARD"
147+
slc generate -d target/$APP/$BOARD -p $APP.slcp --with $BOARD -s "${{ github.workspace }}/src/gsdk"
148+
cmake --preset project -S target/$APP/$BOARD/${APP##*/}_cmake
149+
cmake --build target/$APP/$BOARD/${APP##*/}_cmake/build --parallel
150+
echo "==> Listing generated .s37 files"
151+
find ./target -name "*.s37"
152+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env python3
2+
import os, json
3+
from pathlib import Path
4+
import xml.etree.ElementTree as ET
5+
6+
ROOT = Path(__file__).resolve().parents[3]
7+
TEMPLATES_XML = ROOT / "templates.xml"
8+
9+
def get_prop(desc, key):
10+
# <properties key="boardCompatibility" value="...">
11+
p = desc.find(f'properties[@key="{key}"]')
12+
return (p.get("value") if p is not None else "").strip()
13+
14+
def split_ws(s):
15+
# boardCompatibility is space-separated: "brd2601a brd2601b"
16+
return [x for x in s.replace(",", " ").split() if x]
17+
18+
def main():
19+
tree = ET.parse(TEMPLATES_XML)
20+
root = tree.getroot()
21+
22+
rows = []
23+
for desc in root.findall("descriptors"):
24+
app = get_prop(desc, "projectFilePaths").split(".")[0] # e.g. application/voice/.../series_2.slcp -> application/voice/.../series_2
25+
boards = split_ws(get_prop(desc, "boardCompatibility")) # e.g. ["brd2601a", "brd2601b"]
26+
27+
for board in boards:
28+
rows.append({
29+
"app": app,
30+
"board": board
31+
})
32+
33+
if not rows:
34+
# Avoid empty matrix which makes Actions error out
35+
rows = [{"app":"noop","board":"noop"}]
36+
37+
matrix = {"include": rows}
38+
print(json.dumps(matrix, indent=2))
39+
40+
if __name__ == "__main__":
41+
main()

templates.xml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,6 @@
1313
<properties key="stockConfigCompatibility" value="com.silabs.ss.framework.project.toolchain.core.default"/>
1414
<properties key="filters" value="Capability|Machine\ Learning Device\ Type|SoC MCU|32-bit\ MCU Project\ Difficulty|Advanced"/>
1515
</descriptors>
16-
<descriptors name="sensory_wakeupword" label="Machine Learning - Sensory Wakeup Word" description="This example project demos wakeup word detection using Sensory's TrulyHandsFree (THF) solution for Series 1 boards. Several models implementing different wake word phrases are included in the provided example projects. You can also create you own wake word model on Sensory's VoiceHub and include it in this demo to try it out.&#xA;">
17-
<properties key="namespace" value="template.uc"/>
18-
<properties key="keywords" value="universal\ configurator"/>
19-
<properties key="projectFilePaths" value="application/voice/sensory_wakeupword/app/sensory_wakeupword_series_1.slcp"/>
20-
<properties key="readmeFiles" value="application/voice/sensory_wakeupword/README.md"/>
21-
<properties key="boardCompatibility" value="brd4166a"/>
22-
<properties key="partCompatibility" value=".*efr32mg12p.*"/>
23-
<properties key="ideCompatibility" value="iar-embedded-workbench makefile-ide segger-embedded-studio simplicity-ide"/>
24-
<properties key="toolchainCompatibility" value="gcc iar segger"/>
25-
<properties key="category" value="Example|Machine Learning"/>
26-
<properties key="quality" value="EXPERIMENTAL"/>
27-
<properties key="stockConfigCompatibility" value="com.silabs.ss.framework.project.toolchain.core.default"/>
28-
<properties key="filters" value="Capability|Machine\ Learning Device\ Type|SoC MCU|32-bit\ MCU Project\ Difficulty|Advanced"/>
29-
</descriptors>
3016
<descriptors name="people_flow_counter_mlx90640" label="Machine Learning - People Flow Counter" description="A demo displaying how xG24-DK2601B can be used to to gain information about people flow using an IR camera.&#xA;">
3117
<properties key="namespace" value="template.uc"/>
3218
<properties key="keywords" value="universal\ configurator"/>

0 commit comments

Comments
 (0)