Skip to content

Commit b4719bd

Browse files
committed
ci: Add feature to use different meson versions
We want to have a branch that uses a specific branch of meson for all tasks. Then, we can create a Cirrus cron "job" that tests Postgres againts different meson branches. Set a different meson branch by using `MESON_REPO` and `MESON_BRANCH` environment variables. Use a bash script to install this specific meson branch and rebase current Postgres branch onto Postgres HEAD. Fixes anarazel#81. ci-os-only: windows
1 parent 8a2b1b1 commit b4719bd

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

.cirrus.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ env:
2727
TEMP_CONFIG: ${CIRRUS_WORKING_DIR}/src/tools/ci/pg_ci_base.conf
2828
PG_TEST_EXTRA: kerberos ldap ssl load_balance
2929

30+
# default variables to use in local meson installations
31+
MESON_REPO: https://github.com/mesonbuild/meson.git
32+
MESON_BRANCH: master
33+
3034

3135
# What files to preserve in case tests fail
3236
on_failure_ac: &on_failure_ac
@@ -42,7 +46,10 @@ on_failure_meson: &on_failure_meson
4246
paths:
4347
- "build*/testrun/**/*.log"
4448
- "build*/testrun/**/*.diffs"
49+
- "build*/testrun/**/*.diff"
4550
- "build*/testrun/**/regress_log_*"
51+
- "**/**/elsecomment.0.stdout"
52+
- "**/**/elsecomment.out"
4653
type: text/plain
4754

4855
# In theory it'd be nice to upload the junit files meson generates, so that
@@ -95,6 +102,9 @@ task:
95102
chown root:postgres /
96103
chmod g+rwx /
97104
105+
install_meson_and_rebase_script: |
106+
bash src/tools/ci/install_meson_and_rebase.sh
107+
98108
configure_script: |
99109
su postgres <<-EOF
100110
meson setup \
@@ -174,6 +184,9 @@ task:
174184
setup_additional_packages_script: |
175185
#pkg install -y ...
176186
187+
install_meson_and_rebase_script: |
188+
bash src/tools/ci/install_meson_and_rebase.sh
189+
177190
# NB: Intentionally build without -Dllvm. The freebsd image size is already
178191
# large enough to make VM startup slow, and even without llvm freebsd
179192
# already takes longer than other platforms except for windows.
@@ -360,6 +373,9 @@ task:
360373
CCACHE_MAXSIZE: "400M" # tests two different builds
361374
SANITIZER_FLAGS: -fsanitize=alignment,undefined
362375

376+
install_meson_and_rebase_script: |
377+
bash src/tools/ci/install_meson_and_rebase.sh
378+
363379
configure_script: |
364380
su postgres <<-EOF
365381
meson setup \
@@ -485,6 +501,9 @@ task:
485501
brew cleanup -s # to reduce cache size
486502
upload_caches: homebrew
487503

504+
install_meson_and_rebase_script: |
505+
bash src/tools/ci/install_meson_and_rebase.sh
506+
488507
ccache_cache:
489508
folder: $CCACHE_DIR
490509
configure_script: |
@@ -578,6 +597,9 @@ task:
578597
echo 127.0.0.3 pg-loadbalancetest >> c:\Windows\System32\Drivers\etc\hosts
579598
type c:\Windows\System32\Drivers\etc\hosts
580599
600+
install_meson_and_rebase_script: |
601+
bash src/tools/ci/install_meson_and_rebase.sh
602+
581603
# Use /DEBUG:FASTLINK to avoid high memory usage during linking
582604
configure_script: |
583605
vcvarsall x64
@@ -643,6 +665,9 @@ task:
643665
%BASH% -c "where perl"
644666
%BASH% -c "perl --version"
645667
668+
install_meson_and_rebase_script: |
669+
%BASH% src/tools/ci/install_meson_and_rebase.sh
670+
646671
# disable -Dnls as the number of files it creates cause a noticable slowdown
647672
configure_script: |
648673
%BASH% -c "meson setup -Ddebug=true -Doptimization=g -Dcassert=true -Db_pch=true -Dnls=disabled -DTAR=%TAR% build"
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#! /bin/sh
2+
3+
set -e
4+
set -x
5+
6+
case $CIRRUS_OS in
7+
freebsd | linux | darwin | windows | mingw)
8+
;;
9+
*)
10+
echo "unsupported operating system ${CIRRUS_OS}"
11+
exit 1
12+
;;
13+
esac
14+
15+
# After repartition, hidden files are not copied. Copy them to
16+
# working dir
17+
if [ "$CIRRUS_OS" = 'freebsd' ]; then
18+
cp -r $CIRRUS_WORKING_DIR.orig/.[^.]* $CIRRUS_WORKING_DIR/
19+
chown -R postgres:postgres .[^.]*
20+
fi
21+
22+
23+
# install meson by using pip
24+
install_meson () {
25+
case $CIRRUS_OS in
26+
linux | windows)
27+
PIP=pip
28+
;;
29+
*)
30+
PIP=pip3
31+
;;
32+
esac
33+
${PIP} install git+${MESON_REPO}@${MESON_BRANCH}
34+
}
35+
36+
run_rebase_commands() {
37+
git config user.email '[email protected]'
38+
git config user.name 'Postgres CI'
39+
# windows looses the executable bit, causing an unnecessary diff
40+
git config core.filemode false
41+
git config core.autocrlf false
42+
git reset --hard
43+
git remote add default-postgres https://github.com/postgres/postgres.git
44+
git fetch default-postgres master
45+
git rebase --no-verify default-postgres/master
46+
}
47+
48+
# Rebase current branch onto Postgres HEAD
49+
rebase_onto_postgres () {
50+
echo "Rebasing onto: $(git show --no-patch --abbrev-commit --pretty=oneline default-postgres/master)"
51+
# freebsd and linux run commands as postgres user
52+
case $CIRRUS_OS in
53+
freebsd | linux)
54+
su postgres <<-EOF
55+
$(run_rebase_commands)
56+
EOF
57+
;;
58+
*)
59+
run_rebase_commands
60+
;;
61+
esac
62+
}
63+
64+
install_meson
65+
rebase_onto_postgres

0 commit comments

Comments
 (0)