mirror of
https://github.com/loopj/wavephoenix.git
synced 2025-12-20 10:29:58 +00:00
165 lines
5.8 KiB
YAML
165 lines
5.8 KiB
YAML
name: Build and Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "bootloader/**"
|
|
- "firmware/**"
|
|
tags:
|
|
- "v*"
|
|
|
|
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: Install build dependencies
|
|
run: |
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
sudo apt-get update
|
|
sudo apt-get -o Dpkg::Options::="--path-exclude=/usr/share/man/*" -o Dpkg::Options::="--path-exclude=/usr/share/doc/*" -o Dpkg::Options::="--path-exclude=/usr/share/locale*" install -y cmake ninja-build
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.10"
|
|
|
|
- name: Install Python packages
|
|
run: pip install jinja2 pyyaml numpy scipy
|
|
|
|
- name: Set up Java
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: "corretto"
|
|
java-version: "21"
|
|
|
|
- name: Cache ARM GNU Toolchain
|
|
id: cache-arm-toolchain
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ env.ARM_TOOLCHAIN_PATH }}
|
|
key: arm-toolchain-${{ env.ARM_GNU_TOOLCHAIN_VERSION }}
|
|
|
|
- name: Install ARM GNU Toolchain
|
|
if: steps.cache-arm-toolchain.outputs.cache-hit != 'true'
|
|
run: |
|
|
mkdir -p ${{ env.ARM_TOOLCHAIN_PATH }}
|
|
curl -L "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 -xJ -C "${{ env.ARM_TOOLCHAIN_PATH }}" --strip-components=1
|
|
|
|
- name: Add ARM GNU Toolchain to PATH
|
|
run: echo "${{ env.ARM_TOOLCHAIN_PATH }}/bin" >> $GITHUB_PATH
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
path: ${{ env.REPO_PATH }}
|
|
|
|
- name: Cache Gecko SDK
|
|
id: cache-gecko-sdk
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ env.GECKO_SDK_PATH }}
|
|
key: gecko-sdk-${{ env.GECKO_SDK_VERSION }}
|
|
|
|
- name: Download Gecko SDK
|
|
if: steps.cache-gecko-sdk.outputs.cache-hit != 'true'
|
|
run: |
|
|
wget -nv https://github.com/SiliconLabs/gecko_sdk/releases/download/${{ env.GECKO_SDK_VERSION }}/gecko-sdk.zip
|
|
unzip -q gecko-sdk.zip -d ${{ env.GECKO_SDK_PATH }}
|
|
|
|
- name: "Download Simplicity Commander"
|
|
run: |
|
|
wget -nv 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: Download SLC-CLI
|
|
run: |
|
|
wget -nv https://www.silabs.com/documents/login/software/slc_cli_linux.zip
|
|
unzip -q slc_cli_linux.zip
|
|
|
|
- name: Build bootloader
|
|
run: |
|
|
export ARM_GCC_DIR="${{ env.ARM_TOOLCHAIN_PATH }}"
|
|
|
|
cd ${{ env.BOOTLOADER_PATH }}
|
|
${{ env.SLC_CLI_PATH }}/slc signature trust --sdk ${{ env.GECKO_SDK_PATH }}
|
|
${{ env.SLC_CLI_PATH }}/slc generate -s ${{ env.GECKO_SDK_PATH }} -p bootloader-${{ matrix.board }}.slcp -d bootloader_project -o cmake
|
|
|
|
cd bootloader_project/bootloader_cmake
|
|
cmake --workflow --preset project
|
|
cmake --preset project && cmake --build --preset default_config
|
|
|
|
- name: Build firmware
|
|
run: |
|
|
cd ${{ env.FIRMWARE_PATH }}
|
|
cmake --preset ${{ matrix.board }} && cmake --build --preset ${{ matrix.board }}
|
|
|
|
- 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 }}
|