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