Skip to content

Instantly share code, notes, and snippets.

@adpe
Last active September 3, 2025 23:18
Show Gist options
  • Select an option

  • Save adpe/834c741156edd6a6403eebe148a0ecec to your computer and use it in GitHub Desktop.

Select an option

Save adpe/834c741156edd6a6403eebe148a0ecec to your computer and use it in GitHub Desktop.
Moodle plugin .gitlab-ci.yml example
image: moodlehq/moodle-php-apache:7.4
services:
- mysql:5.7
- name: selenium/standalone-chrome:3
alias: selenium-standalone-chrome
variables:
DB: "mysqli"
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
TRAVIS_BUILD_DIR: "$CI_PROJECT_DIR"
MOODLE_BRANCH: "MOODLE_311_STABLE"
# Only needed, when your project is within a group/subgroup of "moodle".
MOODLE_DIR: "/var/www/html/moodle"
MOODLE_BEHAT_WDHOST: "http://selenium-standalone-chrome:4444/wd/hub"
MOODLE_START_BEHAT_SERVERS: "NO"
test:
before_script:
# Update packages and install mysql-client.
- apt update && apt install -y default-mysql-client
# Install nvm and NodeJS.
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
- . $HOME/.nvm/nvm.sh
- nvm install 14.15.0
# Install composer.
- curl -sS https://getcomposer.org/installer | php
- mv composer.phar /usr/local/bin/composer
# Setup Behat.
- export IPADDRESS=`grep "$HOSTNAME$" /etc/hosts | awk '{print $1}'`
- export MOODLE_BEHAT_WWWROOT="http://$IPADDRESS:8000"
# Install Moodle CI plugin.
- cd $CI_PROJECT_DIR/.. && rm -rf ci
- composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
- export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH"
- chmod u+x ci/bin/moodle-plugin-ci
- chmod u+x ci/bin/*
- umask u+x
# Install Moodle (ommit the --moodle argument if not needed)
- moodle-plugin-ci install --moodle=$MOODLE_DIR --db-host=mysql --no-init -vvv
- cd $MOODLE_DIR
- php -S $IPADDRESS:8000 -t $MOODLE_DIR > /dev/null 2>&1 &
- php admin/tool/behat/cli/init.php --add-core-features-to-theme --parallel=1 --optimize-runs=@local_ffhs_exam_toolbox
script:
- moodle-plugin-ci phplint
- moodle-plugin-ci phpcpd
- moodle-plugin-ci phpmd
- moodle-plugin-ci codechecker
- moodle-plugin-ci validate
- moodle-plugin-ci savepoints
- moodle-plugin-ci mustache
- moodle-plugin-ci grunt
- moodle-plugin-ci phpdoc
- moodle-plugin-ci phpunit
- moodle-plugin-ci behat --profile chrome
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment