.gitlab-ci.yml 2.71 KB
image: php:5.6

variables:
  DB_URL: 'mysql://root@127.0.0.1/db_drulenium'

drulenium:
  before_script:
   # Install git, the php image doesn't have it installed
   # jq for parsing JSON
   - apt-get update -yqq
   - apt-get install git jq -yqq

   - apt-get install wget default-jre -yqq

   # Installing firefox browser
   - apt-get install xvfb iceweasel unzip -yqq
   - Xvfb :99 -ac &
   - export DISPLAY=:99
   # - firefox -v
   # Firefox version 45.2.0 working with selenium-server-standalone-2.53.0
 
   # Installing selenium
   - wget http://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.0.jar
   - java -jar selenium-server-standalone-2.53.0.jar &
 
   # Installing MySQL server
   - export DEBIAN_FRONTEND=noninteractive
   - apt-get install mysql-server -yqq

   # Installing imagemagick & PHP GD extension
   - apt-get install libfreetype6-dev libjpeg62-turbo-dev libpng12-dev imagemagick -yqq
   - docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
   - docker-php-ext-install gd

   ## Installing drush
   # Install composer dependencies
   - curl -sS https://getcomposer.org/installer | php

   - php composer.phar global require drush/drush:6.*
   - export PATH="$HOME/.composer/vendor/bin:$PATH"
  script:
   - drush dl drupal-7 --drupal-project-rename=drulenium
   - cd drulenium
   - service mysql start
   - drush site-install testing --db-url=$DB_URL --site-name=Drulenium --yes
   - drush dl drulenium -y
   - drush en libraries -y
   - drush en drulenium drulenium_local_selenium drulenium_hosting_client -y
   - drush vr-download-webdriver
   - drush vset --yes drulenium_vr_config_server_opt 'drulenium_local_selenium'
   - drush vset --yes drulenium_vr_config_image_server_opt 'local'
   - drush vset --yes drulenium_vr_release_imagemagick_path '/usr/bin'
   - drush vset --yes drulenium_vr_api_secret $DRULENIUM_ORG_API_SECRET -q
   
   - export TEST_PAGES=$(echo `wget -O-  http://drulenium.org/api/v1/project/$DRULENIUM_ORG_PROJECT_UUID -q | jq -r '.tests | join(",")'`)
   - echo "$TEST_PAGES";
   - IFS=',' read -ra ADDR <<< "$TEST_PAGES"
   - for i in "${ADDR[@]}"; do drush vr-test-import $i CI-regression; done
  
   - drush vrc $BASELINE_URL --preset_category=CI-regression
   - drush vrc "$TEST_URL_PREFIX$CI_BUILD_REF_NAME$TEST_URL_SUFFIX" --preset_category=CI-regression
   - drush vr-diff --preset_category=CI-regression
   - drush dl drulenium_imgur
   - drush en drulenium_imgur -y
   - drush imgur-download-client -y
   # -q for quiet mode
   - drush vset --yes drulenium_imgur_client_id $IMGUR_CLIENT_ID -q
   - drush vset --yes drulenium_imgur_client_secret $IMGUR_CLIENT_SECRET -q
   - drush vr-diff-upload --preset_category=CI-regression
  except:
   - master