1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-31 05:54:36 +03:00

ci: Convert CompilerWarnings job to meson

This is part of the overall move toward meson.  This particular step
was previously held up because the headerscheck target was not ported
to meson, but this has been done a few months ago (commit
e82fc27e09).  This conversion is relatively straightforward.  The
scope of each individual build step (e.g., what features it enables,
what optimization level it uses) has been maintained, except as noted.

It actually covers a bit more now, as it also compiles various test
code via the testprep target.

One thing we're losing is the sharing of the configure cache between
the steps (gcc.cache, clang.cache).  There is a way to do that in
meson (meson-private/coredata.dat), but it's not meant to be used
across different build directories, and so making that work might be a
more significant restructuring.  The overall performance of the CI
runs seems to be about on par nonetheless.

Bitcode for JIT inlining is no longer built in this job, since meson
doesn't support it.  It added little to warning coverage, and the
Linux autoconf job still builds it.

Co-authored-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/e52e2c29-4834-4c64-a200-eddcba38fb4d%40eisentraut.org
This commit is contained in:
Peter Eisentraut
2026-10-25 10:13:30 +01:00
parent 2ebd684974
commit 3ca57291ff
2 changed files with 67 additions and 35 deletions

View File

@@ -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,30 @@ 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 \
-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 +1216,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 +1225,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 +1233,12 @@ 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
-Dauto_features=disabled
-Dzlib=enabled
MBUILD_TARGET: all
run: *compiler_warnings_cmd
###
@@ -1242,34 +1248,38 @@ jobs:
- name: Build documentation
if: ${{ !cancelled() }}
env:
CONF: --cache gcc.cache
CONF: -Dauto_features=disabled -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 \
-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

View File

@@ -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'