-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #213 from mautic/set-up-travis-v3
Set up Travis for Mautic 3
- Loading branch information
Showing
6 changed files
with
210 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ | |
/tests/phpunit.phar | ||
/vendor | ||
.DS_Store | ||
/.ddev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
language: php | ||
|
||
services: | ||
- mysql | ||
|
||
php: | ||
- 7.3 | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache | ||
|
||
before_install: | ||
# increase memory limit for all PHP processes | ||
- echo "memory_limit=4G" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini | ||
|
||
# turn off XDebug | ||
- phpenv config-rm xdebug.ini || return | ||
|
||
# install dependencies in parallel | ||
- travis_retry composer global require hirak/prestissimo | ||
|
||
# set to test environment for Symfony's commands in post install commands | ||
- export SYMFONY_ENV="test" | ||
|
||
install: | ||
- composer install | ||
|
||
# Everything under before_script is to set up Apache so we have an HTTP server for API tests | ||
before_script: | ||
- sudo apt-get update | ||
- sudo apt-get install apache2 libapache2-mod-fastcgi | ||
# enable php-fpm | ||
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf | ||
- sudo a2enmod rewrite actions fastcgi alias | ||
- echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini | ||
- sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars | ||
- sudo chown -R travis:travis /var/lib/apache2/fastcgi | ||
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm | ||
# configure apache virtual hosts | ||
- sudo cp -f travis/travis-ci-apache /etc/apache2/sites-available/000-default.conf | ||
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf | ||
- sudo service apache2 restart | ||
|
||
jobs: | ||
include: | ||
- stage: test | ||
name: PHPUnit | ||
script: | ||
# Copy our API library config into the tests/ folder | ||
- cp -a travis/local.config.php.dist tests/local.config.php | ||
|
||
# Clone Mautic 3.x branch from GitHub | ||
- git clone -b 3.x --single-branch --depth 1 https://github.com/mautic/mautic.git mautic | ||
|
||
# Copy our configuration file into the Mautic folder. | ||
- cp -a travis/overrides/app/config/local.php.dist mautic/app/config/local.php | ||
|
||
# Install Mautic | ||
- cd mautic | ||
- composer install | ||
- php bin/console doctrine:database:create --no-interaction | ||
- php bin/console mautic:install:data --force | ||
|
||
# Enable Twilio plugin with random credentials (needed for MessagesTest to function, doesn't actually contact Twilio API), terminate Travis when an error occurs here. | ||
- mysql -e "USE mautictest; INSERT INTO plugin_integration_settings (id, plugin_id, name, is_published, supported_features, api_keys, feature_settings) VALUES (2, NULL, 'Twilio', 1, 'a:0:{}', 'a:2:{s:8:\"username\";s:169:\"bzFmNlIydWRSZXlIN2lQVkdpanJ4aTQ2NUh6RVdDbHlLRVhsWGZ4b0kyZVNxLzYrQ1J6V1RvMnlhVEp0c245TEp6eStQekx5ZVhLWjB1YVdoR3RnR2dHQ3k1emVVdGt5NzZKUmtjUnJ3c1E9|L8tbZRIYhwatT7Mq+HAdYA==\";s:8:\"password\";s:169:\"T2d2cFpXQWE5YVZnNFFianJSYURRYUtGRHBNZGZjM1VETXg2Wm5Va3NheW43MjVWUlJhTVlCL2pYMDBpbElONStiVVBNbEM3M3BaeGJMNkFKNUFEN1pTNldSRjc4bUM4SDh1SE9OY1k5MTg9|TeuSvfx4XSUOvp0O7T49Cg==\";}', 'a:4:{s:20:\"sending_phone_number\";N;s:22:\"disable_trackable_urls\";i:0;s:16:\"frequency_number\";N;s:14:\"frequency_time\";N;}');" || travis_terminate 1; | ||
|
||
# Warm up cache. | ||
- php bin/console cache:warmup --no-interaction --env=dev | ||
|
||
# Continue Mautic installation | ||
- php bin/console mautic:plugins:reload | ||
- php bin/console doctrine:migrations:version --add --all --no-interaction | ||
|
||
# Back to api-library directory | ||
- cd ../ | ||
- vendor/bin/phpunit --fail-on-warning | ||
- | ||
name: CS Fixer | ||
script: vendor/bin/php-cs-fixer fix --config=.php_cs -v --dry-run --using-cache=no --show-progress=dots --diff $(git diff -- '*.php' --name-only --diff-filter=ACMRTUXB "${TRAVIS_COMMIT_RANGE}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Authentication/Authorization Method | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Specifies which Class to use when creating the Auth class | ||
| | ||
| Currently supported values are: | ||
| OAuth - Uses the default OAuth class | ||
| BasicAuth - Uses Basic Authentication - Mautic >= 2.4 | ||
| | ||
| Pass this as the second parameter to specify which to use. | ||
| | ||
| If commented out, will default OAuth. see MauticApiTestCase::getAuth() | ||
| | ||
*/ | ||
'AuthMethod' => 'BasicAuth', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Basic Authentication credentials | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Basic Auth uses a simple username password method. | ||
| | ||
| It's important to note, that this is not recommended unless you are | ||
| using HTTPS as your username and password are exposed. | ||
| | ||
| BOTH the username and password are required. It's recommended that | ||
| you add a specific user and ensure a long passPhrase! | ||
| | ||
*/ | ||
'userName' => 'admin', | ||
'password' => 'mautic', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| OAuth credentials | ||
|-------------------------------------------------------------------------- | ||
| | ||
| The API supports both OAuth1a and OAuth2. | ||
| | ||
| I've found there is more control if you specify which version you want | ||
| to use. | ||
| | ||
| Required mainly for OAuth 1a testing; 'OAuth1a' or 'OAuth2' | ||
| | ||
*/ | ||
'version' => 'OAuth1a', | ||
|
||
// Required for OAuth1a and OAuth2 | ||
'baseUrl' => 'http://localhost/mautic/index_dev.php', | ||
|
||
// Required for All tests | ||
'apiUrl' => 'http://localhost/mautic/index_dev.php/api/', | ||
// Required for EmailsTest | ||
'testEmail' => 'notexisting@email.com', | ||
|
||
// Required for both OAuth 1a and 2 testing | ||
'accessToken' => '', | ||
|
||
// Required only for OAuth 1a testing | ||
'accessTokenSecret' => '', | ||
'requestTokenUrl' => '', // Set with any string to force the library to use the OAuth1.a spec; leave blank to use OAuth2 | ||
'clientKey' => '', | ||
'clientSecret' => '', | ||
'callback' => '', | ||
|
||
// Required only for OAuth 2 testing. | ||
'refreshToken' => '', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
/** | ||
* Travis parameter overrides. | ||
*/ | ||
$parameters = [ | ||
'api_enabled' => true, | ||
'api_enable_basic_auth' => true, | ||
'debug' => true, | ||
'rss_notification_url' => null, | ||
'db_driver' => 'pdo_mysql', | ||
'db_table_prefix' => '', | ||
'db_host' => 'localhost', | ||
'db_port' => '3306', | ||
'db_name' => 'mautictest', | ||
'db_user' => 'root', | ||
'db_password' => '', | ||
'site_url' => 'http://localhost/mautic', | ||
'mailer_from_name' => 'Travis', | ||
'mailer_from_email' => 'travis@mautic.org', | ||
'mailer_transport' => 'smtp', | ||
'mailer_host' => '127.0.0.1', | ||
'mailer_port' => '25', | ||
'mailer_user' => null, | ||
'mailer_password' => null, | ||
'mailer_encryption' => null, | ||
'mailer_auth_mode' => null, | ||
'mailer_spool_type' => 'file', | ||
'mailer_spool_path' => '%kernel.root_dir%/spool', | ||
'secret_key' => '176c253f9f3f3c340d1169ba8f89c99a18ff04778eb064ac5197e772af472fe0' | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<VirtualHost *:80> | ||
DocumentRoot %TRAVIS_BUILD_DIR% | ||
|
||
<Directory "%TRAVIS_BUILD_DIR%/"> | ||
Options FollowSymLinks MultiViews ExecCGI | ||
AllowOverride All | ||
Require all granted | ||
</Directory> | ||
|
||
# Wire up Apache to use Travis CI's php-fpm. | ||
<IfModule mod_fastcgi.c> | ||
AddHandler php5-fcgi .php | ||
Action php5-fcgi /php5-fcgi | ||
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi | ||
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization | ||
|
||
<Directory /usr/lib/cgi-bin> | ||
Require all granted | ||
</Directory> | ||
</IfModule> | ||
</VirtualHost> |