Minor fixes to be in sync with Zephyr upstream latest and greatest #156
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2021-2023 TiaC Systems | |
# SPDX-License-Identifier: Apache-2.0 | |
name: QA Compliance Check | |
on: | |
workflow_dispatch: # And manually on button click | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
qa-compliance: | |
name: Run compliance checks on patch series (PR) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Update GitHub PATH for west | |
run: | | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
with: | |
path: workspace/bridle | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Restore PIP Cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-doc-pip | |
- name: Install base dependencies | |
working-directory: workspace | |
run: | | |
pip3 install --upgrade pip | |
pip3 install --upgrade setuptools | |
pip3 install --upgrade --requirement bridle/scripts/requirements-base.txt | |
pip3 show -f west | |
- name: West init and update | |
working-directory: workspace | |
env: | |
BASE_REF: ${{ github.base_ref }} | |
run: | | |
git -C bridle config --global user.email "[email protected]" | |
git -C bridle config --global user.name "Your Name" | |
git -C bridle remote -v | |
# Ensure there's no merge commits in the PR | |
[[ "$(git -C bridle rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ | |
(echo "::error ::Merge commits not allowed, rebase instead";false) | |
git -C bridle rebase origin/${BASE_REF} | |
# debug | |
git -C bridle log --pretty=oneline | head -n 10 | |
west init -l bridle || true | |
west update | |
west zephyr-export | |
- name: Install compliance dependencies | |
working-directory: workspace | |
run: | | |
grep -hE -v "python-magic-bin" zephyr/scripts/requirements-*.txt | \ | |
grep -hE "python-magic|lxml|junitparser|gitlint|pylint|pykwalify|yamllint" | \ | |
xargs -I {} pip3 install --upgrade '{}' | |
- name: Run compliance tests | |
id: compliance | |
working-directory: workspace/bridle | |
env: | |
BASE_REF: ${{ github.base_ref }} | |
run: | | |
export BRIDLE_BASE="$(pwd)" | |
export ZEPHYR_BASE="$(dirname "$(pwd)")/zephyr" | |
# debug | |
ls -la | |
git log --pretty=oneline | head -n 10 | |
# -m Checkpatch \ | |
${BRIDLE_BASE}/scripts/ci/check_compliance.py \ | |
--annotate \ | |
-m Codeowners \ | |
-m MaintainersFormat \ | |
-m Gitlint \ | |
-m YAMLLint \ | |
-m Devicetree \ | |
-m KconfigBasic \ | |
-m Pylint \ | |
-m Identity \ | |
-m Nits \ | |
-m ImageSize \ | |
-m BinaryFiles \ | |
-c origin/${BASE_REF}.. | |
- name: Upload compliance tests results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: compliance.xml | |
path: workspace/bridle/compliance.xml | |
- name: Check warnings | |
working-directory: workspace/bridle | |
run: | | |
if [[ ! -s "compliance.xml" ]]; then | |
exit 1; | |
fi | |
# Checkpatch.txt \ | |
for file in \ | |
Codeowners.txt \ | |
MaintainersFormat.txt \ | |
Gitlint.txt \ | |
YAMLLint.txt \ | |
Devicetree.txt \ | |
KconfigBasic.txt \ | |
Pylint.txt \ | |
Identity.txt \ | |
Nits.txt \ | |
ImageSize.txt \ | |
BinaryFiles.txt \ | |
; do | |
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 | |
if [[ $exit == 1 ]]; then | |
exit 1 | |
fi |