Skip to content

Build and Release

Build and Release #75

Workflow file for this run

name: Build and Release
on:
push:
branches: [main]
tags: ["v*"]
paths: ["bootloader/**", "firmware/**"]
pull_request:
branches: [main]
workflow_dispatch:
env:
REPO_PATH: ${{ github.workspace }}/wavephoenix
BOOTLOADER_PATH: ${{ github.workspace }}/wavephoenix/bootloader
FIRMWARE_PATH: ${{ github.workspace }}/wavephoenix/firmware
GECKO_SDK_PATH: ${{ github.workspace }}/gecko_sdk
SIMPLICITY_COMMANDER_PATH: ${{ github.workspace }}/commander
SLC_CLI_PATH: ${{ github.workspace }}/slc_cli
ARM_TOOLCHAIN_PATH: ${{ github.workspace }}/arm-toolchain
GECKO_SDK_VERSION: v4.4.5
ARM_GNU_TOOLCHAIN_VERSION: 12.2.rel1
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
board:
- efr32xg22e
- rf-bm-bg22c3
steps:
- name: Checkout repository
uses: actions/checkout@v6
# Set up dependencies
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build unzip wget
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: "corretto"
java-version: "21"
# Setup ARM GNU Toolchain
- name: Cache ARM GNU Toolchain
id: cache-arm-toolchain
uses: actions/cache@v4
with:
path: arm-gnu-toolchain-${{ env.ARM_GNU_TOOLCHAIN_VERSION }}-x86_64-arm-none-eabi
key: arm-toolchain-${{ env.ARM_GNU_TOOLCHAIN_VERSION }}
- name: Install ARM GNU Toolchain
if: steps.cache-arm-toolchain.outputs.cache-hit != 'true'
run: |
wget -q https://developer.arm.com/-/media/Files/downloads/gnu/${{ env.ARM_GNU_TOOLCHAIN_VERSION }}/binrel/arm-gnu-toolchain-${{ env.ARM_GNU_TOOLCHAIN_VERSION }}-x86_64-arm-none-eabi.tar.xz
tar xf arm-gnu-toolchain-${{ env.ARM_GNU_TOOLCHAIN_VERSION }}-x86_64-arm-none-eabi.tar.xz
# Setup Simplicity SDK
- name: Cache Simplicity SDK
id: cache-simplicity-sdk
uses: actions/cache@v4
with:
path: simplicity_sdk
key: simplicity-sdk-${{ env.SIMPLICITY_SDK_VERSION }}
- name: Install Simplicity SDK
if: steps.cache-simplicity-sdk.outputs.cache-hit != 'true'
run: |
wget -q https://github.com/SiliconLabs/simplicity_sdk/releases/download/${{ env.SIMPLICITY_SDK_VERSION }}/simplicity-sdk.zip
unzip -q simplicity-sdk.zip -d simplicity_sdk
# Setup SLC-CLI
- name: Cache SLC-CLI
id: cache-slc-cli
uses: actions/cache@v4
with:
path: slc_cli
key: slc-cli-${{ runner.os }}
restore-keys: |
slc-cli-${{ runner.os }}-
- name: Install SLC-CLI
if: steps.cache-slc-cli.outputs.cache-hit != 'true'
run: |
wget -q https://www.silabs.com/documents/login/software/slc_cli_linux.zip
unzip -q slc_cli_linux.zip
chmod +x slc_cli/slc
- name: Add SLC-CLI to PATH
run: |
echo "$PWD/slc_cli" >> $GITHUB_PATH
- name: Configure SLC-CLI
run: |
slc configuration --sdk simplicity_sdk
slc configuration --gcc-toolchain arm-gnu-toolchain-${{ env.ARM_GNU_TOOLCHAIN_VERSION }}-x86_64-arm-none-eabi
slc signature trust --sdk simplicity_sdk
# Setup Simplicity Commander
- name: Cache Simplicity Commander
id: cache-simplicity-commander
uses: actions/cache@v4
with:
path: commander
key: simplicity-commander-${{ runner.os }}
restore-keys: |
simplicity-commander-${{ runner.os }}-
- name: Install Simplicity Commander
if: steps.cache-simplicity-commander.outputs.cache-hit != 'true'
run: |
wget -q https://www.silabs.com/documents/login/software/SimplicityCommander-Linux.zip
unzip -q SimplicityCommander-Linux.zip
tar -xf SimplicityCommander-Linux/Commander_linux_x86_64_*.tar.bz
- name: Add Simplicity Commander to PATH
run: |
echo "$PWD/commander" >> $GITHUB_PATH
# Build bootloader
- name: Generate bootloader project files
working-directory: bootloader
run: |
slc generate bootloader-${{ matrix.board }}.slcp \
-o cmake \
-d target/${{ matrix.board }}
- name: Build bootloader
working-directory: bootloader/target/${{ matrix.board }}/bootloader_cmake
run: |
cmake --workflow --preset project
# Build firmware
- name: Generate firmware project files
working-directory: firmware
run: |
slc generate wavephoenix.slcp \
--with "${{ matrix.board }};wavephoenix" \
--sdk-extensions=.,libjoybus,libwavebird \
-o cmake \
-d target/${{ matrix.board }}
- name: Build firmware
working-directory: firmware/target/${{ matrix.board }}/wavephoenix_cmake
run: |
cmake --workflow --preset project
# - name: Update trunk tag
# if: github.ref == 'refs/heads/main'
# run: |
# cd ${{ env.REPO_PATH }}
# git tag -f trunk
# git push -f origin trunk
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Rename artifacts
# run: |
# if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
# VERSION=${GITHUB_REF_NAME}
# else
# VERSION="trunk"
# fi
# mv ${{ env.BOOTLOADER_PATH }}/bootloader_project/bootloader_cmake/build/default_config/bootloader.hex "wavephoenix-bootloader-${VERSION}-${{ matrix.board }}.hex"
# mv ${{ env.FIRMWARE_PATH }}/build/${{ matrix.board }}/receiver/receiver.hex "wavephoenix-receiver-${VERSION}-${{ matrix.board }}.hex"
# mv ${{ env.FIRMWARE_PATH }}/build/${{ matrix.board }}/receiver/receiver.gbl "wavephoenix-receiver-${VERSION}-${{ matrix.board }}.gbl"
# - name: Upload artifacts to trunk release
# if: github.ref == 'refs/heads/main'
# uses: softprops/action-gh-release@v2
# with:
# files: |
# wavephoenix-bootloader-*.hex
# wavephoenix-receiver-*.hex
# wavephoenix-receiver-*.gbl
# tag_name: trunk
# name: Trunk Builds
# body: Automated build from main branch, not guaranteed to be stable.
# prerelease: true
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Upload artifacts to tagged release
# if: startsWith(github.ref, 'refs/tags/')
# uses: softprops/action-gh-release@v2
# with:
# files: |
# wavephoenix-bootloader-*.hex
# wavephoenix-receiver-*.hex
# wavephoenix-receiver-*.gbl
# tag_name: ${{ github.ref }}
# name: ${{ github.ref_name }}
# draft: true
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}