.gitlab-ci.yml 4.3 KB
1 2 3 4 5 6 7 8 9 10
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
11
   - apt-get install default-jre -yqq # Immediately after apt-get update to avoid E: Failed to fetch http://httpredir.debian.org/debian/pool/mai
12
   - apt-get install git wget jq -yqq
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46

   # 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 &
47
   - drush dl drulenium -y
48 49 50 51
   - 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'
52
   - drush vset --yes drulenium_vr_config_image_server_opt 'drulenium_local_selenium'
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
   - 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