forked from vejle-idraetshoejskole/web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
127 lines (105 loc) · 4.61 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
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
47
48
49
50
51
52
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
sudo: required
dist: trusty
language: php
cache:
bundler: true
apt: true
directories:
- "$HOME/.composer/cache"
- "$HOME/.drush/cache"
- "$HOME/.npm"
php:
- 7.1
env:
- VERSION=LIGHTNING TEST_TAGS=lightning PROFILE_NAME=lightning
- VERSION=SUBPROFILE TEST_TAGS=~search PROFILE_NAME=subprofile
addons:
apt:
packages:
# Dependencies for Chrome.
- libappindicator1
- fonts-liberation
before_install:
- phpenv config-rm xdebug.ini
- composer self-update
- composer --version
# Initialize xvfb (see https://docs.travis-ci.com/user/gui-and-headless-browsers)
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sleep 3
# Download Chrome Driver
- LATEST_CHROMEDRIVER=$(wget -q -O - http://chromedriver.storage.googleapis.com/LATEST_RELEASE)
- wget http://chromedriver.storage.googleapis.com/$LATEST_CHROMEDRIVER/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip
- chmod +x chromedriver
- mkdir -p $HOME/.composer/vendor/bin
- mv -f chromedriver $HOME/.composer/vendor/bin/
- rm chromedriver_linux64.zip
# Update Chrome.
- export CHROME_BIN=/usr/bin/google-chrome
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo dpkg -i google-chrome-stable_current_amd64.deb
- rm google-chrome-stable_current_amd64.deb
- google-chrome --version
install:
# Add Composer's local bin directory to the PATH so that we will be running
# our installed versions of Drush, PHPCS, Behat, PhantomJS, etc.
- export PATH="$HOME/.composer/vendor/bin:$TRAVIS_BUILD_DIR/vendor/bin:$PATH"
# Create the MySQL database and add a user for testing.
- mysql -u root -e "CREATE DATABASE drupal; CREATE USER 'lightning'@'localhost' IDENTIFIED BY 'lightning'; GRANT ALL ON drupal.* TO 'lightning'@'localhost';"
# PHP conf tweaks
- echo 'max_execution_time = 120' >> drupal.php.ini;
- echo 'sendmail_path = /bin/true' >> drupal.php.ini;
- phpenv config-add drupal.php.ini
- phpenv rehash
# Add Devel, which is a dependency of Lightning Dev, to the codebase
- composer require drupal/devel --no-update
# Build the Lightning code base.
- composer install
# Create custom sub-profile and download custom tests. We need Lightning to be
# installed foe the sub-profile command to run. But we will reinstall later
# and run the update.
- 'if [ $VERSION = "SUBPROFILE" ]; then
cd $TRAVIS_BUILD_DIR/docroot;
drush site-install lightning --yes --account-pass=admin --db-url=mysql://lightning:lightning@127.0.0.1/drupal;
cd $TRAVIS_BUILD_DIR;
composer require drupal/paragraphs;
drupal lightning:subprofile --no-interaction --name="Lightning Extender" --machine-name=subprofile --include=paragraphs --exclude=lightning_search;
mkdir -p ./tests/features;
curl -o tests/features/subprofile.feature https://gist.githubusercontent.com/balsama/c8c03bb21f7a91a1a87d01ef185a3955/raw;
chmod +w ./docroot/sites/default/settings.php;
fi;'
# Install Lightning.
- cd $TRAVIS_BUILD_DIR/docroot
- drush site-install $PROFILE_NAME --yes --account-pass=admin --db-url=mysql://lightning:lightning@127.0.0.1/drupal
- drush config-set system.logging error_level all --yes
# Enable the dev module which will perform any manual update steps needed
# during database updates.
- drush pm-enable lightning_dev --yes
# Record the version of Lightning for the Configuration Updates.
- UPDATE_FROM=$(drupal lightning:version)
# Update codebase to head and run db updates.
- cd $TRAVIS_BUILD_DIR
- composer nuke
- composer require acquia/lightning:dev-8.x-3.x --no-update
- composer update
- drupal cache:rebuild all
- drush updatedb --yes
- drupal update:lightning $UPDATE_FROM --no-interaction
# Generate the behat config.
- cd $TRAVIS_BUILD_DIR
- drupal behat:init http://127.0.0.1:8080 --merge=../docroot/profiles/contrib/lightning/tests/behat.yml
- drupal behat:include ../docroot/profiles/contrib/lightning/tests/features --with-subcontexts=../docroot/profiles/contrib/lightning/tests/features/bootstrap --with-subcontexts=../docroot/profiles/contrib/lightning/src/LightningExtension/Context
- if [ $VERSION = "SUBPROFILE" ]; then drupal behat:include ../tests/features; fi;
- cd $TRAVIS_BUILD_DIR/docroot
before_script:
- drush runserver --default-server=builtin 8080 &>/dev/null &
# Start Selenium and dump its ginormous log into a temporary file.
- jdk_switcher use oraclejdk8
- mkdir tmp
- selenium-server-standalone -port 4444 -log tmp/selenium2.log &
- sleep 5
script:
- behat --strict --stop-on-failure --config ./sites/default/files/behat.yml --tags=${TEST_TAGS}
matrix:
fast_finish: true