From 81a4b857e464d6fd07957a1adf315b9747228db5 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 4 Nov 2026 23:48:22 +0100 Subject: [PATCH v2 3/3] Add advisory pgindent check to CompilerWarnings CI job Run pgindent --check --diff over the whole tree at the end of the CompilerWarnings job, reusing the configured tree left behind by the headerscheck step to build pg_bsd_indent. Also run a git whitespace check. These checks are advisory only: Violations produce a warning annotation but do not fail the workflow. Discussion: https://www.postgresql.org/message-id/flat/DDNZTVO6E6GF.17IEQGZ1GC9D7%40jeltef.nl Discussion: https://www.postgresql.org/message-id/flat/c344c048-cd65-4440-a00f-61b2c9062351%40eisentraut.org --- .github/workflows/pg-ci.yml | 53 ++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pg-ci.yml b/.github/workflows/pg-ci.yml index e8eb49b5f15..4d4cdd024c0 100644 --- a/.github/workflows/pg-ci.yml +++ b/.github/workflows/pg-ci.yml @@ -1150,7 +1150,7 @@ jobs: # Test that code can be built with both gcc and clang without warnings, # with various combinations of cassert/dtrace flags. Trace probes have # a history of getting accidentally broken; the matrix is there to - # catch that. + # catch that. Also runs some other source-level checks. compiler-warnings: name: CompilerWarnings needs: [setup, sanity-check] @@ -1284,6 +1284,57 @@ jobs: ninja -C build --quiet -j${{env.BUILD_JOBS}} -k 0 \ headerscheck cpluspluscheck + ### + # Verify that the tree is pgindent-clean + # + # Advisory only: reports violations as a warning annotation and in the + # step summary, but does not fail the workflow. + # + # Relies on the preceding headerscheck step having configured the tree, + # which is needed to build pg_bsd_indent. + ### + - name: pgindent check + if: ${{ !cancelled() }} + run: | + echo "::group::build pg_bsd_indent" + ninja -C build src/tools/pg_bsd_indent/pg_bsd_indent + echo "::endgroup::" + + rc=0 + src/tools/pgindent/pgindent --indent=build/src/tools/pg_bsd_indent/pg_bsd_indent --check --diff . || rc=$? + + if [ "$rc" -eq 2 ]; then + echo "::warning title=pgindent::Tree is not pgindent-clean; see CompilerWarnings job." + elif [ "$rc" -ne 0 ]; then + # pgindent itself failed; that is a real error + exit "$rc" + fi + + ### + # Verify that the tree is git whitespace clean + # + # Advisory only: reports violations as a warning annotation and in the + # step summary, but does not fail the workflow. + ### + - name: git whitespace check + if: ${{ !cancelled() }} + run: | + # This job runs in a container, where the checkout is owned + # by a different user than the one running the steps, so git + # would otherwise refuse to operate on it ("dubious + # ownership"). + git config --global --add safe.directory "$GITHUB_WORKSPACE" + + rc=0 + git diff-tree --check `git hash-object -t tree /dev/null` HEAD || rc=$? + + if [ "$rc" -eq 2 ]; then + echo "::warning title=git::Tree is not git whitespace-clean; see CompilerWarnings job." + elif [ "$rc" -ne 0 ]; then + # git itself failed; that is a real error + exit "$rc" + fi + - *ccache_decide_save_step - *ccache_save_step - *upload_logs_step -- 2.56.0