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@v3 12 with: 13 ref: ${{ github.event.pull_request.head.sha }} 14 fetch-depth: 0 15 16 - name: cache-pip 17 uses: actions/cache@v3 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 update 31 sudo apt-get install coccinelle 32 33 - name: Run Coding Guildeines Checks 34 continue-on-error: true 35 id: coding_guidelines 36 env: 37 BASE_REF: ${{ github.base_ref }} 38 run: | 39 export ZEPHYR_BASE=$PWD 40 git config --global user.email "actions@zephyrproject.org" 41 git config --global user.name "Github Actions" 42 git remote -v 43 git rebase origin/${BASE_REF} 44 source zephyr-env.sh 45 # debug 46 ls -la 47 git log --pretty=oneline | head -n 10 48 ./scripts/ci/guideline_check.py --output output.txt -c origin/${BASE_REF}.. 49 50 - name: check-warns 51 run: | 52 if [[ -s "output.txt" ]]; then 53 errors=$(cat output.txt) 54 errors="${errors//'%'/'%25'}" 55 errors="${errors//$'\n'/'%0A'}" 56 errors="${errors//$'\r'/'%0D'}" 57 echo "::error file=output.txt::$errors" 58 exit 1; 59 fi 60