-
Notifications
You must be signed in to change notification settings - Fork 1
Mlsw 10552 setup ci to build and test machine learning applications repo #5
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
base: main
Are you sure you want to change the base?
Changes from all commits
e80cfa3
821f3b6
f595544
a3e20a8
5261098
f9bb9a4
f16b11a
38fa9bc
c8b025f
a0cb5d4
884d629
237b37a
99ca1f4
af60f0d
2964e02
b725bf5
efd9aa9
233399f
192cebd
e8c400b
a24c4c3
2cfd993
38f455a
f110ab8
c7031ea
785633e
04d120d
1fd5446
eccc103
e2040df
1ba8d45
7d80481
af06a60
fb5849e
38258bf
d0ec482
7b702a6
1dfc200
9cdd536
0c16526
86cd92e
92ba1dd
ba0b3af
124f538
af708d9
6952139
559ea6b
c10d8c0
83abe55
0e68ad1
b3b9fd2
7a5c23a
7d65d61
5f372e7
898a287
9ba8b84
447acb0
4b6fa33
2309144
14bd446
6e50743
dceb46f
d80f1da
468042c
798a1a9
67a8242
ed9c72d
e0160e1
9751d9e
93a39c5
843b919
1821252
aff834c
dcae63f
dd22856
bb33727
58c4d2f
c90dc7b
3334974
831bf62
23a6dc5
27de542
8d3a128
d63e450
2360778
d81dc29
1c74b6d
06550d8
d5d6e66
ba88781
1e4b3d2
8c3a617
94b7cf4
1f61128
2443f30
f7ed6ba
0272ca3
fc515da
932d25d
c01f337
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,152 @@ | ||||||||||
| name: Continuous Integration for Machine Learning Applications | ||||||||||
| on: | ||||||||||
| push: | ||||||||||
| branches: | ||||||||||
| - main | ||||||||||
| - feature/* | ||||||||||
| tags: | ||||||||||
| - v* | ||||||||||
| pull_request: | ||||||||||
| branches: | ||||||||||
| - main | ||||||||||
| - feature/* | ||||||||||
| workflow_dispatch: | ||||||||||
|
|
||||||||||
| permissions: | ||||||||||
| id-token: write | ||||||||||
| contents: read | ||||||||||
|
|
||||||||||
| jobs: | ||||||||||
| generate-matrix: | ||||||||||
| runs-on: ubuntu-latest | ||||||||||
| outputs: | ||||||||||
| matrix: ${{ steps.set-matrix.outputs.matrix }} | ||||||||||
| steps: | ||||||||||
| - uses: actions/checkout@v5 | ||||||||||
|
|
||||||||||
| - name: Generate dynamic matrix from templates.xml | ||||||||||
| id: set-matrix | ||||||||||
| run: | | ||||||||||
| matrix=$(python3 .github/workflows/scripts/generate_matrix.py | jq -c .) | ||||||||||
| echo "matrix=$matrix" >> $GITHUB_OUTPUT | ||||||||||
|
|
||||||||||
| get-sdk: | ||||||||||
| runs-on: ubuntu-latest | ||||||||||
| steps: | ||||||||||
| - name: Clone GSDK and ai-ml app | ||||||||||
| shell: bash | ||||||||||
| run: | | ||||||||||
| set -e | ||||||||||
| mkdir src | ||||||||||
| echo "==> Creating developer directories..." | ||||||||||
| cd src | ||||||||||
| echo "==> Cloning public GSDK" | ||||||||||
| git clone https://github.com/SiliconLabs/simplicity_sdk.git gsdk | ||||||||||
| cd gsdk | ||||||||||
| git checkout v2025.6.2 | ||||||||||
| mkdir extension | ||||||||||
| cd extension | ||||||||||
| git clone --recurse-submodules https://github.com/SiliconLabsSoftware/aiml-extension.git aiml-extension | ||||||||||
| cd aiml-extension | ||||||||||
| git checkout v2.1.2 | ||||||||||
| git submodule update --init --recursive | ||||||||||
| git lfs pull || true | ||||||||||
|
|
||||||||||
| - name: Checkout machine_learning_applications (this repo) | ||||||||||
| uses: actions/checkout@v5 | ||||||||||
| with: | ||||||||||
| path: src/gsdk/extension/machine_learning_applications | ||||||||||
silabs-raashid marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
|
|
||||||||||
| - name: Upload SDK | ||||||||||
| uses: actions/upload-artifact@v5 | ||||||||||
| with: | ||||||||||
| name: SDK | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| path: . | ||||||||||
| include-hidden-files: true | ||||||||||
|
|
||||||||||
| get-tools: | ||||||||||
| runs-on: ubuntu-latest | ||||||||||
| steps: | ||||||||||
| - name: Download ARM-GNU and SLC toolchain | ||||||||||
| run: | | ||||||||||
| mkdir -p tools && cd tools | ||||||||||
| 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 | ||||||||||
| tar -xf arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz | ||||||||||
| mv arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi armgnu | ||||||||||
| rm arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz | ||||||||||
| wget -q https://www.silabs.com/documents/public/software/slc_cli_linux.zip | ||||||||||
| unzip -q slc_cli_linux.zip -d slc_cli | ||||||||||
| rm slc_cli_linux.zip | ||||||||||
|
|
||||||||||
| - name: Upload Tools | ||||||||||
| uses: actions/upload-artifact@v5 | ||||||||||
| with: | ||||||||||
| name: ARM_GNU-and-slc-toolchain | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| path: . | ||||||||||
| include-hidden-files: true | ||||||||||
|
|
||||||||||
| build-ml: | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| runs-on: ubuntu-latest | ||||||||||
| needs: [generate-matrix, get-sdk, get-tools] | ||||||||||
| strategy: | ||||||||||
| fail-fast: false | ||||||||||
| matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} | ||||||||||
| steps: | ||||||||||
| - name: Download GSDK | ||||||||||
| uses: actions/download-artifact@v5 | ||||||||||
| with: | ||||||||||
| name: SDK | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| path: . | ||||||||||
|
|
||||||||||
| - name: Download ARM-GNU and SLC toolchain | ||||||||||
| uses: actions/download-artifact@v5 | ||||||||||
| with: | ||||||||||
| name: ARM_GNU-and-slc-toolchain | ||||||||||
| path: . | ||||||||||
|
Comment on lines
+104
to
+105
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
|
||||||||||
| - name: Install Java 21 | ||||||||||
| uses: actions/setup-java@v4 | ||||||||||
| with: | ||||||||||
| distribution: temurin | ||||||||||
| java-version: '21' | ||||||||||
| check-latest: true | ||||||||||
|
|
||||||||||
| - name: Configure SLC,ARM-GNU, JAVA paths | ||||||||||
| run: | | ||||||||||
| set -e | ||||||||||
| tree -L 3 | ||||||||||
| chmod -R +x ${{ github.workspace }}/tools/armgnu | ||||||||||
| echo "ARM_GCC_DIR=${{ github.workspace }}/tools/armgnu" >> "$GITHUB_ENV" | ||||||||||
| echo "${{ github.workspace }}/tools/armgnu/bin/" >> "$GITHUB_PATH" | ||||||||||
|
|
||||||||||
| SLC_DIR="${{ github.workspace }}/tools/slc_cli/slc_cli/bin/slc-cli" | ||||||||||
| chmod +x "$SLC_DIR/slc-cli" | ||||||||||
| ln -sf "$SLC_DIR/slc-cli" "$SLC_DIR/slc" | ||||||||||
| echo "UC_CLI_DIR=$SLC_DIR" >> "$GITHUB_ENV" | ||||||||||
| echo "$SLC_DIR" >> "$GITHUB_PATH" | ||||||||||
|
|
||||||||||
| echo "SLC_JAVA_HOME=$JAVA_HOME" >> "$GITHUB_ENV" | ||||||||||
|
|
||||||||||
| - name: Trust sdk's | ||||||||||
| run: | | ||||||||||
| set -e | ||||||||||
| slc configuration --sdk "${{ github.workspace }}/src/gsdk" | ||||||||||
| slc signature trust --sdk "${{ github.workspace }}/src/gsdk" | ||||||||||
| slc signature trust --extension-path "${{ github.workspace }}/src/gsdk/extension/aiml-extension" | ||||||||||
| slc signature trust --extension-path "${{ github.workspace }}/src/gsdk/extension/machine_learning_applications" | ||||||||||
|
|
||||||||||
| - name: Generate + Build | ||||||||||
| working-directory: ${{ github.workspace }}/src/gsdk/extension/machine_learning_applications | ||||||||||
| env: | ||||||||||
| APP: ${{ matrix.app }} | ||||||||||
| BOARD: ${{ matrix.board }} | ||||||||||
| run: | | ||||||||||
| set -e | ||||||||||
| echo "App: $APP" | ||||||||||
| echo "BOARD: $BOARD" | ||||||||||
| slc generate -d target/$APP/$BOARD -p $APP.slcp --with $BOARD -s "${{ github.workspace }}/src/gsdk" | ||||||||||
| cmake --preset project -S target/$APP/$BOARD/${APP##*/}_cmake | ||||||||||
| cmake --build target/$APP/$BOARD/${APP##*/}_cmake/build --parallel | ||||||||||
| echo "==> Listing generated .s37 files" | ||||||||||
| find ./target -name "*.s37" | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #!/usr/bin/env python3 | ||
| import os, json | ||
| from pathlib import Path | ||
| import xml.etree.ElementTree as ET | ||
|
|
||
| ROOT = Path(__file__).resolve().parents[3] | ||
| TEMPLATES_XML = ROOT / "templates.xml" | ||
|
|
||
| def get_prop(desc, key): | ||
| # <properties key="boardCompatibility" value="..."> | ||
| p = desc.find(f'properties[@key="{key}"]') | ||
| return (p.get("value") if p is not None else "").strip() | ||
|
|
||
| def split_ws(s): | ||
| # boardCompatibility is space-separated: "brd2601a brd2601b" | ||
| return [x for x in s.replace(",", " ").split() if x] | ||
|
|
||
| def main(): | ||
| tree = ET.parse(TEMPLATES_XML) | ||
| root = tree.getroot() | ||
|
|
||
| rows = [] | ||
| for desc in root.findall("descriptors"): | ||
| app = get_prop(desc, "projectFilePaths").split(".")[0] # e.g. application/voice/.../series_2.slcp -> application/voice/.../series_2 | ||
| boards = split_ws(get_prop(desc, "boardCompatibility")) # e.g. ["brd2601a", "brd2601b"] | ||
|
|
||
| for board in boards: | ||
| rows.append({ | ||
| "app": app, | ||
| "board": board | ||
| }) | ||
|
|
||
| if not rows: | ||
| # Avoid empty matrix which makes Actions error out | ||
| rows = [{"app":"noop","board":"noop"}] | ||
|
|
||
| matrix = {"include": rows} | ||
| print(json.dumps(matrix, indent=2)) | ||
|
|
||
| if __name__ == "__main__": | ||
| main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please change the file name to lowercase
ci.ymlThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file name is still in uppercase (
CI.yml). Please make it lowercase (ci.yml).