Skip to content

Commit

Permalink
Travis CI integration (#18)
Browse files Browse the repository at this point in the history
Travis CI integration
  • Loading branch information
davpsh authored Jul 3, 2020
1 parent 6dee3ab commit 41d5c1d
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 1 deletion.
97 changes: 97 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
language: php
sudo: false

php:
# - 7.3
# - 7.2
- 7.1

addons:
chrome: stable
apt:
packages:
- chromium-chromedriver

services:
- mysql

env:
global:
- DRUPAL_BUILD_DIR=$TRAVIS_BUILD_DIR/../drupal
- SIMPLETEST_DB=mysql://root:@127.0.0.1/drupal
- PATH="$PATH:$HOME/.composer/vendor/bin"
matrix:
# - DRUPAL_CORE=8.6.x
# - DRUPAL_CORE=8.7.x
- DRUPAL_CORE=8.8.x

matrix:
fast_finish: true

mysql:
database: drupal
username: root
encoding: utf8

# Cache composer downloads.
cache:
directories:
- $HOME/.composer/cache

before_install:
# Disable xdebug.
- phpenv config-rm xdebug.ini
# Update composer.
- composer self-update

- composer global require "hirak/prestissimo:^0.3"
- composer global require "drupal/coder:8.3.*"
- phpcs --config-set installed_paths $HOME/.composer/vendor/drupal/coder/coder_sniffer

install:
# Create the database.
- mysql -e 'create database drupal'

# Download Drupal 8 core from the Github mirror because it is faster.
- git clone --branch $DRUPAL_CORE --depth 1 https://github.com/drupal/drupal.git $DRUPAL_BUILD_DIR

# Reference the module in the build site.
- ln -s $TRAVIS_BUILD_DIR $DRUPAL_BUILD_DIR/modules/commerce_yandex_checkout

# Copy the customized phpunit configuration file to the core directory so
# the relative paths are correct.
- cp $DRUPAL_BUILD_DIR/modules/commerce_yandex_checkout/phpunit.xml.dist $DRUPAL_BUILD_DIR/core/phpunit.xml

# Bring in the module dependencies without requiring a merge plugin. The
# require also triggers a full 'composer install'.
- composer --working-dir=$DRUPAL_BUILD_DIR require drupal/commerce:^2.14
- composer --working-dir=$DRUPAL_BUILD_DIR require yandex-money/yandex-checkout-sdk-php:^1.5

# For Drupal < 8.8 we have to manually upgrade zend-stdlib to avoid PHP 7.3
# incompatibilities.
- if [[ "$DRUPAL_CORE" = "8.6.x" || "$DRUPAL_CORE" = "8.7.x" ]];
then composer --working-dir=$DRUPAL_BUILD_DIR require zendframework/zend-stdlib:3.2.1;
fi

# For Drupal < 8.8 we have to manually upgrade phpunit to avoid PHP 7.3
# incompatibilities.
- if [[ "$DRUPAL_CORE" = "8.6.x" || "$DRUPAL_CORE" = "8.7.x" ]];
then composer --working-dir=$DRUPAL_BUILD_DIR run-script drupal-phpunit-upgrade;
fi

# Start a web server on port 8888, run in the background; wait for
# initialization.
- nohup php -S localhost:8888 > /dev/null 2>&1 &

# Export web server URL for browser tests.
- export SIMPLETEST_BASE_URL=http://localhost:8888

before_script:
# include ChromeDriver in PATH
#- ln --symbolic /usr/lib/chromium-browser/chromedriver "${HOME}/bin/chromedriver"
# start Chrome and listen on localhost
#- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9515 http://localhost &

script:
- phpcs --report=full --colors --standard="Drupal,DrupalPractice" --extensions="php,module,inc,install,test,profile,theme" $TRAVIS_BUILD_DIR
#- $DRUPAL_BUILD_DIR/vendor/bin/phpunit -c $DRUPAL_BUILD_DIR/core/phpunit.xml.dist --verbose $TRAVIS_BUILD_DIR
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "drupal/commerce_yandex_checkout",
"type": "drupal-module",
"description": "Provides Commerce integration for Yandex Checkout.",
"homepage": "",
"homepage": "https://github.com/davpsh/commerce_yandex_checkout",
"require": {
"drupal/commerce": "^2.14",
"yandex-money/yandex-checkout-sdk-php": "^1.5"
Expand Down
23 changes: 23 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="tests/bootstrap.php" colors="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutChangesToGlobalState="true"
checkForUnintentionallyCoveredCode="false"
verbose="true">
<php>
<ini name="error_reporting" value="32767"/>
<ini name="memory_limit" value="-1"/>
<env name="MINK_DRIVER_ARGS_WEBDRIVER" value='["chrome", {"browserName":"chrome","chromeOptions":{"args":["--disable-gpu","--headless", "--no-sandbox", "--disable-dev-shm-usage"]}}, "http://localhost:9515"]'/>
</php>
<filter>
<whitelist>
<directory suffix=".php">../modules/commerce_yandex_checkout</directory>
<exclude>
<directory suffix="Test.php">../modules/commerce_yandex_checkout</directory>
<directory suffix="TestBase.php">../modules/commerce_yandex_checkout</directory>
</exclude>
</whitelist>
</filter>
</phpunit>

0 comments on commit 41d5c1d

Please sign in to comment.