forked from NabuCasa/silabs-firmware-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (145 loc) · 4.71 KB
/
silabs-firmware-build-zwave.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
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
gbl_compression:
required: true
type: string
gbl_sign_key:
required: false
type: string
gbl_enc_key:
required: false
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/checkout@v3.3.0
- 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 }}" \
--output-type="makefile" \
--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: |
if [ ! -d "${{ inputs.sdkpatchpath }}" ]; then
exit 0
fi
cd ${{ inputs.firmware_name }}/gecko_sdk_${{ inputs.sdk_version }}
for patch in "../../${{ inputs.sdkpatchpath }}"/*.patch
do
echo "Applying ${patch}"
patch -p1 < $patch
done
- name: Patch Makefile
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
cd ${{ inputs.firmware_name }}
echo "POST_BUILD_EXE = $PWD/${{ inputs.firmware_name }}/postbuild.sh"
sed -i "s/^C_DEFS\s*=.*$/C_DEFS = ${{ inputs.extra_c_defs }}/" \
"${{ inputs.project_name }}.Makefile"
sed -i 's#^POST_BUILD_EXE_LINUX = .*$#POST_BUILD_EXE_LINUX = true#' \
"${{ inputs.project_name }}.Makefile"
- 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 }}"
} + ${{ inputs.metadata_extra }}' > version.json
- name: Generate gbl Firmware
run: |
cd ${{ inputs.firmware_name }}
if [ -n "${{ inputs.gbl_sign_key }}" ] ; then
SIGN_KEY="--sign ${{ inputs.gbl_sign_key }}"
fi
if [ -n "${{ inputs.gbl_enc_key }}" ] ; then
ENC_KEY="--encrypt ${{ inputs.gbl_enc_key }}"
fi
commander gbl create build/release/${{ inputs.firmware_name }}.gbl \
--app build/release/${{ inputs.project_name }}.hex \
$SIGN_KEY $ENC_KEY \
--compress ${{ inputs.gbl_compression }}
- name: Install node within container (act)
if: ${{ env.ACT }}
shell: bash
run: |
curl -fsSL https://deb.nodesource.com/nsolid_setup_deb.sh | bash -s 20
apt-get install -y nodejs
- uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: ${{ inputs.firmware_name }}
path: ${{ inputs.firmware_name }}/build/release/${{ inputs.firmware_name }}.gbl