Build firmware #63
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Build firmware" | |
| # Run this job on all pushes to master, for pull requests | |
| # as well as tags with a semantic version | |
| on: | |
| push: | |
| branches: | |
| # This avoids having duplicate builds in non-forked PRs | |
| - "master" | |
| - "sisdk-*" | |
| release: | |
| types: | |
| - published | |
| pull_request: {} | |
| # Cancel previous PR/branch runs when a new commit is pushed | |
| concurrency: | |
| group: "build-firmware-${{ github.ref }}" | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| - name: Install JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 21 | |
| - name: Download Simplicity SDK | |
| run: | | |
| curl -o simplicity_sdk_2024.12.1.zip -L https://github.com/SiliconLabs/simplicity_sdk/releases/download/v2024.12.1-0/simplicity-sdk.zip \ | |
| && unzip -q -d /opt/simplicity_sdk simplicity_sdk_2024.12.1.zip \ | |
| && rm simplicity_sdk_2024.12.1.zip | |
| - name: Download SLC CLI | |
| run: | | |
| curl -O https://www.silabs.com/documents/login/software/slc_cli_linux.zip \ | |
| && unzip -q -d /opt slc_cli_linux.zip \ | |
| && rm slc_cli_linux.zip | |
| # Install Simplicity Commander (unfortunately no stable URL available, this | |
| # is known to be working with Commander_linux_x86_64_1v15p0b1306.tar.bz). | |
| - name: Download Simplicity Commander | |
| run: | | |
| curl -O https://www.silabs.com/documents/login/software/SimplicityCommander-Linux.zip \ | |
| && unzip -q SimplicityCommander-Linux.zip \ | |
| && tar -C /opt -xjf SimplicityCommander-Linux/Commander_linux_x86_64_*.tar.bz \ | |
| && rm -r SimplicityCommander-Linux \ | |
| && rm SimplicityCommander-Linux.zip | |
| # GCC Embedded Toolchain 12.2.rel1 (for Gecko SDK 4.4.0+) | |
| - name: Download Toolchain | |
| run: | | |
| curl -O https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz \ | |
| && tar -C /opt -xf arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz \ | |
| && rm arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz | |
| - name: Build project | |
| run: tools/build.sh | |
| env: | |
| SDK: /opt/simplicity_sdk | |
| SLC: /opt/slc_cli/slc | |
| COMMANDER: /opt/commander/commander | |
| - name: Determine firmware version | |
| id: version | |
| run: | | |
| VERSION=$(node tools/extract_version.mjs) | |
| if [ "${{ github.event_name }}" == "release" ]; then | |
| SUFFIX="$VERSION" | |
| else | |
| COMMIT=$(git rev-parse --short ${{ github.sha }}) | |
| SUFFIX="${VERSION}_${COMMIT}" | |
| fi | |
| echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
| echo "SUFFIX=${SUFFIX}" >> $GITHUB_ENV | |
| - name: Copy HEX file | |
| run: cp build/release/nc_controller_ncp.hex artifact/zwa2_controller.hex | |
| - name: Compute checksums for HEX files | |
| run: | | |
| sha256sum artifact/zwa2_controller.hex | cut -d" " -f1 > artifact/zwa2_controller.hex.sha256 | |
| md5sum artifact/zwa2_controller.hex | cut -d" " -f1 > artifact/zwa2_controller.hex.md5 | |
| - name: Prepare files for upload | |
| run: | | |
| mkdir -p upload | |
| cp artifact/zwa2_controller.gbl upload/zwa2_controller_${{ env.SUFFIX }}.gbl | |
| echo "GBL=zwa2_controller_${{ env.SUFFIX }}.gbl" >> $GITHUB_ENV | |
| cp artifact/zwa2_controller.hex upload/zwa2_controller_${{ env.SUFFIX }}.hex | |
| echo "HEX=zwa2_controller_${{ env.SUFFIX }}.hex" >> $GITHUB_ENV | |
| cp artifact/zwa2_controller.hex.sha256 upload/zwa2_controller_${{ env.SUFFIX }}.hex.sha256 | |
| echo "HEX_SHA256=zwa2_controller_${{ env.SUFFIX }}.hex.sha256" >> $GITHUB_ENV | |
| cp artifact/zwa2_controller.hex.md5 upload/zwa2_controller_${{ env.SUFFIX }}.hex.md5 | |
| echo "HEX_MD5=zwa2_controller_${{ env.SUFFIX }}.hex.md5" >> $GITHUB_ENV | |
| - name: Upload GBL | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.GBL }} | |
| path: upload/${{ env.GBL }} | |
| - name: Upload HEX | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.HEX }} | |
| path: upload/${{ env.HEX }} | |
| - name: Upload HEX SHAsum | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.HEX_SHA256 }} | |
| path: upload/${{ env.HEX_SHA256 }} | |
| - name: Upload HEX MD5sum | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.HEX_MD5 }} | |
| path: upload/${{ env.HEX_MD5 }} | |
| - name: Upload firmware package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: zwa2_controller_${{ env.SUFFIX }} | |
| path: upload/*.* | |
| - name: Upload to release | |
| if: github.event_name == 'release' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: upload/*.* | |
| - name: Debug Build failures | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: slc_cli_log | |
| path: /opt/slc_cli/bin/slc-cli/configuration/*.log |