Merge Substrate master before checking Polkadot companion (#5916)

* Merge Substrate master before checking Polkadot companion

* Also merge polkadot/master into the companion pr branch

* Set email and user name
This commit is contained in:
Bastian Köcher
2020-05-07 12:50:25 +02:00
committed by GitHub
parent ffb2d09aa1
commit 05cb63dd70
@@ -39,15 +39,22 @@ substrate's branch. if it can't find anything, it will uses master instead
EOT EOT
# Set the user name and email to make merging work
git config --global user.name 'CI system'
git config --global user.email '<>'
SUBSTRATE_PATH=$(pwd) SUBSTRATE_PATH=$(pwd)
# Merge master into our branch before building Polkadot to make sure we don't miss
# any commits that are required by Polkadot.
git merge origin/master
# Clone the current Polkadot master branch into ./polkadot. # Clone the current Polkadot master branch into ./polkadot.
git clone --depth 1 https://github.com/paritytech/polkadot.git git clone --depth 1 https://github.com/paritytech/polkadot.git
cd polkadot cd polkadot
# either it's a pull request then check for a companion otherwise use # either it's a pull request then check for a companion otherwise use
# polkadot:master # polkadot:master
if expr match "${CI_COMMIT_REF_NAME}" '^[0-9]\+$' >/dev/null if expr match "${CI_COMMIT_REF_NAME}" '^[0-9]\+$' >/dev/null
then then
@@ -78,12 +85,14 @@ then
boldprint "companion pr specified/detected: #${pr_companion}" boldprint "companion pr specified/detected: #${pr_companion}"
git fetch --depth 1 origin refs/pull/${pr_companion}/head:pr/${pr_companion} git fetch --depth 1 origin refs/pull/${pr_companion}/head:pr/${pr_companion}
git checkout pr/${pr_companion} git checkout pr/${pr_companion}
git merge origin/master
else else
pr_ref="$(grep -Po '"ref"\s*:\s*"\K(?!master)[^"]*' "${pr_data_file}")" pr_ref="$(grep -Po '"ref"\s*:\s*"\K(?!master)[^"]*' "${pr_data_file}")"
if git fetch --depth 1 origin "$pr_ref":branch/"$pr_ref" 2>/dev/null if git fetch --depth 1 origin "$pr_ref":branch/"$pr_ref" 2>/dev/null
then then
boldprint "companion branch detected: $pr_ref" boldprint "companion branch detected: $pr_ref"
git checkout branch/"$pr_ref" git checkout branch/"$pr_ref"
git merge origin/master
else else
boldprint "no companion branch found - building polkadot:master" boldprint "no companion branch found - building polkadot:master"
fi fi