-
Notifications
You must be signed in to change notification settings - Fork 1
428 lines (422 loc) · 16.4 KB
/
02-Run_Unit_Test.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
name: 02-Run Unit Test
on:
pull_request:
branches:
- 'main'
workflow_dispatch:
inputs:
Contribute_branch:
description: 'Branch to generate firmware'
type: string
default: 'dev'
Validate_branch:
description: 'Branch to execute the test'
type: string
default: 'dev'
ADAPTER_SN_MG12:
description: 'Adapter serial number of MG12'
type: string
default: '440189400'
HOST_TP_MG12:
description: 'Host IP of MG12'
type: string
default: '192.168.1.118'
ADAPTER_SN_MG24:
description: 'Adapter serial number of MG24'
type: string
default: '440111030'
HOST_TP_MG24:
description: 'Host IP of MG24'
type: string
default: '192.168.1.69'
env:
REPO_URL: ${{ github.server_url }}/${{ github.repository }}
REPO_BRANCH_BUILD: ${{ github.head_ref || github.ref_name }}
REPO_NAME: ${{ github.event.repository.name }}
JLINK_PATH: /opt/SEGGER/JLink/libjlinkarm.so
SDK_PATH_RUN: /home/sqa/SimplicityStudio/SDKs/gecko_sdk
AM_CORRETTO_17: https://corretto.aws/downloads/latest/amazon-corretto-17-x64-linux-jdk.tar.gz
SLC_CLI_URL: https://www.silabs.com/documents/login/software/slc_cli_linux.zip
COMMANDER_URL: https://www.silabs.com/documents/login/software/SimplicityCommander-Linux.zip
GCC_URL: https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz
SIM_REPO: https://github.com/SiliconLabs/simplicity_sdk.git
GECKO_SDK_REPO: https://github.com/SiliconLabs/gecko_sdk.git
SDK_VER: v4.4.2
JLINK_SEGGER_URL: https://www.segger.com/downloads/jlink/JLink_Linux_x86_64.tgz
TASK: gen-only
REPO_BRANCH_RUN: main
BOARD_NAME_MG12: brd4161a
BOARD_NAME_MG24: brd4187c
ADAPTER_SN_MG12: ${{ github.event.inputs.ADAPTER_SN_MG12 }} #440189400
ADAPTER_SN_MG24: ${{ github.event.inputs.ADAPTER_SN_MG24 }} #440133193
HOST_IP: 192.168.1.69
TOOL_DIRS_BUILD: arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi/bin
COMPILER: GCC
TOOL_CHAINS: GCC
COMPONENT: all
CHIP_MG12: EFR32MG12
CHIP_MG24: EFR32MG24BXXXF1536
TOOL_DIRS_RUN: /home/sqa/SimplicityStudio-5/SimplicityStudio_v5/developer/toolchains/gnu_arm/12.2.rel1_2023.7/bin
START_ADDR_FLASH_M12: 0x0000000
START_ADDR_FLASH_M24: 0x8000000
jobs:
job1:
name: Generate Firmware
runs-on: ubuntu-20.04
permissions:
contents: read
pull-requests: write
steps:
- name: Trigger
run: |
echo "Triggered by ${{github.event_name}} event"
echo "Repo root directory: $GITHUB_WORKSPACE"
echo "Current directory: $PWD"
- name: Check Branch Input
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
if [ -z "${{ github.event.inputs.Contribute_branch }}" ]; then
echo "Branch input is required for manual trigger."
exit 1
else
echo "REPO_BRANCH_BUILD=${{ github.event.inputs.Contribute_branch }}">> $GITHUB_ENV
fi
fi
- name: Checkout
uses: actions/[email protected]
with:
ref: "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.Contribute_branch || github.ref }}"
- name: Log Current Branch and Commit
run: |
echo "Current branch: $(git rev-parse --abbrev-ref HEAD)"
echo "Current commit: $(git rev-parse HEAD)"
- name: Install Simplicity SDK
if: always()
run: |
mkdir simplicity_studio
cd simplicity_studio
git clone $SIM_REPO
cd simplicity_sdk
# ls -la
cd ..
# ls -la
echo "Current directory: $PWD"
ls -la
echo "List file in simplicity_sdk folfer"
ls -la "/home/runner/work/IEC60730_Libs/IEC60730_Libs/simplicity_sdk"
- name: Install Gecko SDK
if: always()
run: |
git clone $GECKO_SDK_REPO gecko_sdk_$SDK_VER
cd gecko_sdk_$SDK_VER
git checkout tags/$SDK_VER
# ls -la
mkdir extension
cd extension
git clone https://github.com/SiliconLabs/IEC60730_Libs.git
cd IEC60730_Libs
echo "Curent REPO_BRANCH_BUILD is $REPO_BRANCH_BUILD"
git checkout $REPO_BRANCH_BUILD
# ls -la
cd ..
# ls -la
cd ..
# ls -la
echo "Current directory: $PWD"
ls -la
echo "List file in simplicity_sdk folfer"
ls -la "/home/runner/work/IEC60730_Libs/IEC60730_Libs/simplicity_sdk"
- name: Install Amazon Corretto 17
if: always()
run: |
wget $AM_CORRETTO_17
tar -xzf amazon-corretto-17-x64-linux-jdk.tar.gz
# ls -la
echo "Current directory: $PWD"
ls -la
echo "List file in simplicity_sdk folfer"
ls -la "/home/runner/work/IEC60730_Libs/IEC60730_Libs/simplicity_sdk"
- name: Install SLC CLI
if: always()
run: |
wget $SLC_CLI_URL
unzip slc_cli_linux.zip
# ls -la
- name: Install Simplicity Commander
if: always()
run: |
wget $COMMANDER_URL
unzip SimplicityCommander-Linux.zip
cd SimplicityCommander-Linux
# ls -la
cd ..
mkdir commander
tar -xf SimplicityCommander-Linux/Commander_linux_x86_64_*.tar.bz commander
cd commander
# ls -la
- name: Install GCC
if: always()
run: |
wget $GCC_URL
tar -xf arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz
# ls -la
cd arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi
# ls -la
- name: Install Ninja build
run: |
sudo apt update
sudo apt -y install ninja-build
ninja --version
- name: Install python3.11
if: always()
run: |
sudo apt update
sudo apt upgrade
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt update
sudo apt install python3.11
python3.11 --version
which python3.11
cat ~/.bashrc
echo "alias python3=python3.11" >> ~/.bashrc
echo "alias python3=python3.11" >> ~/.bash_profile
cat ~/.bashrc
source ~/.bash_profile
source ~/.bashrc
python3 --version
sudo apt install python3.11-full
sudo apt install python3-pip
- name: Generate image
run: |
echo "Current directory: $PWD"
ls -la
echo "List file in simplicity_sdk folfer"
ls -la "/home/runner/work/IEC60730_Libs/IEC60730_Libs/simplicity_sdk"
export PATH=$PATH:$PWD/commander
export PATH=$PATH:$PWD/slc_cli
export TOOL_DIRS=$PWD/$TOOL_DIRS_BUILD
export PATH=$PATH:/usr/bin/
export SDK_PATH_BUILD=$PWD/gecko_sdk_$SDK_VER
export PATH=$PATH:$PWD/amazon-corretto-17.0.12.7.1-linux-x64/bin
echo $PATH
echo 2 | sudo update-alternatives --config java
java --version
slc --version
slc configuration --sdk=${SDK_PATH_BUILD}
ninja --version
slc signature trust --sdk $SDK_PATH_BUILD
slc configuration -gcc=$TOOL_DIRS_BUILD
make prepare
echo "Generate MG12 image"
cd build
slc signature trust -extpath $SDK_PATH_BUILD/extension/IEC60730_Libs
echo "Run Cmake"
cmake --toolchain ../cmake/toolchain.cmake .. -DENABLE_UNIT_TESTING=ON -DBOARD_NAME=$BOARD_NAME_MG12
make unit_test_info -j4
export HOST_IP=192.168.1.69
cd ../test/
ls -la
if [ -z "${{ github.event.inputs.ADAPTER_SN_MG12 }}" ]; then
ADAPTER_SN_MG12=440189400
fi
echo "Run bash script"
bash execute_unit_test.sh $BOARD_NAME_MG12 gen-only $COMPONENT $ADAPTER_SN_MG12 $COMPILER
echo "Generate MG24 image"
cd ${{ github.workspace }}
ls -la
mv -v build build_MG12
ls -la
rm -rf build
make prepare
cd build
slc signature trust -extpath $SDK_PATH_BUILD/extension/IEC60730_Libs
echo "Run Cmake"
cmake --toolchain ../cmake/toolchain.cmake .. -DENABLE_UNIT_TESTING=ON -DBOARD_NAME=$BOARD_NAME_MG24
make unit_test_info -j4
cd ../test/
ls -la
if [ -z "${{ github.event.inputs.ADAPTER_SN_MG24 }}" ]; then
ADAPTER_SN_MG24=440133193
fi
echo "Run bash script"
bash execute_unit_test.sh $BOARD_NAME_MG24 gen-only $COMPONENT $ADAPTER_SN_MG24 $COMPILER
- name: Upload firmware MG12
uses: actions/[email protected]
with:
name: firmware_mg12_gcc
path: ${{ github.workspace }}/build_MG12/
retention-days: 90
- name: Upload firmware MG24
uses: actions/[email protected]
with:
name: firmware_mg24_gcc
path: ${{ github.workspace }}/build/
retention-days: 90
job2:
name: Run unit test
runs-on: [self-hosted, DS_SQA_HN_01]
needs: job1
permissions:
contents: read
pull-requests: write
steps:
- name: Trigger
run: |
echo "Triggered by ${{github.event_name}} event"
echo "Repo root directory: $GITHUB_WORKSPACE"
echo "Current directory: $PWD"
rm -rf ${{ github.workspace }}
mkdir ${{ github.workspace }}
- name: Check Branch Input
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
if [ -z "${{ github.event.inputs.Validate_branch }}" ]; then
echo "Validate branch input is required for manual trigger."
exit 1
else
echo "REPO_BRANCH_RUN=${{ github.event.inputs.Validate_branch }}">> $GITHUB_ENV
fi
fi
- name: Checkout
uses: actions/[email protected]
with:
ref: "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.Validate_branch || github.ref }}"
- name: Log Current Branch and Commit
run: |
echo "Current branch: $(git rev-parse --abbrev-ref HEAD)"
echo "Current commit: $(git rev-parse HEAD)"
- name: Add extension
run: |
cd $SDK_PATH_RUN
cd extension
ls -la
rm -rd $REPO_NAME || true
git clone $REPO_URL
ls -la
cd $REPO_NAME
echo "Curent REPO_BRANCH_RUN is $REPO_BRANCH_RUN"
git checkout $REPO_BRANCH_RUN
ls -la
- name: Create build folder
run: |
make prepare
#mkdir -p ${{ github.workspace }}/build/test/unit_test/build
- name: Install jq (if needed)
run: |
jq -V
#sudo apt-get install jq -y
- name: Download output for MG12 from Job 1
run: |
export PAT="${{ secrets.SILABS_THIEUVU_PAT}}"
export REPO_OWNER="SiliconLabs"
export REPO_NAME="IEC60730_Libs"
export RUN_ID="${{ github.run_id }}"
export ARTIFACT_NAME="firmware_mg12_gcc"
ARTIFACT_URL=$(curl -s -H "Authorization: token $PAT" \
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/actions/runs/$RUN_ID/artifacts" | \
jq -r ".artifacts[] | select(.name==\"$ARTIFACT_NAME\") | .archive_download_url")
if [ -z "$ARTIFACT_URL" ]; then
echo "Artifact not found for run ID $RUN_ID."
exit 1
fi
curl -L -o firmware_mg12_gcc.zip -H "Authorization: token $PAT" "$ARTIFACT_URL"
if [ $? -eq 0 ] && [ -f "firmware_mg12_gcc.zip" ]; then
echo "Download successful"
mv firmware_mg12_gcc.zip ./build/
unzip ./build/firmware_mg12_gcc.zip -d ./build/
ls -R
else
echo "Download failed"
exit 1
fi
- name: Download output for MG24 from Job 1
run: |
export PAT="${{ secrets.SILABS_THIEUVU_PAT}}"
export REPO_OWNER="SiliconLabs"
export REPO_NAME="IEC60730_Libs"
export RUN_ID="${{ github.run_id }}"
export ARTIFACT_NAME="firmware_mg24_gcc"
ARTIFACT_URL=$(curl -s -H "Authorization: token $PAT" \
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/actions/runs/$RUN_ID/artifacts" | \
jq -r ".artifacts[] | select(.name==\"$ARTIFACT_NAME\") | .archive_download_url")
if [ -z "$ARTIFACT_URL" ]; then
echo "Artifact not found for run ID $RUN_ID."
exit 1
fi
curl -L -o firmware_mg24_gcc.zip -H "Authorization: token $PAT" "$ARTIFACT_URL"
if [ $? -eq 0 ] && [ -f "firmware_mg24_gcc.zip" ]; then
echo "Download successful"
else
echo "Download failed"
exit 1
fi
- name: Run test
run: |
export PATH=$PATH:~/SimplicityStudio-5/SimplicityStudio_v5/developer/adapter_packs/commander
export PATH=$PATH:~/slc_cli
export PATH=$PATH:/usr/bin/
export PATH=$PATH:~/amazon-corretto-17.0.12.7.1-linux-x64/bin
export LST_PATH=$PWD/build/test/integration_test/build/${BOARD_NAME}/integration_test_iec60730_watchdog/S
slc configuration --sdk=${SDK_PATH_RUN}
ninja --version
slc signature trust --sdk $SDK_PATH_RUN
slc configuration -gcc=$TOOL_DIRS_RUN
# make prepare
echo "Run unit test for MG12"
cd build
cmake --toolchain ../cmake/toolchain.cmake .. -DENABLE_UNIT_TESTING=ON -DBOARD_NAME=$BOARD_NAME_MG12
make unit_test_info -j4
slc signature trust -extpath $SDK_PATH_RUN/extension/$REPO_NAME
cd ../test
if [ -z "${{ github.event.inputs.ADAPTER_SN_MG12 }}" ]; then
ADAPTER_SN_MG12=440189400
fi
if [ -z "${{ github.event.inputs.HOST_IP_MG12 }}" ]; then
HOST_IP_MG12=192.168.1.118
fi
export HOST_IP=$HOST_IP_MG12
export FLASH_REGIONS_TEST=$START_ADDR_FLASH_M12
mkdir log_MG12
echo "bash execute_unit_test.sh $BOARD_NAME_MG12 run-only all $ADAPTER_SN_MG12 $COMPILER"
bash execute_unit_test.sh $BOARD_NAME_MG12 run-only all $ADAPTER_SN_MG12 $COMPILER 2>&1 | tee log_MG12/Unit_Test_MG12.txt
#echo 'bash execute_unit_test.sh $BOARD_NAME $TASK $COMPONENTS $ADAPTER_SN $COMPILER "-DENABLE_CAL_CRC_32=ON"' > log/Test_integration_$BOARD_NAME_GCC_2.txt
#echo 'bash execute_unit_test.sh $BOARD_NAME $TASK $COMPONENTS $ADAPTER_SN $COMPILER "-DENABLE_CRC_USE_SW=ON"' > log/Test_integration_$BOARD_NAME_GCC_3.txt
#echo 'bash execute_unit_test.sh $BOARD_NAME $TASK $COMPONENTS $ADAPTER_SN $COMPILER "-DENABLE_CRC_USE_SW=ON -DENABLE_SW_CRC_TABLE=ON"' > log/Test_integration_$BOARD_NAME_GCC_4.txt
#echo 'bash execute_unit_test.sh $BOARD_NAME $TASK $COMPONENTS $ADAPTER_SN $COMPILER "-DENABLE_CRC_USE_SW=ON -DENABLE_SW_CRC_TABLE=ON -DENABLE_CAL_CRC_32=ON"' > log/Test_integration_$BOARD_NAME_GCC_5.txt
#echo 'bash execute_unit_test.sh $BOARD_NAME $TASK $COMPONENTS $ADAPTER_SN $COMPILER "-DENABLE_CRC_USE_SW=ON -DENABLE_CAL_CRC_32=ON"' > log/Test_integration_$BOARD_NAME_GCC_5.txt
echo "Run unit test for MG24"
cd ${{ github.workspace }}
ls -la
# rm -rf build
make prepare
mv firmware_mg24_gcc.zip ./build/
unzip ./build/firmware_mg24_gcc.zip -d ./build/
ls -R
cd build
cmake --toolchain ../cmake/toolchain.cmake .. -DENABLE_UNIT_TESTING=ON -DBOARD_NAME=$BOARD_NAME_MG24
make unit_test_info -j4
slc signature trust -extpath $SDK_PATH_RUN/extension/$REPO_NAME
cd ../test
if [ -z "${{ github.event.inputs.ADAPTER_SN_MG12 }}" ]; then
ADAPTER_SN_MG12=440189400
fi
if [ -z "${{ github.event.inputs.HOST_IP_MG24 }}" ]; then
HOST_IP_MG24=192.168.1.69
fi
export HOST_IP=$HOST_IP_MG24
export FLASH_REGIONS_TEST=$START_ADDR_FLASH_M24
mkdir log_MG24
echo "bash execute_unit_test.sh $BOARD_NAME_MG24 run-only all $ADAPTER_SN_MG24 $COMPILER"
bash execute_unit_test.sh $BOARD_NAME_MG24 run-only all $ADAPTER_SN_MG24 $COMPILER 2>&1 | tee log_MG24/Unit_Test_MG24.txt
- name: Upload artifact MG12
uses: actions/[email protected]
with:
name: unit_test_log_mg12_gcc
path: ${{ github.workspace }}/test/log_MG12/
retention-days: 90
- name: Upload artifact MG24
uses: actions/[email protected]
with:
name: unit_test_log_mg24_gcc
path: ${{ github.workspace }}/test/log_MG24/
retention-days: 90