Skip to content

Commit e6fd3dd

Browse files
committed
Update the workflows
1 parent af80a3e commit e6fd3dd

File tree

8 files changed

+614
-87
lines changed

8 files changed

+614
-87
lines changed

.github/workflows/01-CI-Checking.yaml

Lines changed: 0 additions & 83 deletions
This file was deleted.

.github/workflows/build_firmware.yaml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: Check-Build-Firmware
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize, edited]
6+
7+
workflow_dispatch:
8+
inputs:
9+
branch:
10+
description: 'Branch to test'
11+
type: string
12+
default: 'master'
13+
14+
env:
15+
SL_SLC_PATH: ${{ github.workspace }}/tools/slc_cli/slc
16+
CI_REPO_DIR: ${{ github.workspace }}/application_examples_ci
17+
SL_STUDIO_BUILD_PATH: ${{ github.workspace }}/tools/SimplicityStudio_v5
18+
STUDIO_ADAPTER_PACK_PATH: ${{ github.workspace }}/tools/SimplicityStudio_v5/developer/adapter_packs
19+
POST_BUILD_EXE: ${{ github.workspace }}/tools/SimplicityStudio_v5/developer/adapter_packs/commander/commander
20+
WORKSPACE: ${{ github.workspace }}
21+
SKIP_TEST: false
22+
23+
jobs:
24+
build_firmware:
25+
runs-on: ubuntu-22.04
26+
steps:
27+
- name: Trigger
28+
run: echo "Triggered by ${{github.event_name}} event"
29+
- name: Check Branch Input
30+
run: |
31+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
32+
if [ -z "${{ github.event.inputs.branch }}" ]; then
33+
echo "Branch input is required for manual trigger."
34+
exit 1
35+
fi
36+
fi
37+
- name: Get repository name
38+
run: |
39+
REPO_NAME=$(echo $GITHUB_REPOSITORY | cut -d "/" -f 2)
40+
echo "repo=$REPO_NAME" >> $GITHUB_ENV
41+
- name: Create GitHub App Token
42+
id: app-token
43+
uses: actions/create-github-app-token@v1
44+
with:
45+
app-id: ${{ vars.GH_APP_ID }}
46+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
47+
owner: ${{ github.repository_owner }}
48+
- name: Checkout tools repository
49+
uses: actions/checkout@v4
50+
with:
51+
repository: SiliconLabsSoftware/aep_ci_tools
52+
ref: 'hop_dev'
53+
token: ${{ steps.app-token.outputs.token }}
54+
path: 'aep_ci_tools'
55+
- name: Checkout base repository code
56+
uses: actions/checkout@v4
57+
with:
58+
token: ${{ steps.app-token.outputs.token }}
59+
path: 'projects'
60+
- name: Checkout head ref
61+
# This is necessary to check the changes in the PR branch
62+
run: |
63+
cd projects
64+
git fetch origin ${{ github.base_ref }}:base_ref
65+
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_ref
66+
git checkout ${{ github.event.pull_request.head.sha }}
67+
- name: Check the changes
68+
run: |
69+
cd projects
70+
git diff ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} \
71+
--diff-filter=ACMR --name-only > git_diff.txt
72+
echo ===============Changed files:================
73+
cat git_diff.txt
74+
echo =============================================
75+
git diff ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} \
76+
--diff-filter=ACMR --name-only | grep '/' | cut -d'/' -f1 | sort | uniq > git_log.txt
77+
if [ -s git_log.txt ]; then
78+
grep -v "deprecated" git_log.txt > changed_projects_folder.txt
79+
fi
80+
if [ ! -f changed_projects_folder.txt ] || [ ! -s changed_projects_folder.txt ]; then
81+
echo =============================================
82+
echo "No project changes detected...........Skipped"
83+
echo =============================================
84+
echo "SKIP_TEST=true" >> $GITHUB_ENV
85+
exit 0
86+
fi
87+
echo ================Changed projects:=============
88+
cat changed_projects_folder.txt
89+
echo ==============================================
90+
- name: Setup Java
91+
if: ${{ env.SKIP_TEST == 'false' }}
92+
uses: actions/setup-java@v4
93+
with:
94+
distribution: 'oracle'
95+
java-version: '21'
96+
- name: Install Dependencies
97+
if: ${{ env.SKIP_TEST == 'false' }}
98+
run: bash ${{ github.workspace }}/aep_ci_tools/scripts/install_tools.sh
99+
- name: Run build the projects
100+
if: ${{ env.SKIP_TEST == 'false' }}
101+
run : |
102+
mkdir changed_projects
103+
while read line; do cp -r ./projects/$line --parents ./changed_projects; \
104+
done < ${{ github.workspace}}/projects/changed_projects_folder.txt
105+
python3 -u ${{ github.workspace}}/aep_ci_tools/scripts/checkproject.py --junit \
106+
--html --release --slcpgcc ${{ github.workspace}}/changed_projects
107+
- name: Upload Result
108+
if: ${{ env.SKIP_TEST == 'false' }}
109+
uses: actions/upload-artifact@v4
110+
with:
111+
name: build_test_project
112+
path: build_test_project.html
113+
retention-days: 90
114+
- name: Check log file to set status of the job
115+
if: ${{ env.SKIP_TEST == 'false' }}
116+
run: |
117+
if grep -qe "Fail" build_test_project.html; then
118+
echo =======================================
119+
echo "Result: Failure"
120+
echo "Check report at the step: Upload Result"
121+
echo =======================================
122+
exit 1
123+
else
124+
echo "Result: Success"
125+
fi

.github/workflows/03-CLA-Assistant.yml renamed to .github/workflows/cla_assistant.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 03-CLA-Assistant
1+
name: CLA-Assistant
22
## This workflow is used for public repositories
33

44
on:
@@ -14,7 +14,7 @@ permissions:
1414
statuses: write
1515

1616
jobs:
17-
CLAAssistant:
17+
cla_assistant:
1818
if: github.repository_visibility == 'public'
1919
runs-on: ubuntu-24.04
2020
steps:
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Check-Code-Convention
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize, edited]
6+
7+
workflow_dispatch:
8+
inputs:
9+
branch:
10+
description: 'Branch to test'
11+
type: string
12+
default: 'master'
13+
14+
env:
15+
SKIP_TEST: false
16+
17+
jobs:
18+
coding_convention:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Trigger
22+
run: echo "Triggered by ${{github.event_name}} event"
23+
- name: Check Branch Input
24+
run: |
25+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
26+
if [ -z "${{ github.event.inputs.branch }}" ]; then
27+
echo "Branch input is required for manual trigger."
28+
exit 1
29+
fi
30+
fi
31+
- name: Create GitHub App Token
32+
id: app-token
33+
uses: actions/create-github-app-token@v1
34+
with:
35+
app-id: ${{ vars.GH_APP_ID }}
36+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
37+
owner: ${{ github.repository_owner }}
38+
- name: Checkout tools repository
39+
uses: actions/checkout@v4
40+
with:
41+
repository: SiliconLabsSoftware/aep_ci_tools
42+
ref: 'hop_dev'
43+
token: ${{ steps.app-token.outputs.token }}
44+
path: 'aep_ci_tools'
45+
- name: Checkout base repository code
46+
uses: actions/checkout@v4
47+
with:
48+
token: ${{ steps.app-token.outputs.token }}
49+
path: 'projects'
50+
- name: Checkout head ref
51+
# This is necessary to check the changes in the PR branch
52+
run: |
53+
cd projects
54+
git fetch origin ${{ github.base_ref }}:base_ref
55+
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_ref
56+
git checkout ${{ github.event.pull_request.head.sha }}
57+
- name: Check the changes
58+
run: |
59+
cd projects
60+
git diff ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} \
61+
--diff-filter=ACMR --name-only > git_diff.txt
62+
echo ===============Changed files:================
63+
cat git_diff.txt
64+
echo =============================================
65+
git diff ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} \
66+
--diff-filter=ACMR --name-only | grep '/' | cut -d'/' -f1 | sort | uniq > git_log.txt
67+
if [ -s git_log.txt ]; then
68+
grep -v "deprecated" git_log.txt > changed_projects_folder.txt
69+
fi
70+
if [ ! -f changed_projects_folder.txt ] || [ ! -s changed_projects_folder.txt ]; then
71+
echo =============================================
72+
echo "No project changes detected...........Skipped"
73+
echo =============================================
74+
echo "SKIP_TEST=true" >> $GITHUB_ENV
75+
exit 0
76+
fi
77+
echo ================Changed projects:=============
78+
cat changed_projects_folder.txt
79+
echo ==============================================
80+
- name: Run test
81+
if: ${{ env.SKIP_TEST == 'false' }}
82+
run : |
83+
cd projects
84+
xargs -I{} -a changed_projects_folder.txt find {} -type f -name "*.[ch]" > source_list.txt
85+
bash ${{ github.workspace }}/aep_ci_tools/scripts/check_coding_style.sh source_list.txt > coding_style_report.html
86+
- name: Upload Result
87+
if: ${{ env.SKIP_TEST == 'false' }}
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: coding_style_report
91+
path: projects/coding_style_report.html
92+
retention-days: 90
93+
- name: Browse the formatted files by Uncrustify
94+
if: ${{ env.SKIP_TEST == 'false' }}
95+
uses: actions/upload-artifact@v4
96+
with:
97+
name: uncrustify_formatted_files
98+
path: projects/uncrustify_formatted_files.zip
99+
if-no-files-found: ignore
100+
- name: Check log file to set status of the job
101+
if: ${{ env.SKIP_TEST == 'false' }}
102+
run: |
103+
cd projects
104+
if grep -qe "failed" coding_style_report.html; then
105+
echo ===================================================================
106+
echo "Result: Failure"
107+
echo "Check report at the step: Upload Result"
108+
echo "Check Solution at the step: Browse the formatted files by Uncrustify"
109+
echo ====================================================================
110+
exit 1
111+
else
112+
echo "Result: Success"
113+
fi

0 commit comments

Comments
 (0)