Last active
May 18, 2020 18:32
-
-
Save Dagefoerde/b8ebf54438b8a77ee4ea73f552fc0a01 to your computer and use it in GitHub Desktop.
GitLab CI configuration for testing Moodle plugins using moodle-plugin-ci. Thanks to @danielneis who contributed a first version (cf. https://github.com/moodlerooms/moodle-plugin-ci/pull/36).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
- mysql:latest | |
cache: | |
paths: | |
- $HOME/.composer/cache | |
variables: | |
DB: "mysqli" | |
MYSQL_ROOT_PASSWORD: "superrootpass" | |
TRAVIS_BUILD_DIR: "$CI_PROJECT_DIR" | |
before_script: | |
- apt-get update | |
# Add Australian locale | |
- apt-get install -y locales | |
- echo "en_AU.UTF-8 UTF-8" > /etc/locale.gen | |
- locale-gen en_AU.UTF-8 | |
- /usr/sbin/update-locale LANG=en_AU.UTF-8 | |
# Install php-gd (and others) | |
- apt-get install -y git libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng12-dev libicu-dev g++ mysql-client npm | |
- ln -s "$(which nodejs)" /usr/bin/node | |
- docker-php-ext-install -j$(nproc) iconv mcrypt intl zip mysqli | |
- docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ | |
- docker-php-ext-install -j$(nproc) gd | |
# Install phpunit. | |
- curl -o /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar | |
- chmod +x /usr/local/bin/phpunit | |
- cd ../.. | |
# Install composer. | |
- curl -sS https://getcomposer.org/installer | php | |
- mv composer.phar /usr/local/bin/composer | |
- composer create-project -n --no-dev moodlerooms/moodle-plugin-ci ci ^1 | |
- export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH" | |
- chmod u+x /builds/ci/bin/moodle-plugin-ci | |
- chmod u+x /builds/ci/bin/* | |
- umask u+x | |
- moodle-plugin-ci install --db-user=root --db-pass=superrootpass --db-host=mysql -vvv | |
.job_template: &job_definition | |
script: | |
- EXIT_STATUS=0 | |
- moodle-plugin-ci phplint || EXIT_STATUS=$? | |
- moodle-plugin-ci phpcpd || EXIT_STATUS=$? | |
- moodle-plugin-ci phpmd || EXIT_STATUS=$? | |
- moodle-plugin-ci codechecker || EXIT_STATUS=$? | |
- moodle-plugin-ci csslint || EXIT_STATUS=$? | |
- moodle-plugin-ci shifter || EXIT_STATUS=$? | |
- moodle-plugin-ci jshint || EXIT_STATUS=$? | |
- moodle-plugin-ci validate || EXIT_STATUS=$? | |
- moodle-plugin-ci phpunit || EXIT_STATUS=$? | |
- moodle-plugin-ci behat || EXIT_STATUS=$? | |
- exit $EXIT_STATUS | |
job1: | |
<<: *job_definition | |
image: php:7.1 | |
variables: | |
MOODLE_BRANCH: "MOODLE_32_STABLE" |
Hello,
I've made a new version of this config file using the official docker images for Moodle that are now available at https://github.com/moodlehq/moodle-php-apache
It simplifies the script because we don't need to install all the additional packages and php extensions.
Take a look at https://gist.github.com/danielneis/5c6140ec8150c6151a54bccd26950278
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@danielneis encountered the problem that GitLab CI aborts the entire job as soon as one task of the script fails (reported at open-lms-open-source/moodle-plugin-ci#15 (comment)). In contrast, Travis CI always executes the entire script and reports an overall status in the end, which is more desirable for moodle-plugin-ci.
The latest revision of this script mimicks Travis's behaviour, i.e. it executes all tasks and reports an overall exit status.