-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean and lean example of testing moodle plugin with bitbucket pipelines #215
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
|
||
definitions: | ||
setupdeps: &setupDeps | ||
export DEBIAN_FRONTEND='noninteractive' ; | ||
export COMPOSER_ALLOW_SUPERUSER=1 ; | ||
export COMPOSER_CACHE_DIR=~/.composer/cache ; | ||
export MOODLE_START_BEHAT_SERVERS='NO' ; | ||
export CI_BUILD_DIR='/tmp/plugin' ; | ||
export MOODLE_BEHAT_WWWROOT="http://$BITBUCKET_DOCKER_HOST_INTERNAL:8000" ; | ||
export MOODLE_BEHAT_WDHOST="http://$BITBUCKET_DOCKER_HOST_INTERNAL:4444/wd/hub" ; | ||
export MOODLE_REPO='https://bitbucket.org/moodle/moodle.git' ; | ||
export MOODLE_BRANCH='MOODLE_311_STABLE' ; | ||
export DB='mariadb' ; | ||
mkdir -pv "$CI_BUILD_DIR" && cp -ru "$BITBUCKET_CLONE_DIR/"* "$CI_BUILD_DIR" && | ||
mkdir -p /usr/share/man/man1 /usr/share/man/man3 /usr/share/man/man7 && | ||
apt-get -q update && apt-get -yq install default-jre-headless mariadb-client && | ||
curl -sS https://raw.githubusercontent.com/creationix/nvm/v0.39.3/install.sh | bash && | ||
. ~/.bashrc && nvm install --default --latest-npm lts/gallium && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you use the version of nvm from the .nvmrc file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You misunderstood this. Everything in the setupdeps part is executed before anything is installed and just caches a nodejs version used in several most recent versions of moodle. During the execution of moodle-plugin-ci install the tool itself will check and install what is specified in .nvmrc. |
||
curl -sS https://getcomposer.org/installer | php -- --install-dir='/usr/local/bin' --filename='composer' && | ||
composer create-project -n --no-dev --no-progress --no-ansi moodlehq/moodle-plugin-ci /opt/mci ^3 && | ||
export PATH="/opt/mci/bin:/opt/mci/vendor/bin:$PATH" | ||
startbehat: &startBehat | ||
export MPATH="$BITBUCKET_CLONE_DIR/moodle" ; | ||
docker run -d -p 4444:4444 --shm-size=1g -v "$MPATH:$MPATH" 'selenium/standalone-firefox:3' && | ||
{ php -S 0.0.0.0:8000 -t "$MPATH" >/dev/null 2>&1 & } && | ||
sleep 10s | ||
services: | ||
mariadb: | ||
image: mariadb:10 | ||
variables: | ||
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: 'yes' | ||
caches: | ||
npm: $HOME/.npm | ||
|
||
pipelines: | ||
default: | ||
- step: | ||
name: 'Moodle 3.11, PHP 7.4 and MariaDB 10' | ||
image: moodlehq/moodle-php-apache:7.4 | ||
services: | ||
- mariadb | ||
caches: | ||
- npm | ||
- composer | ||
script: | ||
- *setupDeps | ||
- moodle-plugin-ci install --db-host='127.0.0.1' | ||
- 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 | ||
- step: | ||
name: 'Moodle 4.0, PHP 8.0 and MariaDB 10' | ||
image: moodlehq/moodle-php-apache:8.0 | ||
services: | ||
- mariadb | ||
- docker | ||
caches: | ||
- npm | ||
- composer | ||
- docker | ||
script: | ||
- *setupDeps | ||
- moodle-plugin-ci install --db-host='127.0.0.1' --branch='MOODLE_400_STABLE' | ||
- *startBehat | ||
- 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this going to cause a problem for the Moodle 4.0 test? Or should it be moved to the Moodle 3.11 test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are only the defaults. If nothing specific is set in moodle-plugin-ci install these are the default values used. However, anything specified in moodle-plugin-ci install command line overrides any ENV variable.