From 7baa878610910bc27f37a2588964908c540b0fdb Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Mon, 8 Mar 2021 19:55:49 +0000 Subject: [PATCH] .github/check patch: do not stop on the first failure Add new script to reduce duplication and ease local testing. Signed-off-by: Marc Herbert --- .github/workflows/checkpatch_list.sh | 22 ++++++++++++++++++++++ .github/workflows/shallow_checkpatch.yml | 15 +++++---------- 2 files changed, 27 insertions(+), 10 deletions(-) create mode 100755 .github/workflows/checkpatch_list.sh diff --git a/.github/workflows/checkpatch_list.sh b/.github/workflows/checkpatch_list.sh new file mode 100755 index 000000000..92544f3fb --- /dev/null +++ b/.github/workflows/checkpatch_list.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# SPDX-License-Identifier: BSD-3-Clause + +set -e + +# The purpose of this script is not to stop on the first checkpatch +# failure and report at the end instead. +# +# Sample invocation: +# $0 --codespell --strict < PR_SHAs.txt +main() +{ + local failures=0 + while read -r sha ; do + printf '\n -------------- \n\n' + ./scripts/checkpatch.pl $@ -g $sha || failures=$((failures+1)) + done + printf '\n -------------- \n\n' + return $failures +} + +main "$@" diff --git a/.github/workflows/shallow_checkpatch.yml b/.github/workflows/shallow_checkpatch.yml index 9cf424f8c..93ca7206a 100644 --- a/.github/workflows/shallow_checkpatch.yml +++ b/.github/workflows/shallow_checkpatch.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-20.04 env: PR_NUM: ${{github.event.number}} - CHK_CMD: ./scripts/checkpatch.pl --codespell --codespellfile + CHK_CMD_OPTS: --codespell --codespellfile /usr/lib/python3/dist-packages/codespell_lib/data/dictionary.txt steps: # depth 2 so: @@ -42,14 +42,9 @@ jobs: # show what we got git --no-pager log --oneline --graph --decorate --max-count=50 - - name: checkpatch - run: while read -r sha ; do - printf '\n -------------- \n\n'; - ${CHK_CMD} -g $sha; - done < PR_SHAs.txt + - name: normal checkpatch + run: .github/workflows/checkpatch_list.sh ${CHK_CMD_OPTS} < PR_SHAs.txt - name: checkpatch --strict - run: while read -r sha ; do - printf '\n -------------- \n\n'; - ${CHK_CMD} --strict -g $sha; - done < PR_SHAs.txt + run: .github/workflows/checkpatch_list.sh ${CHK_CMD_OPTS} + --strict < PR_SHAs.txt