diff --git a/.cirrus.yml b/.cirrus.yml index 04786174ed4ca..e456aaa7fe100 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -27,6 +27,10 @@ env: TEMP_CONFIG: ${CIRRUS_WORKING_DIR}/src/tools/ci/pg_ci_base.conf PG_TEST_EXTRA: kerberos ldap ssl load_balance + # default variables to use in local meson installations + MESON_REPO: https://github.com/mesonbuild/meson.git + MESON_BRANCH: master + # What files to preserve in case tests fail on_failure_ac: &on_failure_ac @@ -95,6 +99,9 @@ task: chown root:postgres / chmod g+rwx / + install_meson_and_rebase_script: | + bash src/tools/ci/install_meson_and_rebase.sh + configure_script: | su postgres <<-EOF meson setup \ @@ -174,6 +181,9 @@ task: setup_additional_packages_script: | #pkg install -y ... + install_meson_and_rebase_script: | + bash src/tools/ci/install_meson_and_rebase.sh + # NB: Intentionally build without -Dllvm. The freebsd image size is already # large enough to make VM startup slow, and even without llvm freebsd # already takes longer than other platforms except for windows. @@ -360,6 +370,9 @@ task: CCACHE_MAXSIZE: "400M" # tests two different builds SANITIZER_FLAGS: -fsanitize=alignment,undefined + install_meson_and_rebase_script: | + bash src/tools/ci/install_meson_and_rebase.sh + configure_script: | su postgres <<-EOF meson setup \ @@ -485,6 +498,9 @@ task: brew cleanup -s # to reduce cache size upload_caches: homebrew + install_meson_and_rebase_script: | + bash src/tools/ci/install_meson_and_rebase.sh + ccache_cache: folder: $CCACHE_DIR configure_script: | @@ -578,6 +594,9 @@ task: echo 127.0.0.3 pg-loadbalancetest >> c:\Windows\System32\Drivers\etc\hosts type c:\Windows\System32\Drivers\etc\hosts + install_meson_and_rebase_script: | + bash src/tools/ci/install_meson_and_rebase.sh + # Use /DEBUG:FASTLINK to avoid high memory usage during linking configure_script: | vcvarsall x64 @@ -643,6 +662,9 @@ task: %BASH% -c "where perl" %BASH% -c "perl --version" + install_meson_and_rebase_script: | + %BASH% src/tools/ci/install_meson_and_rebase.sh + # disable -Dnls as the number of files it creates cause a noticable slowdown configure_script: | %BASH% -c "meson setup -Ddebug=true -Doptimization=g -Dcassert=true -Db_pch=true -Dnls=disabled -DTAR=%TAR% build" diff --git a/src/tools/ci/install_meson_and_rebase.sh b/src/tools/ci/install_meson_and_rebase.sh new file mode 100755 index 0000000000000..0daca760fa9ec --- /dev/null +++ b/src/tools/ci/install_meson_and_rebase.sh @@ -0,0 +1,63 @@ +#! /bin/sh + +set -e +set -x + +case $CIRRUS_OS in + freebsd | linux | darwin | windows | mingw) + ;; + *) + echo "unsupported operating system ${CIRRUS_OS}" + exit 1 + ;; +esac + +# After repartition, hidden files are not copied. Copy them to +# working dir +if [ "$CIRRUS_OS" = 'freebsd' ]; then + cp -r $CIRRUS_WORKING_DIR.orig/.[^.]* $CIRRUS_WORKING_DIR/ + chown -R postgres:postgres .[^.]* +fi + + +# install meson by using pip +install_meson () { + case $CIRRUS_OS in + linux | windows) + PIP=pip + ;; + *) + PIP=pip3 + ;; + esac + ${PIP} install git+${MESON_REPO}@${MESON_BRANCH} +} + +run_rebase_commands() { + git config user.email 'postgres-ci@example.com' + git config user.name 'Postgres CI' + # windows looses the executable bit, causing an unnecessary diff + git config core.filemode false + git reset --hard + git remote add default-postgres https://github.com/postgres/postgres.git + git fetch default-postgres master + git rebase --no-verify default-postgres/master +} + +# Rebase current branch onto Postgres HEAD +rebase_onto_postgres () { + # freebsd and linux run commands as postgres user + case $CIRRUS_OS in + freebsd | linux) +su postgres <<-EOF + $(run_rebase_commands) +EOF + ;; + *) + run_rebase_commands + ;; + esac +} + +install_meson +rebase_onto_postgres