|
| 1 | +services: |
| 2 | + - name: selenium/standalone-chrome:3 |
| 3 | + alias: behat |
| 4 | + - name: mysql:8.0 |
| 5 | + alias: db |
| 6 | + command: |
| 7 | + - '--character-set-server=utf8mb4' |
| 8 | + - '--collation-server=utf8mb4_unicode_ci' |
| 9 | + - '--innodb_file_per_table=On' |
| 10 | + - '--wait-timeout=28800' |
| 11 | + - '--skip-log-bin' |
| 12 | + |
| 13 | +cache: |
| 14 | + paths: |
| 15 | + - .cache |
| 16 | + |
| 17 | +variables: |
| 18 | + DEBIAN_FRONTEND: 'noninteractive' |
| 19 | + COMPOSER_ALLOW_SUPERUSER: 1 |
| 20 | + COMPOSER_CACHE_DIR: "$CI_PROJECT_DIR/.cache/composer" |
| 21 | + NPM_CONFIG_CACHE: "$CI_PROJECT_DIR/.cache/npm" |
| 22 | + CI_BUILD_DIR: '/tmp/plugin' |
| 23 | + MOODLE_BRANCH: 'MOODLE_401_STABLE' |
| 24 | + MOODLE_BEHAT_WWWROOT: 'http://localhost:8000' |
| 25 | + MOODLE_BEHAT_WDHOST: 'http://behat:4444/wd/hub' |
| 26 | + MOODLE_START_BEHAT_SERVERS: 'no' |
| 27 | + MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' |
| 28 | + DB: 'mysqli' |
| 29 | + |
| 30 | +stages: |
| 31 | + - moodle-plugin-ci |
| 32 | + |
| 33 | +.setupandruncheck: &setupandruncheck |
| 34 | + stage: moodle-plugin-ci |
| 35 | + before_script: |
| 36 | + - mkdir -pv "$CI_BUILD_DIR" |
| 37 | + - cp -ru "$CI_PROJECT_DIR/"* "$CI_BUILD_DIR" |
| 38 | + - mkdir -p /usr/share/man/man1 /usr/share/man/man3 /usr/share/man/man7 |
| 39 | + - apt-get -qq update |
| 40 | + - apt-get -yqq install --no-install-suggests default-jre-headless default-mysql-client |
| 41 | + - 'curl -sS https://raw.githubusercontent.com/creationix/nvm/v0.39.3/install.sh | bash' |
| 42 | + - . ~/.bashrc |
| 43 | + - nvm install --default --latest-npm lts/gallium |
| 44 | + - 'curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer' |
| 45 | + - composer create-project -n --no-dev --no-progress --no-ansi moodlehq/moodle-plugin-ci /opt/mci ^4 |
| 46 | + - export PATH="/opt/mci/bin:/opt/mci/vendor/bin:$PATH" |
| 47 | + - moodle-plugin-ci install --db-host db --db-name moodle |
| 48 | + - '{ php -S 0.0.0.0:8000 -t "$CI_PROJECT_DIR/moodle" >/dev/null 2>&1 & }' |
| 49 | + - TXT_RED="\e[31m" |
| 50 | + |
| 51 | + script: |
| 52 | + - errors=() |
| 53 | + - moodle-plugin-ci phplint || errors+=("phplint") |
| 54 | + - moodle-plugin-ci phpmd || errors+=("phpmd") |
| 55 | + - moodle-plugin-ci codechecker --max-warnings 0 || errors+=("codechecker") |
| 56 | + - moodle-plugin-ci phpdoc --max-warnings 0 || errors+=("phpdoc") |
| 57 | + - moodle-plugin-ci validate || errors+=("validate") |
| 58 | + - moodle-plugin-ci savepoints || errors+=("savepoints") |
| 59 | + - moodle-plugin-ci mustache || errors+=("mustache") |
| 60 | + - moodle-plugin-ci grunt --max-lint-warnings 0 || errors+=("grunt") |
| 61 | + - moodle-plugin-ci phpunit || errors+=("phpunit") |
| 62 | + - moodle-plugin-ci behat --auto-rerun 0 --profile chrome || errors+=("behat") |
| 63 | + - |- |
| 64 | + if [ ${#errors[@]} -ne 0 ]; then |
| 65 | + echo -e "${TXT_RED}Check errors: ${errors[@]}"; |
| 66 | + exit 1; |
| 67 | + fi |
| 68 | +
|
| 69 | +php74: |
| 70 | + tags: |
| 71 | + - docker |
| 72 | + image: moodlehq/moodle-php-apache:7.4 |
| 73 | + <<: *setupandruncheck |
| 74 | + |
| 75 | +php81: |
| 76 | + tags: |
| 77 | + - docker |
| 78 | + image: moodlehq/moodle-php-apache:8.1 |
| 79 | + <<: *setupandruncheck |
| 80 | + |
| 81 | +php82: |
| 82 | + tags: |
| 83 | + - docker |
| 84 | + image: moodlehq/moodle-php-apache:8.2 |
| 85 | + <<: *setupandruncheck |
0 commit comments