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/gcp_freebsd_repartition.sh b/src/tools/ci/gcp_freebsd_repartition.sh index 2d5e1738998e7..d2668a14e9361 100755 --- a/src/tools/ci/gcp_freebsd_repartition.sh +++ b/src/tools/ci/gcp_freebsd_repartition.sh @@ -25,4 +25,4 @@ du -hs $CIRRUS_WORKING_DIR mv $CIRRUS_WORKING_DIR $CIRRUS_WORKING_DIR.orig mkdir $CIRRUS_WORKING_DIR mount -o noatime /dev/da0p3 $CIRRUS_WORKING_DIR -cp -r $CIRRUS_WORKING_DIR.orig/* $CIRRUS_WORKING_DIR/ +cp -r $CIRRUS_WORKING_DIR.orig/ $CIRRUS_WORKING_DIR/ 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..6024b6e7b2606 --- /dev/null +++ b/src/tools/ci/install_meson_and_rebase.sh @@ -0,0 +1,51 @@ +#! /bin/sh + +set -e +set -x + +case $CIRRUS_OS in + freebsd | linux | darwin | windows | mingw) + ;; + *) + echo "unsupported operating system ${CIRRUS_OS}" + exit 1 + ;; +esac + +# install meson by using pip +install_meson () { + python3 -m 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 loses the executable bit, causing an unnecessary diff + git config core.filemode false + # windows changes file endings to crlf, causing test failures + git config core.autocrlf false + git remote add default-postgres https://github.com/postgres/postgres.git + git fetch default-postgres master + echo "Rebasing onto: $(git show --no-patch --abbrev-commit --pretty=oneline default-postgres/master)" + git rebase --autostash --no-verify default-postgres/master +} + +# Rebase current branch onto Postgres HEAD +rebase_onto_postgres () { + # safe directory need to be set because of dubious ownership error + # debian complains $HOME not set when --global is used + # macOS complains about permissions when --system is used + # so, use --global for macOS and --system for others + case $CIRRUS_OS in + darwin) + git config --global --add safe.directory /tmp/cirrus-ci-build + ;; + *) + git config --system --add safe.directory /tmp/cirrus-ci-build + ;; + esac + run_rebase_commands +} + +install_meson +rebase_onto_postgres