]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
build, CI: Add a GitHub Action to run the checkpatch.pl script
authorMartin Belanger <martin.belanger@dell.com>
Thu, 2 Nov 2023 14:00:56 +0000 (10:00 -0400)
committerDaniel Wagner <wagi@monom.org>
Thu, 2 Nov 2023 14:05:52 +0000 (15:05 +0100)
Adding new workflow to run the checkpatch.pl script from the Linux kernel.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
.checkpatch.conf [new file with mode: 0644]
.github/workflows/checkpatch.yml [new file with mode: 0644]

diff --git a/.checkpatch.conf b/.checkpatch.conf
new file mode 100644 (file)
index 0000000..5541a56
--- /dev/null
@@ -0,0 +1,24 @@
+# Checkpatch options.
+# REF: https://docs.kernel.org/dev-tools/checkpatch.html
+
+# This isn't actually a Linux kernel tree
+--no-tree
+
+--max-line-length=120
+
+--ignore EMAIL_SUBJECT
+
+# FILE_PATH_CHANGES reports this kind of message:
+# "added, moved or deleted file(s), does MAINTAINERS need updating?"
+--ignore FILE_PATH_CHANGES
+
+
+# Commit messages might contain a Gerrit Change-Id.
+--ignore GERRIT_CHANGE_ID
+
+# Do not check the format of commit messages, as Gerrit's merge commits do not
+# preserve it.
+--ignore GIT_COMMIT_ID
+
+# Avoid "Does not appear to be a unified-diff format patch" message
+--ignore NOT_UNIFIED_DIFF
diff --git a/.github/workflows/checkpatch.yml b/.github/workflows/checkpatch.yml
new file mode 100644 (file)
index 0000000..8cf5e49
--- /dev/null
@@ -0,0 +1,15 @@
+name: checkpatch review
+on: [pull_request]
+jobs:
+  checkpatch:
+    name: checkpatch review
+    runs-on: ubuntu-latest
+    steps:
+    - name: 'Calculate PR commits + 1'
+      run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> $GITHUB_ENV
+    - uses: actions/checkout@v4
+      with:
+        ref: ${{ github.event.pull_request.head.sha }}
+        fetch-depth: ${{ env.PR_FETCH_DEPTH }}
+    - name: Run checkpatch review
+      uses: webispy/checkpatch-action@v9