Skip to content

Commit c9ec48e

Browse files
Initial commit
0 parents  commit c9ec48e

18 files changed

+582
-0
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This is a # Default codeowners for the repository
2+
*

.github/CONTRIBUTING.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Contributing Guideline - Internal Repository
2+
3+
## Branch Naming Convention
4+
5+
Refer to the Developer Services Branching Policy and Git User [Guide](https://confluence.silabs.com/pages/viewpage.action?pageId=315870645).
6+
7+
Use lowercase letters and hyphens (`-`) as delimiters.
8+
Google search treats a hyphen as a word separator, which helps improve the visibility of public repositories.
9+
We should structure our internal repository as if it were a public one.
10+
11+
Branch name should be short and clear. If possible it can be the JIRA ticket name.
12+
Also it is recommended to include the JIRA ticket number.
13+
Example:
14+
```
15+
IOT_DS-123-update-sdk-version
16+
```
17+
18+
## Commit Message Format
19+
20+
We use [smart commits](https://support.atlassian.com/bitbucket-cloud/docs/use-smart-commits/) to sync GitHub commits with our JIRA server.
21+
This requires the JIRA ticket number in the commit message.
22+
The first line is the commit message, and the next lines provide the description.
23+
The commit message should be short and clear, and it must contain the JIRA ticket number.
24+
You can add more details in the description.
25+
26+
**Command Line:**
27+
```
28+
git commit -m "IOT_DS-1234 initial version of SDK 4.4.3 is committed" -m "Not final version. Several compiler warnings need to be addressed."
29+
```
30+
31+
**VS Code:**
32+
The first line is the commit message, and the next lines are the commit description.
33+
34+
## Pull Request Guideline
35+
36+
Refer to the general pull request [guideline](https://opensource.guide/how-to-contribute/#opening-a-pull-request) from GitHub.
37+
38+
### As a Developer
39+
40+
What to consider when raising a Pull Request:
41+
42+
1. **Pull Request Naming**
43+
By default, GitHub uses the branch name as the pull request title. If the branch naming guideline was followed, no changes are needed here.
44+
45+
2. **Check the Reviewer List**
46+
GitHub assigns reviewers based on the [CODEOWNERS](CODEOWNERS) file.
47+
Add more reviewers if needed. Do not remove reviewers from the PR. Ask the repository owner for updates to the code owners.
48+
49+
3. **Evaluate the Action Workflow Results**
50+
The following workflows are included in every repository:
51+
- **[Coding Convention Check](workflows/00-Check-Code-Convention.yml)**: Analyzes the code formatting and fails if any rules are broken.
52+
- **[Firmware Build](workflows/02-Build-Firmware.yml)**: Builds the firmware inside the [Dockerfile](../Dockerfile).
53+
- **[Secret Scanner](workflows/04-TruffleHog-Security-Scan.yml)**: Runs the TruffleHog security scanner to look for API keys and committed secrets.
54+
- **[SonarQube Analysis](workflows/zz-sonarqube-analysis.yml)**: Runs SonarQube analysis on the project. Refer to the related [Confluence page](https://confluence.silabs.com/display/IoTApps/SQA+-+SonarQube+howTo).
55+
56+
### As a Reviewer
57+
58+
What to consider when reviewing a Pull Request:
59+
60+
- All builds must pass successfully.
61+
- The code must follow the Silicon Labs [coding guidelines](https://github.com/SiliconLabsSoftware/agreements-and-guidelines/blob/main/coding_standard.md).
62+
- Write clear comments. Describe the issue and explain why you disagree (e.g., mistakes, errors, violations of conventions, performance risks, security issues, etc.).
63+
- If any comments must be addressed mandatorily, mark the pull request as “Draft.”

.github/coding-convention-tool

Submodule coding-convention-tool added at bb792db

.github/sonar-project.properties

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
sonar.host.url=http://sonarqube.silabs.net/
2+
# TODO
3+
# must be unique in a given SonarQube instance
4+
# update this value based on the project name
5+
#sonar.projectKey=devs_cs_automapping
6+
7+
#TODO
8+
#update this value based on make target names
9+
#example:
10+
#sonar.cfamily.variants.names=ncp,tag
11+
12+
sonar.cfamily.variants.dir = sonar-bw
13+
14+
# we don't care which version, SQ is just too dumb to ignore python language when it sees (even if we try excluding it in sonar.exclusions)
15+
sonar.python.version=3.9
16+
17+
# Path is relative to the sonar-project.properties file. Defaults to .
18+
sonar.sources= .
19+
20+
# Branch name for the analysis
21+
sonar.branch.name=${branch_name}
22+
#Exclusion list shall be updated as per the project requirement
23+
24+
#TODO create exclusion list
25+
#Example list:
26+
#sonar.exclusions= \
27+
# docs/**/*, \
28+
# cicd/**/*, \
29+
# **/*simplicity*/**/*, \
30+
# projects/*/config/**/*, \
31+
# projects/*/autogen/**/*, \
32+
33+
# sonar.cpd.exclusions =
34+
sonar.coverage.exclusions = **
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: 00-Check-Code-Convention
2+
on:
3+
push:
4+
branches-ignore:
5+
- main
6+
- "tests/**"
7+
pull_request:
8+
branches:
9+
- main
10+
- develop
11+
- "release/**"
12+
workflow_dispatch:
13+
inputs:
14+
branch:
15+
description: 'Branch to test'
16+
type: string
17+
default: 'dev'
18+
19+
jobs:
20+
job1:
21+
name: Check coding convention
22+
runs-on: ubuntu-22.04 #uncrustify 0.64 can not be compiled on ubuntu-24.04
23+
steps:
24+
- name: Trigger
25+
run: echo "Triggered by ${{github.event_name}} event"
26+
- name: Check Branch Input
27+
run: |
28+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
29+
if [ -z "${{ github.event.inputs.branch }}" ]; then
30+
echo "Branch input is required for manual trigger."
31+
exit 1
32+
fi
33+
fi
34+
- name: Checkout
35+
uses: actions/[email protected]
36+
with:
37+
ref: "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.ref }}"
38+
submodules: true
39+
fetch-depth: 0
40+
## an internal repo as a submodule is present therefore PAT is needed
41+
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
42+
43+
- name: Log Current Branch and Commit
44+
run: |
45+
echo "Current branch: $(git rev-parse --abbrev-ref HEAD)"
46+
echo "Current commit: $(git rev-parse HEAD)"
47+
- name: Install commit check tools
48+
run: |
49+
echo "Installing pre-commit ..."
50+
python3 -m pip install pre-commit
51+
echo "Installing uncrustify 0.64 from source code ..."
52+
sudo apt-get install --no-install-recommends -y\
53+
binutils ca-certificates git cmake make \
54+
gcc g++ binutils libc6-dev
55+
echo "Cloning Uncrustify repository..."
56+
git clone -b uncrustify-0.64 --single-branch https://github.com/uncrustify/uncrustify.git
57+
echo "Building and installing Uncrustify..."
58+
mkdir ./uncrustify/build && cd ./uncrustify/build
59+
cmake -D CMAKE_INSTALL_PREFIX=/usr/local -D CMAKE_BUILD_TYPE=RelWithDebInfo ../
60+
sudo make -j "$(nproc)"
61+
sudo make install
62+
echo "Uncrustify has been installed successfully!"
63+
cd ../../
64+
sudo cp ./.github/coding-convention-tool/tools/uncrustify.cfg ./uncrustify/uncrustify.cfg
65+
echo "Install clang-tidy and cppcheck ..."
66+
sudo apt-get install clang-tidy cppcheck
67+
- name: Run test
68+
run: |
69+
pre-commit install
70+
pre-commit run --all-files 2>&1 | tee CodingConventionTool.txt
71+
72+
- name: Upload Result
73+
if: always()
74+
uses: actions/[email protected]
75+
with:
76+
name: CodingConventionResult
77+
path: CodingConventionTool.txt
78+
retention-days: 90
79+
- name: Check log file to set status of the job
80+
run: |
81+
keywords=("Failed")
82+
for keyword in "${keywords[@]}"; do
83+
if grep -q "$keyword" CodingConventionTool.txt; then
84+
echo "Keyword '$keyword' found in the file."
85+
exit 1
86+
else
87+
echo "Keyword '$keyword' not found in the file."
88+
fi
89+
done
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: 01-CLA-Assistant
2+
## This workflow is used only for public repositories
3+
## uncomment the other trigger conditions for public repositories
4+
5+
on:
6+
workflow_dispatch:
7+
# issue_comment:
8+
# types: [created]
9+
# pull_request_target:
10+
# types: [opened,closed,synchronize,reopened]
11+
12+
# explicitly configure permissions, in case your GITHUB_TOKEN workflow permissions are set to read-only in repository settings
13+
permissions:
14+
actions: write
15+
contents: read # this can be 'read' if the signatures are in remote repository
16+
pull-requests: write
17+
statuses: write
18+
19+
jobs:
20+
CLAAssistant:
21+
runs-on: ubuntu-24.04
22+
steps:
23+
- name: "CLA Assistant"
24+
if: ${{ contains(github.event.comment.body, 'I have read the CLA Document and I hereby sign the CLA') }} || github.event_name == 'pull_request_target'
25+
uses: SiliconLabsWorkflows/cla-assistant@silabs_flavour_v2
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
# the below token should have repo scope and must be manually added by you in the repository's secret
29+
# This token is required only if you have configured to store the signatures in a remote repository/organization
30+
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
31+
with:
32+
path-to-signatures: "cla_signatures_db.json"
33+
path-to-document: "https://github.com/SiliconLabsSoftware/bluetooth-AoA-example/blob/main/cla.md"
34+
# branch should not be protected
35+
branch: 'cla-database'
36+
allowlist: silabs-*,bot*
37+
# the following are the optional inputs - If the optional inputs are not given, then default values will be taken
38+
remote-organization-name: "SiliconLabsInternal"
39+
remote-repository-name: "contributor-license-agreements"
40+
create-file-commit-message: "Created the CLA database file. CLA Assistant Lite bot created this file."
41+
signed-commit-message: "$contributorName has signed the CLA in $owner/$repo#$pullRequestNo"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: 02-Build-Firmware
2+
## By default this workflow runs on Github hosted runners. This is not free for internal and private repositories
3+
## It is recommended to run this job on a self-hosted runner for non public repository
4+
## Uncomment the needed runs-on command.
5+
on:
6+
pull_request:
7+
branches:
8+
- main
9+
workflow_dispatch:
10+
inputs:
11+
branch:
12+
description: 'Branches to run the workflow on'
13+
required: true
14+
default: 'main'
15+
16+
jobs:
17+
FW_build:
18+
# Choose a runner type here by commenting out the not needed one.
19+
runs-on: ubuntu-24.04
20+
#runs-on: devs-self-hosted-runner
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
ref: ${{ github.event.inputs.branch }}
27+
28+
- name: Build Docker Image
29+
run: docker build -t ${{ github.repository }}-build-env:latest Dockerfile
30+
31+
- name: Run Docker Container
32+
run: docker run --rm -v ${{ github.workspace }}:/workspace ${{ github.repository }}-build-env:latest /bin/bash -c "cd /workspace && make all"
33+
34+
- name: Remove Docker image
35+
run: docker image
36+
37+
- name: Remove Docker Image
38+
if: always()
39+
run: docker rmi ${{ github.repository }}-build-env:latest
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: 04-TruffleHog-Security-Scan
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
- develop
7+
workflow_dispatch:
8+
jobs:
9+
trufflehog_scan:
10+
runs-on: ubuntu-24.04
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- name: Secret Scanning
17+
uses: trufflesecurity/[email protected]
18+
with:
19+
extra_args: --only-verified
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: SonarQube-Analysis
2+
3+
on:
4+
#It is an internal tool, it can only ran a self hosted runner. Currently it can be triggered only manually.
5+
workflow_dispatch:
6+
inputs:
7+
branch:
8+
description: 'Branches to run the workflow on'
9+
required: true
10+
default: 'main'
11+
jobs:
12+
sonarqube:
13+
##TODO create a selfhosted runner by this name.
14+
runs-on: devs-self-hosted-runner
15+
env:
16+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
17+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
ref: ${{ github.event.inputs.branch }}
24+
- name: Build Docker Image
25+
run: docker build -t ${{ github.repository }}-build-env:latest Dockerfile
26+
- name: Run SonarQube analysis
27+
run: |
28+
docker run -u root --rm -v $(pwd):/home/${{ github.repository }}/ -w /home/${{ github.repository }}/ ${{ github.repository }}-build-env:latest /bin/sh -c "
29+
make all &&
30+
rm -rf sonar-bw &&
31+
rm -rf .scannerwork &&
32+
rm -rf locator_ncp/build &&
33+
rm -rf locator_host/build
34+
mkdir sonar-bw &&
35+
/opt/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir sonar-bw/ make all &&
36+
sonar-scanner -Dsonar.token=$SONAR_TOKEN -Dsonar.host.url=$SONAR_HOST_URL"
37+
- name: Cleanup leftover files
38+
if: always()
39+
run: |
40+
docker run -u root --rm -v $(pwd):/home/${{ github.repository }}/ -w /home/${{ github.repository }}/ ${{ github.repository }}-build-env:latest /bin/sh -c "
41+
rm -rf sonar-bw && \
42+
rm -rf .scannerwork && \
43+
rm -rf locator_ncp/build && \
44+
rm -rf locator_host/build "

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# General part of the gitignore
2+
*.launch
3+
*.orig
4+
*.bak
5+
.vscode/
6+
**/build/
7+
**/GNU ARM v*
8+
**/.projectlinkstore
9+
**/.settings
10+
**/.makefile
11+
**/.trash
12+
**/.uceditor
13+
**/autogen/*.crc
14+
**/__pycache__
15+
**/GNU ARM v*
16+
**/IAR ARM*
17+
**/sonar-bw/
18+
19+
##Enable these if you are not tracking Simplicity studio project
20+
# **/.cproject
21+
# **/.project
22+
# **/.pdm
23+
24+
## Documentation related ignores.
25+
## Modify them if it is necessary
26+
*.docx
27+
*.doc
28+
*.ppt
29+
*.pdf
30+
*.xlsx
31+
*.xls
32+
*.html
33+
34+
35+
36+
#code convention tool gitignore
37+
code-convention-tool/
38+
**/venv/

0 commit comments

Comments
 (0)