]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Check meson.build formatting in CI
authorMichał Kępień <michal@isc.org>
Wed, 30 Jul 2025 15:37:38 +0000 (17:37 +0200)
committerMichał Kępień <michal@isc.org>
Wed, 30 Jul 2025 15:37:38 +0000 (17:37 +0200)
Add a new CI job that checks whether all meson.build files in the
repository are formatted in the exact same way as "muon fmt" would
format them.  This enforces formatting consistency across all
meson.build files in the repository and enables updating their contents
using dedicated tools, e.g. "meson rewrite".

.gitlab-ci.yml
meson.build

index 9635893d82a09ba062ada7eac3caaf59e21ff602..d58881c8240c2480daa50c90995641e0ccff849a 100644 (file)
@@ -615,6 +615,29 @@ coccinelle:
     - util/check-cocci
     - if test "$(git status --porcelain | grep -Ev '\?\?' | wc -l)" -gt "0"; then git status --short; exit 1; fi
 
+meson-format:
+  ######################################################################
+  # Revert to using the "precheck_job" anchor after the "base" image is
+  # upgraded to Debian trixie, which has muon 0.4.0.
+  <<: *default_triggering_rules
+  <<: *debian_sid_amd64_image
+  stage: precheck
+  ######################################################################
+  needs: []
+  script:
+    - git ls-files "*meson.build" | xargs muon-meson fmt -i
+    - git diff > meson-format.patch
+    - if test "$(git status --porcelain | grep -Ev '\?\?' | wc -l)" -gt "0"; then git status --short; exit 1; fi
+  artifacts:
+    paths:
+      - meson-format.patch
+    expire_in: "1 week"
+    when: on_failure
+  rules:
+    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
+      changes:
+        - "**/meson.build"
+
 doctest:
   <<: *precheck_job
   needs: []
index c4316aa05dd799b40bd3a78af31a01e85e3c04f2..c6859dec4773b36701b68e3f0172c877aed8195b 100644 (file)
@@ -1650,7 +1650,7 @@ print(release_date, end="")
 if doc_opt.allowed()
     release_date = ''
     if python.found()
-      release_date = run_command(python, ['-c', get_release_date], check: true).stdout()
+        release_date = run_command(python, ['-c', get_release_date], check: true).stdout()
     endif
 
     man_srcconf = man_srcset.apply(config, strict: false)