-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
75 lines (60 loc) · 2.45 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
language: php
php:
- 5.6
- 7
env:
global:
- MODULE_NAME='invisible_recaptcha'
- MODULE_TEST_GROUP='invisible_recaptcha'
- DRUPAL_VERSION='^8.4.0'
cache:
directories:
- $HOME/.composer/cache/files
before_install:
# Ensure we have the latest sources.
- sudo apt-get -y update
# Composer.
- sed -i '1i export PATH="$HOME/.composer/vendor/bin:$PATH"' $HOME/.bashrc
- source $HOME/.bashrc
- composer self-update
# Drush.
- composer global require "youngj/httpserver:dev-master#41dd2b7"
- composer global require drush/drush:dev-master
# Coder.
- composer global require drupal/coder:^8.2.12
- composer global require dealerdirect/phpcodesniffer-composer-installer
- phpcs -i
# Ensure the PHP environment is ready.
- phpenv rehash
install:
# Basic PHP packages.
- sudo apt-get install -y --force-yes php5-cgi php5-mysql
# NodeJS, NPM, ESLint
- sudo apt-get install -y --force-yes npm
- sudo npm i -g eslint && sudo ln -s /usr/bin/nodejs /usr/bin/node
- sudo npm i -g eslint-config-airbnb
# Move the checked out module into the correct structure.
- mkdir /tmp/$MODULE_NAME
- mv * /tmp/$MODULE_NAME/
- composer require drupal/drupal:$DRUPAL_VERSION
- mv ./vendor/drupal/drupal ./drupal
- mv /tmp/$MODULE_NAME drupal/modules/
before_script:
# This fixes a fail when install Drupal.
- echo 'sendmail_path = /bin/true' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
# Install Drupal and enable the required modules (including this one).
- mysql -e 'create database drupal;'
- cd $TRAVIS_BUILD_DIR/drupal && composer install
- cd $TRAVIS_BUILD_DIR/drupal && drush --yes site-install testing --db-url="mysql://[email protected]/drupal"
- cd $TRAVIS_BUILD_DIR/drupal && drush --yes en $MODULE_NAME
- cd $TRAVIS_BUILD_DIR/drupal && drush --yes en simpletest
# Start a web server.
- drush runserver 127.0.0.1:8080 &
- until netstat -an 2>/dev/null | grep '8080.*LISTEN'; do true; done
script:
- phpcs --report=full --standard=Drupal,DrupalPractice $TRAVIS_BUILD_DIR/drupal/modules/$MODULE_NAME
- cd $TRAVIS_BUILD_DIR/drupal/modules/$MODULE_NAME/js
- ls . | grep '.*\.es6\.js' | xargs eslint --color -c $TRAVIS_BUILD_DIR/drupal/core/.eslintrc.json
- cd $TRAVIS_BUILD_DIR/drupal
# Run the tests.
- if [ $MODULE_TEST_GROUP ] ; then php $TRAVIS_BUILD_DIR/drupal/core/scripts/run-tests.sh --php `which php` --concurrency 12 --url http://127.0.0.1:8080 --color "$MODULE_TEST_GROUP" ; fi