-
Notifications
You must be signed in to change notification settings - Fork 35
/
.travis.yml
93 lines (85 loc) · 4.34 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
env:
#global environmental variables control magento instal parameters
#see also hosts in addons.
global:
- PULSESTORM_MAGE2_FAKE_URL=http://magento-2-travis.test
- PULSESTORM_MAGE2_ADMIN_EMAIL=robert.hoffner@example.com
- PULSESTORM_MAGE2_ADMIN_FIRST_NAME=Robert
- PULSESTORM_MAGE2_ADMIN_LAST_NAME=Hoffner
- PULSESTORM_MAGE2_ADMIN_USERNAME=admin
- PULSESTORM_MAGE2_ADMIN_PASSWORD=ih3artmagento
- PULSESTORM_MAGE2_ADMIN_DBNAME=magento_2_travis
- PULSESTORM_PESTLE_URL=http://pestle.pulsestorm.net
- PULSESTORM_COMPOSER_REPOSITORY_TO_TEST=git@github.com:astorm/pestle.git
- PULSESTORM_COMPOSER_PACKAGE_TO_TEST=pulsestorm/pestle
addons:
hosts:
# should match PULSESTORM_MAGE2_FAKE_URL above
- magento-2-travis.test
language: php
sudo: required
dist: trusty
php:
#- 5.6
- 7.1
- 7.2
before_script:
# some useful debugging stuff for travis
#- curl http://magento-2-travis.dev/index.php
#- curl http://magento-2-travis.dev/
#- sudo find /var/log/apache2 -exec cat '{}' \;
#- sudo cat /etc/apache2/sites-available/000-default.conf
#- sudo cat /etc/apache2/sites-enabled/000-default.conf
#- sudo apachectl -V
#- sudo apache2ctl -V
#- ls -lh $TRAVIS_BUILD_DIR
#- sudo ls /etc/apache2/sites-available
#- sudo ls /etc/apache2/sites-enabled
#- pwd
#
# get latest composer
- composer selfupdate
# disable xdebug for perf
- echo '' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
# add multiverse support to get MySQL 5.6 update apt
- sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ trusty multiverse" && sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ trusty-updates multiverse"
- sudo apt-get update -qq
# add mysql 5.6
- sudo apt-get remove -y -qq --purge mysql-common mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5
- sudo apt-get -y -qq autoremove;
- sudo apt-get -y -qq autoclean;
- sudo apt-get install -y -qq mysql-server-5.6 mysql-client-5.6;
- mysql -uroot -e 'SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION; CREATE DATABASE magento_2_travis;';
# add apache
- sudo apt-get install -y -qq apache2 libapache2-mod-fastcgi
# enable php-fpm -- www.conf.default is PHP 7 only, so we dev/null any copy problems
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf 2>/dev/null || true
- 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
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
# awful hack used during travis debugging that I swear I'm going to remove
# but then again you're reading this so I didn't remove it and **sigh**
- sudo chmod 777 /home /home/travis /home/travis/build
# configure apache virtual hosts, assumes 000-default.conf is there
- 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
# restart apache
- sudo service apache2 restart
# clone main magento github repository
- git clone -b 2.3 https://github.com/magento/magento2
# install Magento
- cd magento2
- git checkout 2.3.2
- composer install --prefer-dist
# switch to specific branch in you like
#- git checkout 2.0;git checkout tags/2.0.2
# Use a github token
- if [ -n "$GH_TOKEN" ]; then composer config github-oauth.github.com ${GH_TOKEN}; fi;
# add composer package under test, composer require will trigger update/install
- composer require deved/magento2-disable-customer-registration:dev-master
# run installation command using evn variables set above
- php bin/magento setup:install --admin-email "$PULSESTORM_MAGE2_ADMIN_EMAIL" --admin-firstname "$PULSESTORM_MAGE2_ADMIN_FIRST_NAME" --admin-lastname "$PULSESTORM_MAGE2_ADMIN_LAST_NAME" --admin-password "$PULSESTORM_MAGE2_ADMIN_PASSWORD" --admin-user "$PULSESTORM_MAGE2_ADMIN_USERNAME" --backend-frontname admin --base-url "$PULSESTORM_MAGE2_FAKE_URL" --db-host 127.0.0.1 --db-name magento_2_travis --db-user root --session-save files --use-rewrites 1 --use-secure 0 -vvv
# test that magento is installed
- curl "$PULSESTORM_MAGE2_FAKE_URL/index.php" > /tmp/output.txt
script: test 'grep -Fx "magento-2-travis.test" /tmp/output.txt'