Skip to content
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

Using Docker #80

Open
bozoh opened this issue Aug 16, 2018 · 0 comments
Open

Using Docker #80

bozoh opened this issue Aug 16, 2018 · 0 comments

Comments

@bozoh
Copy link

bozoh commented Aug 16, 2018

travis support docker, so why not use docker with moodle-plugin-ci behat tests

here my configuration (it's use chrome browser image)

sudo: required

notifications:
  on_success: never #change #never # default: change
  on_failure: never #always # default: always

language: php

php:
  - 5.6
  - 7.0
  - 7.1
  - 7.2

addons:
  postgresql: "9.6"
  services:
    - docker

cache:
  directories:
    - $HOME/.composer/cache
    - $HOME/.npm
    - $HOME/.docker/cache

env:
  global:
    - MOODLE_START_BEHAT_SERVERS=NO
    - MOODLE_BRANCH=MOODLE_35_STABLE
    - DB=pgsql
    - DOCKER_IMAGE=selenium/standalone-chrome
    - DOCKER_TAG_VERSION=3.14.0-arsenic
    - MOODLE_CI_VER=2
    - MOODLE_DIR=/home/travis/build/moodle
  

matrix:
  # include:
  #   - php: 7.0
  #     env: MOODLE_BRANCH=MOODLE_33_STABLE
  # - env: MOODLE_BRANCH=MOODLE_34_STABLE MOODLE_CI_VER=2
  # - env: MOODLE_BRANCH=MOODLE_35_STABLE MOODLE_CI_VER=2
  exclude:
    - php: 5.6

before_install:
  - >
      IMAGE_FILE=image-$(echo "${DOCKER_IMAGE}" | sed  -e "s|/|-|g")-${DOCKER_TAG_VERSION}.tar;
      echo ${IMAGE_FILE};
      if [ ! -e "${HOME}/.docker/cache/${IMAGE_FILE}" ]; then
        rm -rf ${HOME}/.docker/cache/image*.tar;
        docker pull ${DOCKER_IMAGE}:${DOCKER_TAG_VERSION};
        docker save ${DOCKER_IMAGE}:${DOCKER_TAG_VERSION} -o ${HOME}/.docker/cache/${IMAGE_FILE};
      fi;
      docker load -i ${HOME}/.docker/cache/${IMAGE_FILE}

  - phpenv config-rm xdebug.ini
  - cd ../..
  - composer selfupdate
  - composer create-project -n --no-dev --prefer-dist moodlerooms/moodle-plugin-ci ci ^${MOODLE_CI_VER}
  - export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH"
  - sleep 10

install:
  - moodle-plugin-ci install
  - docker run --rm --net=host -d -p4444:4444 ${DOCKER_IMAGE}:${DOCKER_TAG_VERSION}
  - php -t ${MOODLE_DIR} -S localhost:8000 &>/tmp/www.log &
  - sleep 20s

script:
  #- moodle-plugin-ci behat --moodle=${MOODLE_DIR} --auto-rerun=0
  - moodle-plugin-ci behat --profile='chrome' --moodle=${MOODLE_DIR} --auto-rerun=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant