Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
silabs-hieuhoang committed Nov 15, 2024
2 parents e7e659c + 68ee9bd commit 76fc909
Show file tree
Hide file tree
Showing 5 changed files with 1,190 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/00-Check_Coding_Convention.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: 00-Check Coding Convention
on:
push:
branches-ignore:
- main
- "tests/**"
pull_request:
branches:
- main
- "release/**"
workflow_dispatch:
inputs:
branch:
description: 'Branch to test'
type: string
default: 'dev'
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
REPO_LINK: https://github.com/${{ github.repository }}.git
jobs:
job1:
name: Check coding convention
runs-on: ubuntu-20.04
steps:
- name: Trigger
run: echo "Triggered by ${{github.event_name}} event"
- name: Check Branch Input
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
if [ -z "${{ github.event.inputs.branch }}" ]; then
echo "Branch input is required for manual trigger."
exit 1
fi
fi
- name: Checkout
uses: actions/[email protected]
with:
ref: "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.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 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
sudo apt install python3.11-full
curl -sS https://bootstrap.pypa.io/get-pip.py | sudo python3.11
- name: Install Pre-commmit
run: |
python3.11 -m pip install pre-commit
sudo apt install uncrustify clang-tidy cppcheck
- name: Run test
run: |
pre-commit install
pre-commit run --all-files > CodingConventionTool.txt
- name: Upload Result
if: always()
uses: actions/[email protected]
with:
name: CodingConventionResult
path: CodingConventionTool.txt
retention-days: 90
- name: Check log file to set status of the job
run: |
keywords=("Failed")
for keyword in "${keywords[@]}"; do
if grep -q "$keyword" CodingConventionTool.txt; then
echo "Keyword '$keyword' found in the file."
exit 1
else
echo "Keyword '$keyword' not found in the file."
fi
done
237 changes: 237 additions & 0 deletions .github/workflows/01-Generate_Firmware.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
name: 01-Generate Firmware
on:
pull_request:
branches:
- 'main'
workflow_dispatch:
inputs:
branch:
description: 'Branch to test'
type: string
default: 'dev'
ADAPTER_SN_MG12:
description: 'Adapter serial number of MG12'
type: string
default: '440189400'
ADAPTER_SN_MG24:
description: 'Adapter serial number of MG24'
type: string
default: '440133193'

env:
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
JLINK_PATH: /opt/SEGGER/JLink/libjlinkarm.so
REPO_BRANCH: ${{ github.head_ref || github.ref_name }}
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: 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
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.branch }}" ]; then
echo "Branch input is required for manual trigger."
exit 1
else
echo "REPO_BRANCH=${{ github.event.inputs.branch }}">> $GITHUB_ENV
fi
fi
- name: Checkout
uses: actions/[email protected]
with:
ref: "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.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 is $REPO_BRANCH"
git checkout $REPO_BRANCH
# 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
export PATH=$PATH:/usr/bin/
export SDK_PATH=$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}
ninja --version
slc signature trust --sdk $SDK_PATH
slc configuration -gcc=$TOOL_DIRS
make prepare
echo "Generate MG12 image"
cd build
slc signature trust -extpath $SDK_PATH/extension/IEC60730_Libs
echo "Run Cmake"
cmake --toolchain ../cmake/toolchain.cmake .. -DENABLE_INTEGRATION_TESTING=ON -DBOARD_NAME=$BOARD_NAME_MG12
make integration_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_integration_test.sh $BOARD_NAME_MG12 $TASK $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/extension/IEC60730_Libs
echo "Run Cmake"
cmake --toolchain ../cmake/toolchain.cmake .. -DENABLE_INTEGRATION_TESTING=ON -DBOARD_NAME=$BOARD_NAME_MG24
make integration_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_integration_test.sh $BOARD_NAME_MG24 $TASK $COMPONENT $ADAPTER_SN_MG24 $COMPILER
- name: Upload firmware MG12
uses: actions/[email protected]
with:
name: firmware_mg12_gcc
path: ${{ github.workspace }}/build_MG12/test/integration_test/build/${{ env.BOARD_NAME_MG12 }}
retention-days: 90
- name: Upload firmware MG24
uses: actions/[email protected]
with:
name: firmware_mg24_gcc
path: ${{ github.workspace }}/build/test/integration_test/build/${{ env.BOARD_NAME_MG24 }}
retention-days: 90
Loading

0 comments on commit 76fc909

Please sign in to comment.