-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change ensures that code changes satisfy a number of criteria before being considered for submission. The compliance checks are similar to those in Zephyr. Fixes #57 Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
- Loading branch information
Showing
3 changed files
with
409 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: Compliance | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
compliance_job: | ||
runs-on: ubuntu-latest | ||
name: Run compliance checks on patch series (PR) | ||
env: | ||
ZEPHYR_BASE: ${{ github.workspace }}/zephyr | ||
ZEPHYR_TOOLCHAIN_VARIANT: zephyr | ||
ZEPHYR_SDK_INSTALL_DIR: /opt/sdk/zephyr-sdk-0.11.4 | ||
WS: ${{ github.workspace }} | ||
GB: ${{ github.workspace }}/greybus | ||
PATH: ${{ github.workspace }}/zephyr/scripts:${{ github.workspace }}/tools/net-tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||
steps: | ||
- name: Checkout the code | ||
uses: actions/checkout@v2 | ||
with: | ||
path: greybus | ||
|
||
- name: cache-pip | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-doc-pip | ||
|
||
- name: Install python dependencies | ||
run: | | ||
export PATH=$PATH:~/.local/bin | ||
pip3 install setuptools | ||
pip3 install wheel | ||
pip3 install python-magic junitparser gitlint pylint pykwalify | ||
pip3 install west | ||
- name: Setup Environment | ||
run: | | ||
export PATH=$PATH:~/.local/bin | ||
west init -l greybus | ||
west update | ||
cd ${ZEPHYR_BASE} | ||
git apply ${GB}/zephyr-sys-byteorder-posix.patch | ||
git apply ${GB}/zephyr-gpio-get-direction.patch | ||
git apply ${GB}/zephyr-dynamic-pthread-stacks.patch | ||
- name: Run Compliance Tests | ||
id: compliance | ||
env: | ||
BASE_REF: ${{ github.base_ref }} | ||
run: | | ||
export PATH=$PATH:~/.local/bin | ||
cd ${GB} | ||
git config --global user.email "you@example.com" | ||
git config --global user.name "Your Name" | ||
git rebase origin/${BASE_REF} | ||
${ZEPHYR_BASE}/scripts/ci/check_compliance.py -m Codeowners -m Devicetree -m Gitlint -m Identity -m Nits -m pylint -m checkpatch -m Kconfig -c origin/${BASE_REF}.. || true | ||
- name: upload-results | ||
uses: actions/upload-artifact@master | ||
continue-on-error: True | ||
with: | ||
name: compliance.xml | ||
path: compliance.xml | ||
|
||
- name: check-warns | ||
run: | | ||
for file in Nits.txt checkpatch.txt Identity.txt Gitlint.txt pylint.txt Devicetree.txt Kconfig.txt Codeowners.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 |
Oops, something went wrong.