Skip to content

Commit 67b51fa

Browse files
committed
workflows: Add compliance workflow
Add initial compliance workflow. Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
1 parent 6faacbe commit 67b51fa

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/compliance.yml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Compliance
2+
3+
on:
4+
pull_request:
5+
types:
6+
- edited
7+
- opened
8+
- reopened
9+
- synchronize
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-22.04
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
path: zephyr-silabs
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: 3.11
24+
25+
- name: Setup Zephyr project
26+
uses: zephyrproject-rtos/action-zephyr-setup@v1
27+
with:
28+
app-path: zephyr-silabs
29+
toolchains: arm-zephyr-eabi
30+
31+
- name: Run Compliance Tests
32+
continue-on-error: true
33+
id: compliance
34+
working-directory: zephyr-silabs
35+
run: |
36+
export ZEPHYR_BASE="$(dirname "$(pwd)")/zephyr"
37+
git remote update origin
38+
$ZEPHYR_BASE/scripts/ci/check_compliance.py --annotate -e Kconfig -e KconfigBasic -c origin/${GITHUB_BASE_REF}..origin/${GITHUB_HEAD_REF}
39+
40+
- name: upload-results
41+
uses: actions/upload-artifact@v3
42+
continue-on-error: true
43+
with:
44+
name: compliance.xml
45+
path: zephyr-silabs/compliance.xml
46+
47+
- name: check-warns
48+
working-directory: zephyr-silabs
49+
run: |
50+
export ZEPHYR_BASE="$(dirname "$(pwd)")/zephyr"
51+
if [[ ! -s "compliance.xml" ]]; then
52+
exit 1;
53+
fi
54+
55+
files=($($ZEPHYR_BASE/scripts/ci/check_compliance.py -l))
56+
for file in "${files[@]}"; do
57+
f="${file}.txt"
58+
if [[ -s $f ]]; then
59+
errors=$(cat $f)
60+
errors="${errors//'%'/'%25'}"
61+
errors="${errors//$'\n'/'%0A'}"
62+
errors="${errors//$'\r'/'%0D'}"
63+
echo "::error file=${f}::$errors"
64+
exit=1
65+
fi
66+
done
67+
68+
if [ "${exit}" == "1" ]; then
69+
exit 1;
70+
fi

0 commit comments

Comments
 (0)