From ce2fd5b8f36ffe2adb40ec598b568589c674fd17 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 24 Sep 2026 16:32:19 +0200 Subject: [PATCH 2/3] ci: Convert CompilerWarnings job to meson --- .github/workflows/pg-ci.yml | 80 +++++++++++++++++-------------- src/tools/ci/mingw-cross-file.txt | 22 +++++++++ 2 files changed, 67 insertions(+), 35 deletions(-) create mode 100644 src/tools/ci/mingw-cross-file.txt diff --git a/.github/workflows/pg-ci.yml b/.github/workflows/pg-ci.yml index a2629c8335a..e80e2c9efbd 100644 --- a/.github/workflows/pg-ci.yml +++ b/.github/workflows/pg-ci.yml @@ -94,7 +94,7 @@ env: -Dzlib=enabled -Dzstd=enabled - # Shared between the Linux autoconf job and the CompilerWarnings jobs + # Used by the Linux autoconf job LINUX_CONFIGURE_FEATURES: >- --with-gssapi --with-icu @@ -1151,10 +1151,6 @@ jobs: # with various combinations of cassert/dtrace flags. Trace probes have # a history of getting accidentally broken; the matrix is there to # catch that. - # - # The autoconf cache files (gcc.cache / clang.cache) are intentionally - # reused across the matrix entries that share a compiler, so we don't - # pay for full feature detection on every entry. compiler-warnings: name: CompilerWarnings needs: [setup, sanity-check] @@ -1170,7 +1166,17 @@ jobs: # Use larger ccache cache as this job compiles with multiple # compilers / flag combinations. CCACHE_MAXSIZE: "1G" - DEFAULT_BUILD: world-bin + + # Enable everything else in LINUX_CONFIGURE_FEATURES but not in + # MESON_COMMON_FEATURES. + MESON_FEATURES: >- + -Dgssapi=enabled + -Dlibcurl=enabled + -Dllvm=enabled + -Dpam=enabled + -Dselinux=enabled + -Dsystemd=enabled + -Duuid=ossp steps: - *nix_sysinfo_step @@ -1178,33 +1184,31 @@ jobs: - *ccache_restore_default_step - *ccache_restore_branch_step - - name: Setup workspace - run: | - echo "COPT=-Werror" > src/Makefile.custom - # gcc, cassert off, dtrace on - name: gcc warnings + (dtrace) if: ${{ !cancelled() }} env: - CONF: ${{env.LINUX_CONFIGURE_FEATURES}} --cache gcc.cache --enable-dtrace + CONF: ${{env.MESON_COMMON_FEATURES}} ${{env.MESON_FEATURES}} -Ddtrace=enabled CC: ccache gcc CXX: ccache g++ - CLANG: ccache clang run: &compiler_warnings_cmd | echo "::group::configure" - ./configure \ + rm -rf build + meson setup \ + -Dauto_features=disabled \ + -Dwerror=true \ + -Ddebug=false \ ${{env.CONF}} \ - CLANG="ccache clang" + build echo "::endgroup::" - make -s -j${{env.BUILD_JOBS}} clean - make -s -j${{env.BUILD_JOBS}} ${{env.DEFAULT_BUILD}} + ninja -C build --quiet -j${{env.BUILD_JOBS}} ${{env.MBUILD_TARGET}} # gcc, cassert on, dtrace off - name: gcc warnings + (cassert) if: ${{ !cancelled() }} env: - CONF: ${{env.LINUX_CONFIGURE_FEATURES}} --cache gcc.cache --enable-cassert + CONF: ${{env.MESON_COMMON_FEATURES}} ${{env.MESON_FEATURES}} -Dcassert=true CC: ccache gcc CXX: ccache g++ run: *compiler_warnings_cmd @@ -1213,7 +1217,7 @@ jobs: - name: clang warnings if: ${{ !cancelled() }} env: - CONF: ${{env.LINUX_CONFIGURE_FEATURES}} --cache clang.cache + CONF: ${{env.MESON_COMMON_FEATURES}} ${{env.MESON_FEATURES}} CC: ccache clang CXX: ccache clang++ run: *compiler_warnings_cmd @@ -1222,7 +1226,7 @@ jobs: - name: clang warnings + (cassert + dtrace) if: ${{ !cancelled() }} env: - CONF: ${{env.LINUX_CONFIGURE_FEATURES}} --cache clang.cache --enable-cassert --enable-dtrace + CONF: ${{env.MESON_COMMON_FEATURES}} ${{env.MESON_FEATURES}} -Dcassert=true -Ddtrace=enabled CC: ccache clang CXX: ccache clang++ run: *compiler_warnings_cmd @@ -1230,9 +1234,10 @@ jobs: - name: mingw warnings (cross compilation) if: ${{ !cancelled() }} env: - CONF: --host=x86_64-w64-mingw32ucrt --enable-cassert --without-icu - CC: ccache x86_64-w64-mingw32ucrt-gcc - CXX: ccache x86_64-w64-mingw32ucrt-g++ + CONF: >- + --cross-file src/tools/ci/mingw-cross-file.txt + -Dcassert=true + MBUILD_TARGET: all run: *compiler_warnings_cmd ### @@ -1242,34 +1247,39 @@ jobs: - name: Build documentation if: ${{ !cancelled() }} env: - CONF: --cache gcc.cache + CONF: -Ddocs=enabled CC: ccache gcc CXX: ccache g++ - DEFAULT_BUILD: -C doc + MBUILD_TARGET: docs run: *compiler_warnings_cmd ### # Verify headerscheck / cpluspluscheck succeed # - # - Run both in same script to increase parallelism, use -k to get - # result of both + # - Run both in the same ninja invocation to increase parallelism, use + # -k 0 to get the result of both # - Use -fmax-errors, as particularly cpluspluscheck can be very verbose ### - name: headerscheck + cpluspluscheck if: ${{ !cancelled() }} + env: + CONF: ${{env.MESON_COMMON_FEATURES}} ${{env.MESON_FEATURES}} + CC: ccache gcc + CXX: ccache g++ + EXTRAFLAGS: -fmax-errors=10 run: | echo "::group::configure" - ./configure \ - ${{env.LINUX_CONFIGURE_FEATURES}} \ - --cache gcc.cache \ - --quiet \ - CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang" + rm -rf build + meson setup \ + -Dauto_features=disabled \ + -Dwerror=true \ + -Ddebug=false \ + ${{env.CONF}} \ + build echo "::endgroup::" - make -s -j${{env.BUILD_JOBS}} clean - make -s -j${{env.BUILD_JOBS}} -k ${{env.CHECKFLAGS}} \ - headerscheck cpluspluscheck \ - EXTRAFLAGS='-fmax-errors=10' + ninja -C build --quiet -j${{env.BUILD_JOBS}} -k 0 \ + headerscheck cpluspluscheck - *ccache_decide_save_step - *ccache_save_step diff --git a/src/tools/ci/mingw-cross-file.txt b/src/tools/ci/mingw-cross-file.txt new file mode 100644 index 00000000000..413e3d3a489 --- /dev/null +++ b/src/tools/ci/mingw-cross-file.txt @@ -0,0 +1,22 @@ +# Meson cross file for cross compiling to Windows with the Debian +# mingw-w64 toolchain, as used by the CompilerWarnings CI job. +# +# ccache is spelled out here because meson's automatic ccache +# detection does not apply to compilers that are named in a cross +# file. + +[constants] +prefix = 'x86_64-w64-mingw32ucrt-' + +[binaries] +c = ['ccache', prefix + 'gcc'] +cpp = ['ccache', prefix + 'g++'] +ar = prefix + 'ar' +strip = prefix + 'strip' +windres = prefix + 'windres' + +[host_machine] +system = 'windows' +cpu_family = 'x86_64' +cpu = 'x86_64' +endian = 'little' -- 2.55.0