Recent Travis-CI issues with plugins

Recent Travis-CI issues with plugins

Tim Hunt發表於
Number of replies: 4
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片

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.

評比平均分數:Useful (9)
In reply to Tim Hunt

Re: Recent Travis-CI issues with plugins

Marcus Green發表於
Core developers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片 Testers的相片
Thanks Tim, you have saved me a bunch of time with that information.
In reply to Marcus Green

Re: Recent Travis-CI issues with plugins

Tim Hunt發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
I'm not sure it is still 100% accurate. I think things have moved on. If you can provide any updates, that would be most welcome.
In reply to Tim Hunt

Re: Recent Travis-CI issues with plugins

Tim Hunt發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
Regarding the grunt fails you get with master branch. ("New JavaScript system in master heading" above.)

A trick to get round it for now is to ingore the result of that tests on some branches, like

- moodle-plugin-ci grunt || [ "$MOODLE_BRANCH" = 'master' ]

in the .travis.yml file.

Thanks to Jan Dageförde for helping me make that work.
評比平均分數:Useful (2)
In reply to Tim Hunt

Re: Recent Travis-CI issues with plugins

Jan Dageförde發表於

In (at least) one of our plugins, the mustache task failed without actually checking any of the plugin's templates (the message was "WARNING: Problem calling HTML validator - please report bug to integration team."). There's already a fix for that in moodle-plugin-ci but that fix has not been released yet.

If you experience the same issue, you can switch to the very latest version of moodle-plugin-ci by making this change: https://github.com/learnweb/moodle-mod_collaborativefolders/commit/4786d4f9eed80de1dabebd9dd9ab9fa6723cebcb

Be aware that changing that line means that you are running unreleased versions of moodle-plugin-ci which may cause other unexpected issues. Nothing serious, but keep it in mind and revert this change once a new version containing the fix has been released.