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.