open-lms-open-source / moodle-plugin-ci

Assist with running a Moodle plugin in Travis CI
https://blackboard-open-source.github.io/moodle-plugin-ci/
GNU General Public License v3.0
43 stars 37 forks source link

Example travis ci for mariadb and mysql #76

Closed dionysius closed 6 years ago

dionysius commented 6 years ago

Hi, coming from a problem specific with mariadb (https://github.com/frankkoch/moodle-mod_studentquiz/issues/26)

This might be a question to travis itself, but maybe someone here already knows the answer...

Has anyone managed to setup a travis matrix, where I can test in mysql and mariadb? These two doesn't seem to be coinstallable...

scara commented 6 years ago

Hi @dionysius, did you already read https://docs.travis-ci.com/user/database-setup/#MariaDB ? It's just a matter of:

addons:
  mariadb: '10.0'

and playing w/ DB=mariadb in your matrix (env/include/exclude).

HTH, Matteo

dionysius commented 6 years ago

Hi @scara Thank you for your answer. Yes I've read the database-setup docs for mariadb. Since they share the same port, I hardly assume the use of mariadb will remove mysql, so I would need to find a way to add mariadb only in specific conditions. Where did you find the information in the docs, that you can add addons inside include/exclude matrix? This was the missing piece for my understanding. Before posting initially I only had this issue https://github.com/travis-ci/travis-ci/issues/4555, but never found an official documentation about this. I'm just about now trying this out ;)

dionysius commented 6 years ago

Hi @scara

Sounds like there's no mariadb support at all for moodle-plugin-ci. It doesn't like it:

$ moodle-plugin-ci install

  [DomainException]                                             
  Unknown database type (mariadb). Please use mysqli or pgsql.  

See Log and it's Config

scara commented 6 years ago

That's interesting: https://github.com/moodlerooms/moodle-plugin-ci/blob/210a0ea9077d68e26a1ee13cefde8ccc2a99701e/src/Command/InstallCommand.php#L83

https://github.com/moodlerooms/moodle-plugin-ci/blob/35adc672187f680eb4ac2c52370e3a01e33a0b0e/src/Installer/Database/DatabaseResolver.php#L63

So the first work is to extend MySQLDatabase in https://github.com/moodlerooms/moodle-plugin-ci/tree/35adc672187f680eb4ac2c52370e3a01e33a0b0e/src/Installer/Database before going further w/ your tests on travis-ci.

TNX for giving it a try! 👍