I am making this post to share what I have learned from other people. I certaninly did not work most of htis out, but I am sharing what I have lerned in the hope that it helps others.
Travis has recently changed the default VM it gives you from Ubuntu Trusty to Ubunty Xenial. This means several things:
A) You need to say
Or you will get errors about MySQL not working.
B) If you were saying
to make Behat work, you instead need to say
C) Also, as well as Xenial being the new default, there are already Ubuntu Bionic VMs available and they seem to work well. In fact, in once case my Behat was failing, and then I changed to Bionic it started working. Not sure why. Anyway, it seems to me that if you are storting things out now, you may as well say
now, and get that working, because that will keep working for longer into the future.
Chrome / Behat
If you have upgraded to the latest Chrome, you will find Behat breaks horribly. That is a general Moodle problem being tracked over at MDL-66378 where Andrew Nicols is doing heroic work to fix it.
If you really want to make your Behat work on Travis before that lands, there is a crazy one-liner that you can add to your build sript to patch in a fix:
# The following line is a temporary work-around for https://tracker.moodle.org/browse/MDL-66378.
# Once that is fixed, the next line can be deleted.
- curl https://github.com/timhunt/php-webdriver/commit/7a0aa38f591b7395939df25d8cb6677bf99a481f.patch | git apply --directory moodle/vendor/instaclick/php-webdriver
- moodle-plugin-ci behat --profile chrome
File is stale and needs to be rebuilt: amd/build/[filename].min.js
(that is, if you build the JS using Moodle 3.7 or earlier). For now, I have just stopped running the tests against Moodle master. Before Moodle 3.8 is released, we will need to think of a better answer to this one.
To see all this together (including a few other irrelevant changes) here is the commit I made to fix all these issues in one of my plugins: https://github.com/moodleou/moodle-qtype_pmatchjme/commit/4fccd62877bb2df3d5b34c24c78d44a49a53890b
I hope this is useful.