Commit 8af8e249 authored by Nikhil Dubbaka's avatar Nikhil Dubbaka

Adding GitLab CI file for visual regression testing with Drulenium

parent 97664ece
Pipeline #6050388 failed with stage
in 5 minutes 36 seconds
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 default-jre -yqq # Immediately after apt-get update to avoid E: Failed to fetch http://httpredir.debian.org/debian/pool/mai
- apt-get install git wget jq -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=docroot
- cd docroot
- service mysql start
- drush site-install minimal --db-url=$DB_URL --site-name=Drulenium --account-name=admin --account-pass=admin --yes
# Start server
- drush runserver --server=builtin 8080 > /dev/null 2>&1 &
- 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 'drulenium_local_selenium'
- drush vset --yes drulenium_vr_release_imagemagick_path '/usr/bin'
- drush vset --yes drulenium_vr_release_selenium_browser_width $BROWSER_WIDTH
- drush vset --yes drulenium_vr_release_selenium_browser_height $BROWSER_HEIGHT
# Test as admin user
- drush vset --yes drulenium_vr_release_user_name 'admin' -q
- drush vset --yes drulenium_vr_release_user_pass 'admin' -q
# Set admin theme for responsive widths
- drush vset admin_theme seven
# Uncomment below lines if you want to dynamically pull the test cases from the project on http://drulenium.org/
- 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
- |
if [ "$PATCH_FILE_URL" != "" ]; then
drush dl $PROJECT_NAME-$PROJECT_DEV_VERSION -y
PATCH_FILE_NAME=$(basename "$PATCH_FILE_URL")
elif [ "$PROJECT_STABLE_VERSION" != "" ]; then
drush dl $PROJECT_NAME-$PROJECT_STABLE_VERSION -y
PATCH_FILE_NAME=""
fi
- drush en $PROJECT_NAME -y
- drush vrc "http://127.0.0.1:8080/" $PATCH_FILE_NAME --preset_category=CI-regression
- |
if [ "$PATCH_FILE_URL" != "" ]; then
cd sites/all/modules/$PROJECT_NAME
echo "Applying PATCH $PATCH_FILE_URL"
wget $PATCH_FILE_URL
PATCH_FILE_NAME=$(basename "$PATCH_FILE_URL")
patch -p1 < $PATCH_FILE_NAME
cd ../../../../
elif [ "$PROJECT_STABLE_VERSION" != "" ]; then
drush dl $PROJECT_NAME-$PROJECT_DEV_VERSION -y
PATCH_FILE_NAME=""
fi
- drush updb -y
- drush cc all
- drush vrc "http://127.0.0.1:8080/" "$PATCH_FILE_NAME" --preset_category=CI-regression
- drush vr-diff
- drush vset --yes drulenium_vr_api_secret $DRULENIUM_ORG_API_SECRET -q
- drush dl gitlab_api_client-7.x-1.x-dev drulenium_gitlab-7.x-1.x-dev -y
- drush en gitlab_api_client drulenium_gitlab -y
- drush vset --yes gitlab_project "$CI_PROJECT_PATH"
- drush vset --yes gitlab_build_id $CI_BUILD_ID
- drush vr-diff-upload --project_id=$DRULENIUM_ORG_PROJECT_UUID
- cd ..
- mv docroot/sites/default/files/drulenium .
except:
- master
artifacts:
name: "drulenium-artifacts"
paths:
- drulenium
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment