From 061ea0de7a9768716d941e2e3472f19e075a5ce5 Mon Sep 17 00:00:00 2001 From: Tristan Partin Date: Tue, 15 Oct 2024 20:01:13 -0500 Subject: [PATCH] Add jsonnetfmt targets This should make it a little bit easier for people wanting to check if their files are formated correctly. Has the added bonus of making the CI check simpler as well. Signed-off-by: Tristan Partin --- .github/workflows/build_and_test.yml | 3 +-- compute/Makefile | 8 ++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index c9a447626f..faee1d89e1 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -136,8 +136,7 @@ jobs: - name: Check Jsonnet code formatting run: | - jsonnetfmt --test \ - $(find . -type f -name '*.jsonnet' -o -name '*.libsonnet') + make -C compute jsonnetfmt-test # Check that the vendor/postgres-* submodules point to the # corresponding REL_*_STABLE_neon branches. diff --git a/compute/Makefile b/compute/Makefile index b407fc60be..f8faa882ee 100644 --- a/compute/Makefile +++ b/compute/Makefile @@ -35,3 +35,11 @@ clean: etc/neon_collector_autoscaling.yml \ etc/sql_exporter.yml \ etc/sql_exporter_autoscaling.yml + +.PHONY: jsonnetfmt-test +jsonnetfmt-test: + jsonnetfmt --test $(jsonnet_files) + +.PHONY: jsonnetfmt-format +jsonnetfmt-format: + jsonnetfmt --in-place $(jsonnet_files)