1name: Coding Guidelines 2 3on: pull_request 4 5jobs: 6 compliance_job: 7 runs-on: ubuntu-22.04 8 name: Run coding guidelines checks on patch series (PR) 9 steps: 10 - name: Checkout the code 11 uses: actions/checkout@v4 12 with: 13 ref: ${{ github.event.pull_request.head.sha }} 14 fetch-depth: 0 15 16 - name: cache-pip 17 uses: actions/cache@v4 18 with: 19 path: ~/.cache/pip 20 key: ${{ runner.os }}-pip-${{ hashFiles('.github/workflows/coding_guidelines.yml') }} 21 22 - name: Install python dependencies 23 run: | 24 pip install unidiff 25 pip install sh 26 27 - name: Install Packages 28 run: | 29 sudo apt-get update 30 sudo apt-get install coccinelle 31 32 - name: Run Coding Guildeines Checks 33 continue-on-error: true 34 id: coding_guidelines 35 env: 36 BASE_REF: ${{ github.base_ref }} 37 run: | 38 export ZEPHYR_BASE=$PWD 39 git config --global user.email "actions@zephyrproject.org" 40 git config --global user.name "Github Actions" 41 git remote -v 42 rm -fr ".git/rebase-apply" 43 rm -fr ".git/rebase-merge" 44 git rebase origin/${BASE_REF} 45 git clean -f -d 46 source zephyr-env.sh 47 # debug 48 ls -la 49 git log --pretty=oneline | head -n 10 50 ./scripts/ci/guideline_check.py --output output.txt -c origin/${BASE_REF}.. 51 52 - name: check-warns 53 run: | 54 if [[ -s "output.txt" ]]; then 55 errors=$(cat output.txt) 56 errors="${errors//'%'/'%25'}" 57 errors="${errors//$'\n'/'%0A'}" 58 errors="${errors//$'\r'/'%0D'}" 59 echo "::error file=output.txt::$errors" 60 exit 1; 61 fi 62