Skip to content

Commit f7a213e

Browse files
committed
github: workflow: First version of compliance
Adding content to workflow for running compliance on PRs. Signed-off-by: Tommi Rantanen <tommi.rantanen@nordicsemi.no>
1 parent 4bd40b2 commit f7a213e

2 files changed

Lines changed: 107 additions & 1 deletion

File tree

.github/workflows/compliance.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Compliance
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
compliance_job:
8+
runs-on: ubuntu-24.04
9+
name: Run compliance checks on patch series (PR)
10+
11+
# Skip job if it was triggered by Renovate Bot
12+
if: ${{ !contains(github.actor, 'renovate') }}
13+
14+
steps:
15+
- name: Installation
16+
run: |
17+
apt-get update && apt-get install --no-install-recommends -y libmagic1 git
18+
pip install west gitlint
19+
20+
- name: Checkout the code
21+
uses: actions/checkout@v4
22+
with:
23+
path: serial_modem
24+
ref: ${{ github.event.pull_request.head.sha }}
25+
fetch-depth: 0
26+
27+
- name: Initialize
28+
working-directory: serial_modem
29+
run: |
30+
if [ ! -d "../.west" ]; then
31+
west init -l .
32+
else
33+
echo ".west folder already exists, skipping west init."
34+
fi
35+
west update -o=--depth=1 -n
36+
37+
- name: Install zephyr requirements
38+
run: |
39+
pip install -r zephyr/scripts/requirements-actions.txt
40+
# Junitparser v3 and 4 don't work with check_compliance.py
41+
pip install --upgrade junitparser==2.8.0
42+
43+
- name: Run Compliance Tests
44+
id: compliance
45+
shell: bash
46+
env:
47+
BASE_REF: ${{ github.base_ref }}
48+
working-directory: serial_modem
49+
run: |
50+
export ZEPHYR_BASE="../zephyr"
51+
$ZEPHYR_BASE/scripts/ci/check_compliance.py \
52+
-m Codeowners \
53+
-m Devicetree \
54+
-m Gitlint \
55+
-m Identity \
56+
-m Nits \
57+
-m pylint \
58+
-m checkpatch \
59+
-c origin/${BASE_REF}.. || \
60+
echo "COMPLIANCE_FAILED=true" >> $GITHUB_ENV
61+
62+
- name: Process Compliance Results
63+
working-directory: serial_modem
64+
shell: bash
65+
run: |
66+
# Check for compliance.xml existence
67+
if [[ ! -s "compliance.xml" ]]; then
68+
echo "::error::compliance.xml file is missing or empty"
69+
exit 1
70+
fi
71+
72+
# Initialize exit code
73+
exit_code=0
74+
75+
# Define error files to check
76+
error_files=(
77+
"Nits.txt"
78+
"checkpatch.txt"
79+
"Identity.txt"
80+
"Gitlint.txt"
81+
"pylint.txt"
82+
"Devicetree.txt"
83+
"Kconfig.txt"
84+
"KconfigBasic.txt"
85+
"Codeowners.txt"
86+
)
87+
88+
# Process each error file
89+
for file in "${error_files[@]}"; do
90+
if [[ -s $file ]]; then
91+
errors=$(cat $file)
92+
errors="${errors//'%'/'%25'}"
93+
errors="${errors//$'\n'/'%0A'}"
94+
errors="${errors//$'\r'/'%0D'}"
95+
echo "::error file=${file}::$errors"
96+
exit_code=1
97+
fi
98+
done
99+
100+
# Check if compliance test failed
101+
if [[ "$COMPLIANCE_FAILED" == "true" ]]; then
102+
echo "::error::Compliance tests failed. Please check the logs for details."
103+
exit_code=1
104+
fi
105+
106+
exit $exit_code

app/src/sm_at_host.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <zephyr/logging/log.h>
2222
#include <zephyr/pm/device.h>
2323
#include <zephyr/sys/ring_buffer.h>
24-
LOG_MODULE_REGISTER(sm_at_host, CONFIG_SM_LOG_LEVEL);
24+
LOG_MODULE_REGISTER(sm_at_host, CONFIG_SM_LOG_LEVEL); // liianpitkariviliianpitkariviliianpitkariviliianpitkariviliianpitkarivi
2525

2626
#define SM_SYNC_STR "Ready\r\n"
2727
#define SM_SYNC_ERR_STR "INIT ERROR\r\n"

0 commit comments

Comments
 (0)