2021-11-14 06:53:37 +08:00
|
|
|
name: Compliance Checks
|
2020-06-08 23:58:14 +08:00
|
|
|
|
|
|
|
on: pull_request
|
|
|
|
|
|
|
|
jobs:
|
2021-09-16 19:08:49 +08:00
|
|
|
maintainer_check:
|
2022-08-23 00:27:37 +08:00
|
|
|
runs-on: ubuntu-20.04
|
2021-09-16 19:08:49 +08:00
|
|
|
name: Check MAINTAINERS file
|
|
|
|
steps:
|
|
|
|
- name: Checkout the code
|
2022-10-14 01:48:20 +08:00
|
|
|
uses: actions/checkout@v3
|
2021-09-16 19:08:49 +08:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Run Maintainers Script
|
|
|
|
id: maintainer
|
|
|
|
env:
|
|
|
|
BASE_REF: ${{ github.base_ref }}
|
|
|
|
run: |
|
|
|
|
python3 ./scripts/get_maintainer.py path CMakeLists.txt
|
|
|
|
|
2021-11-14 06:53:37 +08:00
|
|
|
check_compliance:
|
2022-08-23 00:27:37 +08:00
|
|
|
runs-on: ubuntu-20.04
|
2020-06-08 23:58:14 +08:00
|
|
|
name: Run compliance checks on patch series (PR)
|
|
|
|
steps:
|
2021-01-05 06:28:33 +08:00
|
|
|
- name: Update PATH for west
|
|
|
|
run: |
|
|
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
|
2020-06-08 23:58:14 +08:00
|
|
|
- name: Checkout the code
|
2022-10-14 01:48:20 +08:00
|
|
|
uses: actions/checkout@v3
|
2021-01-05 06:28:33 +08:00
|
|
|
with:
|
2021-01-13 11:27:48 +08:00
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
fetch-depth: 0
|
2020-06-08 23:58:14 +08:00
|
|
|
|
|
|
|
- name: cache-pip
|
2022-10-14 02:11:23 +08:00
|
|
|
uses: actions/cache@v3
|
2020-06-08 23:58:14 +08:00
|
|
|
with:
|
|
|
|
path: ~/.cache/pip
|
|
|
|
key: ${{ runner.os }}-doc-pip
|
|
|
|
|
|
|
|
- name: Install python dependencies
|
|
|
|
run: |
|
|
|
|
pip3 install setuptools
|
|
|
|
pip3 install wheel
|
2022-07-28 23:38:05 +08:00
|
|
|
pip3 install python-magic junitparser gitlint pylint pykwalify
|
2020-06-08 23:58:14 +08:00
|
|
|
pip3 install west
|
|
|
|
|
2021-01-05 06:28:33 +08:00
|
|
|
- name: west setup
|
2021-02-03 21:37:44 +08:00
|
|
|
env:
|
|
|
|
BASE_REF: ${{ github.base_ref }}
|
2021-01-05 06:28:33 +08:00
|
|
|
run: |
|
2021-02-03 21:37:44 +08:00
|
|
|
git config --global user.email "you@example.com"
|
|
|
|
git config --global user.name "Your Name"
|
|
|
|
git remote -v
|
|
|
|
git rebase origin/${BASE_REF}
|
|
|
|
# debug
|
|
|
|
git log --pretty=oneline | head -n 10
|
2021-01-05 06:28:33 +08:00
|
|
|
west init -l . || true
|
2021-11-16 21:53:30 +08:00
|
|
|
west update 2>&1 1> west.update.log || west update 2>&1 1> west.update2.log
|
2021-01-05 06:28:33 +08:00
|
|
|
|
2020-06-08 23:58:14 +08:00
|
|
|
- name: Run Compliance Tests
|
2021-01-20 21:46:47 +08:00
|
|
|
continue-on-error: true
|
2020-06-08 23:58:14 +08:00
|
|
|
id: compliance
|
|
|
|
env:
|
|
|
|
BASE_REF: ${{ github.base_ref }}
|
|
|
|
run: |
|
|
|
|
export ZEPHYR_BASE=$PWD
|
2021-01-13 11:27:48 +08:00
|
|
|
# debug
|
|
|
|
ls -la
|
|
|
|
git log --pretty=oneline | head -n 10
|
2022-11-10 23:02:09 +08:00
|
|
|
./scripts/ci/check_compliance.py --annotate -m Devicetree -m Gitlint \
|
|
|
|
-m Identity -m Nits -m pylint -m checkpatch -m Kconfig \
|
|
|
|
-c origin/${BASE_REF}..
|
2020-06-08 23:58:14 +08:00
|
|
|
|
|
|
|
- name: upload-results
|
2022-08-23 01:13:39 +08:00
|
|
|
uses: actions/upload-artifact@v3
|
2020-06-08 23:58:14 +08:00
|
|
|
continue-on-error: True
|
|
|
|
with:
|
|
|
|
name: compliance.xml
|
|
|
|
path: compliance.xml
|
|
|
|
|
|
|
|
- name: check-warns
|
|
|
|
run: |
|
2021-01-20 21:46:47 +08:00
|
|
|
if [[ ! -s "compliance.xml" ]]; then
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
2022-03-01 00:04:48 +08:00
|
|
|
for file in Nits.txt checkpatch.txt Identity.txt Gitlint.txt pylint.txt Devicetree.txt Kconfig.txt; do
|
2020-12-18 20:15:11 +08:00
|
|
|
if [[ -s $file ]]; then
|
|
|
|
errors=$(cat $file)
|
|
|
|
errors="${errors//'%'/'%25'}"
|
|
|
|
errors="${errors//$'\n'/'%0A'}"
|
|
|
|
errors="${errors//$'\r'/'%0D'}"
|
|
|
|
echo "::error file=${file}::$errors"
|
|
|
|
exit=1
|
|
|
|
fi
|
|
|
|
done
|
2020-06-08 23:58:14 +08:00
|
|
|
|
2021-12-03 17:40:55 +08:00
|
|
|
if [ "${exit}" == "1" ]; then
|
2020-06-08 23:58:14 +08:00
|
|
|
exit 1;
|
|
|
|
fi
|