[Openvpn-devel,1/2] Add uncrustify check to github actions

Message ID 20220506132836.1318985-1-arne@rfc2549.org
State Accepted
Headers show
Series [Openvpn-devel,1/2] Add uncrustify check to github actions | expand

Commit Message

Arne Schwabe May 6, 2022, 3:28 a.m. UTC
This adds checking if the code style is still clean github actions with the
exact version of uncrustify that is required and might also be helpful for
external commiters to get notified about code style problem when running
the Github actions on their own repository.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
 .github/workflows/build.yaml | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

Comments

Gert Doering May 6, 2022, 6:02 a.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

Nice one.  Tested on my github repo with the clean "master" tree, and
then applied a crappy change and tested again.

(https://github.com/cron2/openvpn/actions/runs/2282765938 ->
 https://github.com/cron2/openvpn/runs/6325784768?check_suite_focus)

Your patch has been applied to the master branch.

commit 8eeb4751767c5c2f6a192fc917330b2974dac9de
Author: Arne Schwabe
Date:   Fri May 6 15:28:35 2022 +0200

     Add uncrustify check to github actions

     Signed-off-by: Arne Schwabe <arne@rfc2549.org>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20220506132836.1318985-1-arne@rfc2549.org>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24300.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index ac46a72cd..dd23b1426 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -3,6 +3,35 @@  name: Build
 on: [push, pull_request]
 
 jobs:
+  checkuncrustify:
+    name: "Check code style with Uncrustify"
+    # Ubuntu 22.04 has uncrustify 0.72_f
+    runs-on: ubuntu-22.04
+    steps:
+      - name: Install dependencies
+        run: sudo apt update && sudo apt install -y uncrustify
+      - name: Checkout OpenVPN
+        uses: actions/checkout@v2
+        with:
+          path: openvpn
+      - name: Show uncrustify version
+        run: uncrustify --version
+      - name: Run uncrustify
+        run: ./dev-tools/reformat-all.sh
+        working-directory: openvpn
+      - name: Check for changes
+        run: git diff --output=uncrustify-changes.patch
+        working-directory: openvpn
+      - name: Show changes on standard output
+        run: git diff
+        working-directory: openvpn
+      - uses: actions/upload-artifact@v2
+        with:
+          name: uncrustify-changes.patch
+          path: 'openvpn/uncrustify-changes.patch'
+      - name: Set job status
+        run: test ! -s uncrustify-changes.patch
+        working-directory: openvpn
   mingw:
     strategy:
       fail-fast: false