Skip to content

Commit 64584f0

Browse files
committed
Add Travis CI configuration
1 parent cfe3b7d commit 64584f0

File tree

4 files changed

+169
-1
lines changed

4 files changed

+169
-1
lines changed

.travis.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
sudo: required
2+
dist: trusty
3+
group: edge
4+
addons:
5+
apt:
6+
packages:
7+
- mysql-server-5.6
8+
- mysql-client-core-5.6
9+
- mysql-client-5.6
10+
- postfix
11+
hosts:
12+
- magento2.travis
13+
language: php
14+
matrix:
15+
include:
16+
- php: 7.2
17+
env:
18+
- MAGENTO_VERSION=2.3
19+
- TEST_SUITE=integration
20+
- php: 7.2
21+
env:
22+
- MAGENTO_VERSION=2.3-develop
23+
- TEST_SUITE=integration
24+
- php: 7.1
25+
env:
26+
- MAGENTO_VERSION=2.3-develop
27+
- TEST_SUITE=integration
28+
- php: 7.1
29+
env:
30+
- MAGENTO_VERSION=2.2-develop
31+
- TEST_SUITE=integration
32+
- php: 7.1
33+
env:
34+
- MAGENTO_VERSION=2.2.7
35+
- TEST_SUITE=integration
36+
env:
37+
global:
38+
- COMPOSER_BIN_DIR=~/bin
39+
- COMPOSER_PACKAGE_NAME=integer-net/magento2-session-unblocker
40+
cache:
41+
apt: true
42+
directories:
43+
- $HOME/.composer/cache
44+
before_script: ./.travis/before_script.sh
45+
script: phpunit -c magento2/dev/tests/$TEST_SUITE

.travis/before_script.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit code $?' ERR
5+
6+
# mock mail
7+
sudo service postfix stop
8+
echo # print a newline
9+
smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &
10+
echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/sendmail.ini
11+
12+
# disable xdebug and adjust memory limit
13+
echo > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
14+
echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
15+
phpenv rehash;
16+
17+
composer selfupdate
18+
19+
# clone main magento github repository
20+
git clone --branch $MAGENTO_VERSION --depth=1 https://github.com/magento/magento2
21+
22+
# install Magento
23+
cd magento2
24+
25+
# add composer package under test, composer require will trigger update/install
26+
composer config minimum-stability dev
27+
composer config repositories.travis_to_test git https://github.com/$TRAVIS_REPO_SLUG.git
28+
composer require ${COMPOSER_PACKAGE_NAME}:dev-${TRAVIS_BRANCH}\#{$TRAVIS_COMMIT}
29+
30+
# prepare for test suite
31+
case $TEST_SUITE in
32+
integration)
33+
cp vendor/$COMPOSER_PACKAGE_NAME/Test/Integration/phpunit.xml.dist dev/tests/integration/phpunit.xml
34+
35+
cd dev/tests/integration
36+
37+
# create database and move db config into place
38+
mysql -uroot -e '
39+
SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION;
40+
CREATE DATABASE magento_integration_tests;
41+
'
42+
cp etc/install-config-mysql.travis.php.dist etc/install-config-mysql.php
43+
sed -i '/amqp/d' etc/install-config-mysql.php
44+
45+
cd ../../..
46+
;;
47+
unit)
48+
cp vendor/$COMPOSER_PACKAGE_NAME/Test/Unit/phpunit.xml.dist dev/tests/unit/phpunit.xml
49+
;;
50+
esac

Test/Integration/phpunit.xml.dist

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.2/phpunit.xsd"
10+
colors="true"
11+
beStrictAboutTestsThatDoNotTestAnything="false"
12+
bootstrap="./framework/bootstrap.php"
13+
stderr="true"
14+
>
15+
<!-- Test suites definition -->
16+
<testsuites>
17+
<testsuite name="SessionUnblocker Integration Tests">
18+
<directory suffix="Test.php">../../../vendor/integer-net/magento2-session-unblocker/Test/Integration</directory>
19+
</testsuite>
20+
</testsuites>
21+
<!-- Code coverage filters -->
22+
<filter>
23+
<whitelist addUncoveredFilesFromWhiteList="true">
24+
<directory suffix=".php">../../../vendor/integer-net/magento2-session-unblocker</directory>
25+
<exclude>
26+
<directory>../../../vendor/integer-net/magento2-session-unblocker/Test</directory>
27+
</exclude>
28+
</whitelist>
29+
</filter>
30+
<!-- PHP INI settings and constants definition -->
31+
<php>
32+
<includePath>.</includePath>
33+
<includePath>testsuite</includePath>
34+
<ini name="date.timezone" value="America/Los_Angeles"/>
35+
<ini name="xdebug.max_nesting_level" value="200"/>
36+
<!-- Local XML configuration file ('.dist' extension will be added, if the specified file doesn't exist) -->
37+
<const name="TESTS_INSTALL_CONFIG_FILE" value="etc/install-config-mysql.php"/>
38+
<!-- Local XML configuration file ('.dist' extension will be added, if the specified file doesn't exist) -->
39+
<const name="TESTS_GLOBAL_CONFIG_FILE" value="etc/config-global.php"/>
40+
<!-- Semicolon-separated 'glob' patterns, that match global XML configuration files -->
41+
<const name="TESTS_GLOBAL_CONFIG_DIR" value="../../../app/etc"/>
42+
<!-- Whether to cleanup the application before running tests or not -->
43+
<!--<const name="TESTS_CLEANUP" value="enabled"/>-->
44+
<const name="TESTS_CLEANUP" value="enabled" />
45+
<!-- Memory usage and estimated leaks thresholds -->
46+
<!--<const name="TESTS_MEM_USAGE_LIMIT" value="1024M"/>-->
47+
<const name="TESTS_MEM_LEAK_LIMIT" value=""/>
48+
<!-- Whether to output all CLI commands executed by the bootstrap and tests -->
49+
<!--<const name="TESTS_EXTRA_VERBOSE_LOG" value="1"/>-->
50+
<!-- Path to Percona Toolkit bin directory -->
51+
<!--<const name="PERCONA_TOOLKIT_BIN_DIR" value=""/>-->
52+
<!-- CSV Profiler Output file -->
53+
<!--<const name="TESTS_PROFILER_FILE" value="profiler.csv"/>-->
54+
<!-- Bamboo compatible CSV Profiler Output file name -->
55+
<!--<const name="TESTS_BAMBOO_PROFILER_FILE" value="profiler.csv"/>-->
56+
<!-- Metrics for Bamboo Profiler Output in PHP file that returns array -->
57+
<!--<const name="TESTS_BAMBOO_PROFILER_METRICS_FILE" value="../../build/profiler_metrics.php"/>-->
58+
<!-- Whether to output all CLI commands executed by the bootstrap and tests -->
59+
<const name="TESTS_EXTRA_VERBOSE_LOG" value="1"/>
60+
<!-- Magento mode for tests execution. Possible values are "default", "developer" and "production". -->
61+
<const name="TESTS_MAGENTO_MODE" value="developer"/>
62+
<!-- Minimum error log level to listen for. Possible values: -1 ignore all errors, and level constants form http://tools.ietf.org/html/rfc5424 standard -->
63+
<const name="TESTS_ERROR_LOG_LISTENER_LEVEL" value="-1"/>
64+
<!-- Connection parameters for MongoDB library tests -->
65+
<!--<const name="MONGODB_CONNECTION_STRING" value="mongodb://localhost:27017"/>-->
66+
<!--<const name="MONGODB_DATABASE_NAME" value="magento_integration_tests"/>-->
67+
</php>
68+
<!-- Test listeners -->
69+
<listeners>
70+
<listener class="Magento\TestFramework\Event\PhpUnit"/>
71+
<listener class="Magento\TestFramework\ErrorLog\Listener"/>
72+
</listeners>
73+
</phpunit>

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"magento/framework": "^100.1|^101.0|^102.0",
1717
"magento/module-customer": "^101.0.0|^102.0.0",
1818
"magento/module-catalog": "^101.0.0|^102.0.0|^103.0",
19-
"php": ">=7.0.0"
19+
"php": ">=7.1.0"
2020
},
2121
"type": "magento2-module",
2222
"license": [

0 commit comments

Comments
 (0)