Skip to content

Commit

Permalink
fix: separate workflow for Z-Wave
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone committed Oct 25, 2023
1 parent ade8230 commit 155bebc
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ jobs:
device: EFR32ZG14P231F256GM32
components: brd4206a
# patchpath: "RCPMultiPAN/SkyConnect"
uses: ./.github/workflows/silabs-firmware-build.yaml
uses: ./.github/workflows/silabs-firmware-build-zwave.yaml
with:
image_name: ${{ needs.build-container.outputs.image_name }}
firmware_name: zwave_serial_api_controller_${{ needs.build-container.outputs.sdk_version }}_${{ matrix.target }}
Expand Down
118 changes: 118 additions & 0 deletions .github/workflows/silabs-firmware-build-zwave.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Single firmware build

on:
workflow_call:
inputs:
image_name:
required: false
type: string
default: "ghcr.io/${{ github.repository_owner }}/silabs-firmware-builder:${{ inputs.sdk_version }}"
firmware_name:
required: true
type: string
project_file:
required: true
type: string
project_name:
required: true
type: string
device:
required: true
type: string
components:
required: false
type: string
configuration:
required: false
type: string
patchpath:
required: false
type: string
sdkpatchpath:
required: false
type: string
extra_c_defs:
required: false
type: string
sdk_version:
required: true
type: string
metadata_fw_type:
required: true
type: string
metadata_extra:
required: false
default: "null"
type: string

jobs:
firmware-build:
name: Build firmware
runs-on: ubuntu-latest
container:
image: ${{ inputs.image_name }}
options: --user root
defaults:
run:
shell: su --shell=/bin/bash builder {0}
steps:
- uses: actions/[email protected]
- name: Adjust permission
shell: bash
run: chown builder .
- name: Generate Firmware Project
run: |
slc generate \
--with="${{ inputs.device }},${{ inputs.components }}" \
--project-file="${{ inputs.project_file }}" \
--export-destination="$PWD/${{ inputs.firmware_name }}" \
--copy-proj-sources --copy-sdk-sources --new-project --force \
--configuration="${{ inputs.configuration }}"
- name: Patch Firmware
if: "${{ inputs.patchpath != '' }}"
run: |
cd ${{ inputs.firmware_name }}
for patch in "../${{ inputs.patchpath }}"/*.patch
do
echo "Applying ${patch}"
patch -p1 < $patch
done
- name: Patch SDK
if: "${{ inputs.sdkpatchpath != '' }}"
run: |
cd ${{ inputs.firmware_name }}/gecko_sdk_${{ inputs.sdk_version }}
for patch in "../../${{ inputs.sdkpatchpath }}"/*.patch
do
echo "Applying ${patch}"
patch -p1 < $patch
done
- name: Build Firmware
run: |
cd ${{ inputs.firmware_name }}
make -f ${{ inputs.project_name }}.Makefile release
- name: Add Firmware Metadata
run: |
cd ${{ inputs.firmware_name }}
jq --null-input \
'{
"metadata_version": 1,
"sdk_version": "${{ inputs.sdk_version }}",
"fw_type": "${{ inputs.metadata_fw_type }}",
"baudrate": ${{ inputs.baudrate }}
} + ${{ inputs.metadata_extra }}' > version.json
- name: Generate gbl Firmware
run: |
cd ${{ inputs.firmware_name }}
commander gbl create build/release/${{ inputs.project_name }}.gbl \
--app build/release/${{ inputs.project_name }}.out \
--device ${{ inputs.device }} --metadata version.json
- uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: ${{ inputs.firmware_name }}
path: ${{ inputs.firmware_name }}
4 changes: 1 addition & 3 deletions .github/workflows/silabs-firmware-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ on:
required: true
type: string
baudrate:
required: false
required: true
type: number
default: 0 # Unchanged
device:
required: true
type: string
Expand Down Expand Up @@ -74,7 +73,6 @@ jobs:
--configuration="${{ inputs.configuration }}"
- name: Set Baudrate
if: "${{ inputs.baudrate != 0 }}"
run: |
cd ${{ inputs.firmware_name }}
sed -Ei "s/^(\s*#define SL_\S+_VCOM_BAUDRATE\s+)[0-9]+/\\1${{ inputs.baudrate }}/" \
Expand Down

0 comments on commit 155bebc

Please sign in to comment.