forked from mkalkbrenner/search_api_integration_tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
127 lines (118 loc) · 6.27 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
language: php
cache:
bundler: true
directories:
- $HOME/tmp/drush
- $HOME/.bundle
- $HOME/.composer
- $HOME/downloads
apt: true
git:
depth: 10000
php:
- 7.0
- 5.6
- 5.5
# This creates a build with each php environment. 6 builds in total.
env:
- PATH=$PATH:/home/travis/.composer/vendor/bin SOLR_VERSION=4.5.1 SOLR_CORE=d8 SOLR_CONFS="$TRAVIS_BUILD_DIR/../drupal/modules/search_api_solr/solr-conf/4.x"
- PATH=$PATH:/home/travis/.composer/vendor/bin SOLR_VERSION=5.5.1 SOLR_CORE=d8 SOLR_CONFS="$TRAVIS_BUILD_DIR/../drupal/modules/search_api_solr/solr-conf/5.x"
- PATH=$PATH:/home/travis/.composer/vendor/bin SOLR_VERSION=6.2.1 SOLR_CORE=d8 SOLR_CONFS="$TRAVIS_BUILD_DIR/../drupal/modules/search_api_solr/solr-conf/6.x"
notifications:
email:
- remus@gmx.net
irc:
- "chat.freenode.net#drupal-search-api"
# This will create the database
mysql:
database: drupal
username: root
encoding: utf8
# To be able to run a webbrowser
# If we need anything more powerful
# than e.g. phantomjs
before_install:
- phpenv config-rm xdebug.ini
- composer self-update
- composer global require "hirak/prestissimo:^0.3"
- sudo apt-get update -qq > /dev/null
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- "phantomjs --version"
install:
# Make sure we don't fail when checking out projects
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- echo -e "Host git.drupal.org\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
# Set sendmail so drush doesn't throw an error during site install.
- echo "sendmail_path='true'" >> `php --ini | grep "Loaded Configuration" | awk '{print $4}'`
# Forward the errors to the syslog so we can print them
- echo "error_log=syslog" >> `php --ini | grep "Loaded Configuration" | awk '{print $4}'`
# Get latest Drupal 8 core
- cd $TRAVIS_BUILD_DIR/..
- git clone --branch 8.2.x https://git.drupal.org/project/drupal.git
- cd $TRAVIS_BUILD_DIR/../drupal
- composer install
- composer config repositories.drupal composer https://packages.drupal.org/8
- composer require drupal/search_api:1.x-dev
- composer require drupal/search_api_solr:1.x-dev
- composer require drupal/search_api_solr_multilingual:1.x-dev
- composer require drupal/facets:1.x-dev
- composer require drush/drush
# Patch template.
#########################################
# to be removed once #2821955 is resolved
#- cd modules/search_api
#- curl https://www.drupal.org/files/issues/2821955_6.patch | patch -p1
#- cd $TRAVIS_BUILD_DIR/../drupal
#########################################
# to be removed once https://github.com/drush-ops/drush/pull/2420 is approved
- cd $TRAVIS_BUILD_DIR/../drupal/vendor/drush/drush
- curl https://gist.githubusercontent.com/itsekhmistro/30ced918a45de48a3543e6fc5d0d3098/raw/ed2da17268507ca12909f0ff684a38fccef7b259/d8-rs-router.fix-q.patch | patch -p1
- cd $TRAVIS_BUILD_DIR/../drupal
#########################################
before_script:
# Start the built-in php web server (mysql is already started) and
# suppress web-server access logs output.
- php -S localhost:8888 ./vendor/drush/drush/commands/runserver/d8-rs-router.php >& /dev/null &
# Install the site
- ./vendor/bin/drush -v site-install minimal --db-url=mysql://root:@localhost/drupal --yes
- ./vendor/bin/drush en --yes simpletest
# Generate a multilingual Solr configuration.
# Therefore we have to install the test modules before the tests.
- cp -R core/modules/system/tests/modules/entity_test core/modules/system/entity_test
- cp -R modules/search_api/tests/search_api_test_example_content modules/search_api/search_api_test_example_content
- cp -R modules/search_api_solr_multilingual/tests/modules/search_api_solr_multilingual_test modules/search_api_solr_multilingual/search_api_solr_multilingual_test
- ./vendor/bin/drush en --yes search_api_solr_multilingual_test
- ./vendor/bin/drush sasm-gsc solr_multilingual_search_server conf.zip $SOLR_VERSION
- unzip -o conf.zip -d $SOLR_CONFS
- ls -lh $SOLR_CONFS
# Install Solr
- cat modules/search_api_solr/travis-solr.sh | bash
# start phantomjs with gastonjs
- phantomjs --ssl-protocol=any --ignore-ssl-errors=true ../vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1600 1080 > /tmp/pantomjs.out 2>&1 &
script:
# Run the tests
- cd $TRAVIS_BUILD_DIR/../drupal
- export SIMPLETEST_DB=mysql://root:@localhost/drupal
- export SIMPLETEST_BASE_URL=http://localhost:8888
- php core/scripts/run-tests.sh --verbose --color --non-html --concurrency 8 --php `which php` --url http://localhost:8888 --directory modules --types Simpletest | tee /tmp/test.txt | grep passes; export TEST_EXIT=${PIPESTATUS[0]} ; echo $TEST_EXIT
- cd $TRAVIS_BUILD_DIR/../drupal
- ./vendor/bin/phpunit -c core --group search_api,facets,search_api_solr,search_api_solr_multilingual --verbose | tee ; export TEST_PHPUNIT=${PIPESTATUS[0]} ; echo $TEST_PHPUNIT
#- ./vendor/bin/phpunit --group search_api_solr_multilingual -c "../modules/search_api_solr/phpunit.xml.travis" --verbose --debug --coverage-text | tee ; export TEST_PHPUNIT=${PIPESTATUS[0]} ; echo $TEST_PHPUNIT
# if the TEST_EXIT status is 0 AND the TEST_OUTPUT status is also 0 it means we succeeded, in all other cases we
# failed.
# Re-enable when trying to get CodeSniffer doesn't return a 403 anymore.
#- /home/travis/.composer/vendor/bin/phpcs --standard=/home/travis/.composer/vendor/drupal/coder/coder_sniffer/Drupal --extensions=php,inc,test,module,install --ignore=css/ $TRAVIS_BUILD_DIR/../drupal/modules/search_api_multilingual
#- php -i | grep 'php.ini'
# Check if we had fails in the run-tests.sh script
# Exit with the inverted value, because if there are no fails found, it will exit with 1 and for us that\
# is a good thing so invert it to 0. Travis has some issues with the exclamation mark in front so we have to fiddle a
# bit.
# Also make the grep case insensitive and fail on run-tests.sh regular fails as well on fatal errors.
- TEST_OUTPUT=$(! egrep -i "([0-9]+ fails)|(Fatal erro)|([0-9]+ exceptions)" /tmp/test.txt > /dev/null)$?
# Exit the build
- echo $TEST_EXIT
- echo $TEST_OUTPUT
- echo $TEST_PHPUNIT
- if [ $TEST_EXIT -ne 0 ]; then cat /tmp/test.txt; fi
- if [ $TEST_EXIT -eq 0 ] && [ $TEST_OUTPUT -eq 0 ] && [ $TEST_PHPUNIT -eq 0 ]; then exit 0; else exit 1; fi