Created
May 12, 2021 17:44
-
-
Save Zhuoqin/59cc1f89c4ebe541b0ef122c0ec3dc90 to your computer and use it in GitHub Desktop.
Based the moodle plugin ci(gitlab ci config) I created, https://gist.github.com/Zhuoqin/a6eaed701e9fa0d6d7d0e4385077d6df, here is a version that it's used to test plugin for moodle workplace multi-tenancy.
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
image: moodlehq/moodle-php-apache:7.3-stretch | |
services: | |
- postgres:9.6 | |
variables: | |
MOODLE_BRANCH: "MOODLE_38_STABLE" | |
MOODLE_REPO: "git://github.com/moodleworkplace/multitenancy.git" | |
DB: "pgsql" | |
MOODLE_DIR: "/var/www/html/moodle" | |
POSTGRES_DB: moodle | |
POSTGRES_DB_USED: mdlunit | |
POSTGRES_USER: moodle | |
POSTGRES_PASSWORD: moodle | |
TRAVIS_BUILD_DIR: "$CI_PROJECT_DIR" | |
# - Moodle installation MUST be outside $CI_PROJECT_DIR | |
# - moodle-plugin-ci MUST be in the $PATH | |
# - Database MUST be dropped prior to installation | |
# - Composer MUST be in the path for moodle-plugin-ci | |
# - Moodle 3.5 require Node v8 <9 | |
before_script: | |
- ls | |
- apt-get update | |
- seq 1 8 | xargs -I{} mkdir -p /usr/share/man/man{} # fix issue with postgresql-client on slim images. https://bit.ly/2JzEMZf | |
- apt-get install -y git unzip postgresql-client-9.6 | |
- echo "Uninstall previous Moodle version" | |
- export PGPASSWORD=$POSTGRES_PASSWORD | |
- psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "DROP DATABASE IF EXISTS $POSTGRES_DB_USED;" || true | |
- echo "Install NPM" | |
- curl -sL https://deb.nodesource.com/setup_8.x | bash - | |
- apt-get install -y nodejs | |
- node -v | |
- cd .. | |
- rm -rf -- ci | |
# Install composer. | |
- curl -sS https://getcomposer.org/installer | php | |
- mv composer.phar /usr/local/bin/composer | |
- 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 | |
- cd $CI_PROJECT_DIR/.. | |
- ls | |
- pwd | |
- moodle-plugin-ci install --moodle=$MOODLE_DIR --db-user=$POSTGRES_USER --db-name=$POSTGRES_DB_USED --db-pass=$POSTGRES_PASSWORD --db-host=postgres -vvv | |
- ls | |
.job_template: &job_definition | |
script: | |
# - moodle-plugin-ci codechecker | |
- moodle-plugin-ci phpunit | |
- moodle-plugin-ci phplint | |
- moodle-plugin-ci phpcpd | |
- moodle-plugin-ci phpmd | |
- moodle-plugin-ci savepoints | |
- moodle-plugin-ci mustache | |
- moodle-plugin-ci grunt | |
- moodle-plugin-ci validate | |
# install docker inside of debian | |
- apt-get install -y apt-transport-https ca-certificates gnupg lsb-release | |
- curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | |
- echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null | |
- apt-get update | |
- apt-get install -y docker-ce docker-ce-cli containerd.io | |
- service docker start | |
# run behat test using docker started selenium | |
- moodle-plugin-ci behat | |
- exit $EXIT_STATUS | |
Test: | |
<<: *job_definition |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment