2021-03-24 22:54:54 +08:00
|
|
|
name: Coding Guidelines
|
|
|
|
|
|
|
|
on: pull_request
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
compliance_job:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Run coding guidelines checks on patch series (PR)
|
|
|
|
steps:
|
|
|
|
- name: Checkout the code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: cache-pip
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ~/.cache/pip
|
|
|
|
key: ${{ runner.os }}-doc-pip
|
|
|
|
|
|
|
|
- name: Install python dependencies
|
|
|
|
run: |
|
|
|
|
pip3 install unidiff
|
|
|
|
pip3 install wheel
|
|
|
|
pip3 install sh
|
|
|
|
|
|
|
|
- name: Install Packages
|
|
|
|
run: |
|
|
|
|
sudo apt-get install ocaml-base-nox
|
|
|
|
wget https://launchpad.net/~npalix/+archive/ubuntu/coccinelle/+files/coccinelle_1.0.8~20.04npalix1_amd64.deb
|
|
|
|
sudo dpkg -i coccinelle_1.0.8~20.04npalix1_amd64.deb
|
|
|
|
|
|
|
|
- name: Run Coding Guildeines Checks
|
|
|
|
continue-on-error: true
|
|
|
|
id: coding_guidelines
|
|
|
|
env:
|
|
|
|
BASE_REF: ${{ github.base_ref }}
|
|
|
|
run: |
|
|
|
|
export ZEPHYR_BASE=$PWD
|
2021-05-04 04:48:34 +08:00
|
|
|
git config --global user.email "actions@zephyrproject.org"
|
|
|
|
git config --global user.name "Github Actions"
|
|
|
|
git remote -v
|
|
|
|
git rebase origin/${BASE_REF}
|
2021-03-24 22:54:54 +08:00
|
|
|
source zephyr-env.sh
|
|
|
|
# debug
|
|
|
|
ls -la
|
|
|
|
git log --pretty=oneline | head -n 10
|
|
|
|
./scripts/ci/guideline_check.py --output output.txt -c origin/${BASE_REF}..
|
|
|
|
|
|
|
|
- name: check-warns
|
|
|
|
run: |
|
|
|
|
if [[ -s "output.txt" ]]; then
|
|
|
|
errors=$(cat output.txt)
|
|
|
|
errors="${errors//'%'/'%25'}"
|
|
|
|
errors="${errors//$'\n'/'%0A'}"
|
|
|
|
errors="${errors//$'\r'/'%0D'}"
|
|
|
|
echo "::error file=output.txt::$errors"
|
2021-05-01 10:11:54 +08:00
|
|
|
exit 1;
|
2021-03-24 22:54:54 +08:00
|
|
|
fi
|