]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
workflows/ci: add checkpatch action
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Sat, 5 Aug 2023 07:07:47 +0000 (12:37 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Mon, 7 Aug 2023 15:25:35 +0000 (09:25 -0600)
Add checkpatch action from https://github.com/webispy/checkpatch-action
to workflow CI, this project uses the Linux kernel tree's checkpatch.pl
to review the Pull Request, C code changes for the coding style issues.

We try to follow the coding standards that of the Linux Kernel, with some
exceptions recorded in the .checkpatch.conf file, asking checkpatch.pl
to ignore those. Integrating this action will make every change
complaint with Linux Kernel coding standards. As per their GitHub page
[1] the project uses GPL-2.0 license.

[1] https://github.com/webispy/checkpatch-action#license

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
TJH: Since the action requires info embedded in the Github pull request,
     only run it on pull requests.  Don't run it on pushes as it will
     produce a false positive

.github/workflows/continuous-integration.yml

index 674b900d8299d11b0d177120cad45655b68811cc..3b8dfe6abbea1559f812dc0bb8eaafeb4e9155b8 100644 (file)
@@ -46,6 +46,27 @@ jobs:
         with:
           github_token: ${{ secrets.GITHUB_TOKEN }}
 
+  checkpatch:
+    name: Checkpatch Review
+    runs-on: ubuntu-latest
+    if: github.event_name == 'pull_request'
+
+    permissions:
+      contents: read
+      pull-requests: read
+
+    steps:
+      - name: 'Calculate PR commits + 1'
+        run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> $GITHUB_ENV
+      - uses: actions/checkout@v3
+        with:
+          ref: ${{ github.event.pull_request.head.sha }}
+          fetch-depth: ${{ env.PR_FETCH_DEPTH }}
+      - name: Run checkpatch review
+        uses: webispy/checkpatch-action@v9
+        env:
+          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
+
   doxygen:
     name: Doxygen
     # Only run Doxygen against the main branch