From 6818e3930b1f2c35ad402866aeaa93b67991a1e0 Mon Sep 17 00:00:00 2001
From: Michel Jouvin <jouvin@lal.in2p3.fr>
Date: Tue, 19 Nov 2024 14:34:41 +0100
Subject: [PATCH] CI configuration: use same structure/scripts as in other
 repositories

- Add indent (Pan indentation checks) test to this repo
---
 .ci-scripts/indent                            |  8 +++++
 .ci-scripts/panlint                           |  8 +++++
 .github/workflows/continuous-integration.yaml | 35 +++++++++++++++++++
 .github/workflows/panlint.yaml                | 24 -------------
 4 files changed, 51 insertions(+), 24 deletions(-)
 create mode 100755 .ci-scripts/indent
 create mode 100755 .ci-scripts/panlint
 delete mode 100644 .github/workflows/panlint.yaml

diff --git a/.ci-scripts/indent b/.ci-scripts/indent
new file mode 100755
index 0000000000..6524e127b2
--- /dev/null
+++ b/.ci-scripts/indent
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+set -e # halt script on error
+
+rm -f /tmp/indent.py
+wget -q https://raw.githubusercontent.com/stfc/Pan-Indenter/master/pan_indent_checker.py -O /tmp/indent.py
+chmod u+x /tmp/indent.py
+
+git diff --name-only --diff-filter=d HEAD^ | grep '\.pan$' | xargs -rn1 /tmp/indent.py check || exit 1
diff --git a/.ci-scripts/panlint b/.ci-scripts/panlint
new file mode 100755
index 0000000000..fdb53b0593
--- /dev/null
+++ b/.ci-scripts/panlint
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+set -e # halt script on error
+
+rm -f /tmp/panlint.py
+wget -q https://raw.githubusercontent.com/quattor/pan/master/panc/src/main/scripts/panlint/panlint.py -O /tmp/panlint.py
+chmod u+x /tmp/panlint.py
+
+git diff --name-only --diff-filter=d HEAD^ | grep '\.pan$' | xargs -r /tmp/panlint.py || exit 1
diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml
index 7800d22d9f..975179fb79 100644
--- a/.github/workflows/continuous-integration.yaml
+++ b/.github/workflows/continuous-integration.yaml
@@ -29,3 +29,38 @@ jobs:
         runuser --shell /bin/bash --preserve-environment --command "source /usr/bin/mvn_test.sh && mvn_run \"dependency:resolve-plugins dependency:go-offline $MVN_ARGS\" && mvn_test" quattortest
       env:
         MVN_ARGS: -Dmaven.repo.local=/tmp/m2
+
+  panlint:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v4
+        with:
+          # we need the full repo or HEAD^ does not work
+          fetch-depth: 0
+      - name: Set up Python
+        uses: actions/setup-python@v5
+        with:
+          python-version: 3
+      - name: Install dependencies
+        run: pip install colorama prettytable six
+      - name: run panlint
+        run: .ci-scripts/panlint
+
+  indentation:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v4
+        with:
+          # we need the full repo or HEAD^ does not work
+          fetch-depth: 0
+      - name: Set up Python
+        uses: actions/setup-python@v5
+        with:
+          python-version: 3
+      - name: Install dependencies
+        run: pip install colorama
+      - name: run indent checker
+        run: .ci-scripts/indent
+
diff --git a/.github/workflows/panlint.yaml b/.github/workflows/panlint.yaml
deleted file mode 100644
index 83709f3f98..0000000000
--- a/.github/workflows/panlint.yaml
+++ /dev/null
@@ -1,24 +0,0 @@
-name: Run panlint
-on: [push, pull_request]
-
-jobs:
-  panlint:
-    runs-on: ubuntu-latest
-    steps:
-      - name: Checkout code
-        uses: actions/checkout@v4
-        with:
-          # we need the full repo or HEAD^ does not work
-          fetch-depth: 0
-      - name: Set up Python
-        uses: actions/setup-python@v5
-        with:
-          python-version: 3
-      - name: Install dependencies
-        run: pip install colorama prettytable six
-      - name: Install panlint
-        run: |
-          wget -q https://raw.githubusercontent.com/quattor/pan/master/panc/src/main/scripts/panlint/panlint.py -O /tmp/panlint.py
-          chmod u+x /tmp/panlint.py
-      - name: run panlint
-        run: git diff --name-only HEAD^ | grep '\.pan$' | xargs -r /tmp/panlint.py --allow_mvn_templates || exit 1