|
| 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 | +
|
0 commit comments