forked from postgres/postgres
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 #81.
- Loading branch information
Showing
2 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |