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-CI
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
services:
mysql
Or you will get errors about MySQL not working.
B) If you were saying
apt:
packages:
- oracle-java8-installer
- oracle-java8-set-default
to make Behat work, you instead need to say
apt:
packages:
- openjdk-8-jre-headless
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
dist: bionic
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
New JavaScript system in master
Moodle 3.8 is going to use a new way of building JavaScript. That means that, if like me you try to have one version of your plugin to support all recent Moodle versions, then the moodle-plugin-ci grunt will fail on Master saying
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.
Summary
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.