Skip to content

Commit b896b84

Browse files
committed
ci: add coding guideline workflow
Signed-off-by: Anas Nashif <[email protected]>
1 parent d79b461 commit b896b84

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Coding Guidelines
2+
3+
on: pull_request
4+
5+
jobs:
6+
compliance_job:
7+
runs-on: ubuntu-latest
8+
name: Run coding guidelines checks on patch series (PR)
9+
steps:
10+
- name: Checkout the code
11+
uses: actions/checkout@v2
12+
with:
13+
ref: ${{ github.event.pull_request.head.sha }}
14+
fetch-depth: 0
15+
16+
- name: cache-pip
17+
uses: actions/cache@v1
18+
with:
19+
path: ~/.cache/pip
20+
key: ${{ runner.os }}-doc-pip
21+
22+
- name: Install python dependencies
23+
run: |
24+
pip3 install unidiff
25+
pip3 install wheel
26+
pip3 install sh
27+
28+
- name: Install Packages
29+
run: |
30+
sudo apt-get install ocaml-base-nox
31+
wget https://launchpad.net/~npalix/+archive/ubuntu/coccinelle/+files/coccinelle_1.0.8~20.04npalix1_amd64.deb
32+
sudo dpkg -i coccinelle_1.0.8~20.04npalix1_amd64.deb
33+
34+
- name: Run Coding Guildeines Checks
35+
continue-on-error: true
36+
id: coding_guidelines
37+
env:
38+
BASE_REF: ${{ github.base_ref }}
39+
run: |
40+
export ZEPHYR_BASE=$PWD
41+
source zephyr-env.sh
42+
# debug
43+
ls -la
44+
git log --pretty=oneline | head -n 10
45+
./scripts/ci/guideline_check.py --output output.txt -c origin/${BASE_REF}..
46+
47+
- name: check-warns
48+
run: |
49+
if [[ -s "output.txt" ]]; then
50+
errors=$(cat output.txt)
51+
errors="${errors//'%'/'%25'}"
52+
errors="${errors//$'\n'/'%0A'}"
53+
errors="${errors//$'\r'/'%0D'}"
54+
echo "::error file=output.txt::$errors"
55+
exit=1
56+
fi
57+
if [ ${exit} == 1 ]; then
58+
exit 1;
59+
fi

0 commit comments

Comments
 (0)