MDL-51906 testing: Fix travis builds for beta/rc

These were previously checking the release string for presence of the 'dev'
string. On friday we moved to beta, and will shortly move to RC.

We should be checking the version maturity instead.

This change switches to checking for MATURITY_STABLE in the maturity
string. If it is found, the branch behaviour follows the $branch version.
If it is not found, we use master.

This also adds a check to ensure that if the branch is not found, we exit
early instead of performing CI Tests over the entirety of Moodle.
This commit is contained in:
Andrew Nicols 2015-10-26 09:38:44 +08:00
parent 9382ac38d6
commit 5459e754c6

View file

@ -165,19 +165,28 @@ script:
# The local_ci repository does the actual checking. # The local_ci repository does the actual checking.
git clone https://github.com/moodlehq/moodle-local_ci.git local/ci git clone https://github.com/moodlehq/moodle-local_ci.git local/ci
# Determine the branch # Determine the branch based on the release maturity.
grep '^$release.*dev' version.php > /dev/null grep '^$maturity.*=.*MATURITY_STABLE.*' version.php > /dev/null
if [ $? -eq 0 ]; if [ $? -eq 0 ];
then then
# This is master
export branchname='master';
else
# This is a stable branch. Use the version from version.php to determine which one. # This is a stable branch. Use the version from version.php to determine which one.
export branchname="MOODLE_`grep '^$branch' version.php | sed "s/^.*'\([0-9]*\)'.*$/\1/"`_STABLE"; branchname="MOODLE_`grep '^$branch' version.php | sed "s/^.*'\([0-9]*\)'.*$/\1/"`_STABLE";
else
# We only branch at the point at which we make the release stable.
# Revert to 'master' until we do so.
branchname='master';
fi fi
# We need the official upstream for comparison # We need the official upstream for comparison
git remote add upstream https://github.com/moodle/moodle.git; git remote add upstream https://github.com/moodle/moodle.git;
# Check to see if the remote branch was found.
git ls-remote --exit-code --heads upstream "$branchname"
if [ $? -ne 0 ];
then
echo "Branch '$branchname' could not be found. Skipping further CI Tests" && false;
fi
git fetch upstream "$branchname"; git fetch upstream "$branchname";
export GIT_PREVIOUS_COMMIT="`git merge-base FETCH_HEAD $TRAVIS_COMMIT`"; export GIT_PREVIOUS_COMMIT="`git merge-base FETCH_HEAD $TRAVIS_COMMIT`";
export GIT_COMMIT="$TRAVIS_COMMIT"; export GIT_COMMIT="$TRAVIS_COMMIT";