Skip to content

Commit b713714

Browse files
committed
travis
1 parent 2208d7e commit b713714

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed

.travis.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
env:
2+
#global environmental variables control magento instal parameters
3+
#see also hosts in addons.
4+
global:
5+
- PULSESTORM_MAGE2_FAKE_URL=http://magento-2-travis.test
6+
- PULSESTORM_MAGE2_ADMIN_EMAIL=robert.hoffner@example.com
7+
- PULSESTORM_MAGE2_ADMIN_FIRST_NAME=Robert
8+
- PULSESTORM_MAGE2_ADMIN_LAST_NAME=Hoffner
9+
- PULSESTORM_MAGE2_ADMIN_USERNAME=admin
10+
- PULSESTORM_MAGE2_ADMIN_PASSWORD=ih3artmagento
11+
- PULSESTORM_MAGE2_ADMIN_DBNAME=magento_2_travis
12+
- PULSESTORM_PESTLE_URL=http://pestle.pulsestorm.net
13+
- PULSESTORM_COMPOSER_REPOSITORY_TO_TEST=git@github.com:astorm/pestle.git
14+
- PULSESTORM_COMPOSER_PACKAGE_TO_TEST=pulsestorm/pestle
15+
addons:
16+
hosts:
17+
# should match PULSESTORM_MAGE2_FAKE_URL above
18+
- magento-2-travis.dev
19+
language: php
20+
sudo: required
21+
dist: trusty
22+
php:
23+
#- 5.6
24+
- 7.1
25+
- 7.2
26+
before_script:
27+
# some useful debugging stuff for travis
28+
#- curl http://magento-2-travis.dev/index.php
29+
#- curl http://magento-2-travis.dev/
30+
#- sudo find /var/log/apache2 -exec cat '{}' \;
31+
#- sudo cat /etc/apache2/sites-available/000-default.conf
32+
#- sudo cat /etc/apache2/sites-enabled/000-default.conf
33+
#- sudo apachectl -V
34+
#- sudo apache2ctl -V
35+
#- ls -lh $TRAVIS_BUILD_DIR
36+
#- sudo ls /etc/apache2/sites-available
37+
#- sudo ls /etc/apache2/sites-enabled
38+
#- pwd
39+
#
40+
# get latest composer
41+
- composer selfupdate
42+
# disable xdebug for perf
43+
- echo '' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
44+
# add multiverse support to get MySQL 5.6 update apt
45+
- 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"
46+
- sudo apt-get update -qq
47+
# add mysql 5.6
48+
- 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
49+
- sudo apt-get -y -qq autoremove;
50+
- sudo apt-get -y -qq autoclean;
51+
- sudo apt-get install -y -qq mysql-server-5.6 mysql-client-5.6;
52+
- mysql -uroot -e 'SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION; CREATE DATABASE magento_2_travis;';
53+
# add apache
54+
- sudo apt-get install -y -qq apache2 libapache2-mod-fastcgi
55+
# enable php-fpm -- www.conf.default is PHP 7 only, so we dev/null any copy problems
56+
- 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
57+
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
58+
- sudo a2enmod rewrite actions fastcgi alias
59+
- echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
60+
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
61+
# awful hack used during travis debugging that I swear I'm going to remove
62+
# but then again you're reading this so I didn't remove it and **sigh**
63+
- sudo chmod 777 /home /home/travis /home/travis/build
64+
65+
# configure apache virtual hosts, assumes 000-default.conf is there
66+
- sudo cp -f .travis/travis-ci-apache /etc/apache2/sites-available/000-default.conf
67+
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
68+
# restart apache
69+
- sudo service apache2 restart
70+
71+
# clone main magento github repository
72+
- git clone -b 2.3 https://github.com/magento/magento2
73+
# download latest pestle phar and install
74+
- curl -LO "$PULSESTORM_PESTLE_URL/pestle.phar"
75+
- sudo mv pestle.phar /usr/local/bin
76+
- sudo chmod +x /usr/local/bin/pestle.phar
77+
# install Magento
78+
- cd magento2
79+
- composer install --prefer-dist
80+
# switch to specific branch in you like
81+
#- git checkout 2.0;git checkout tags/2.0.2
82+
83+
# Use a github token
84+
- if [ -n "$GH_TOKEN" ]; then composer config github-oauth.github.com ${GH_TOKEN}; fi;
85+
86+
# add composer package under test, composer require will trigger update/install
87+
88+
- composer config repositories.travis_to_test git $PULSESTORM_COMPOSER_REPOSITORY_TO_TEST
89+
- composer require --prefer-dist $PULSESTORM_COMPOSER_PACKAGE_TO_TEST dev-master
90+
91+
# run installation command using evn variables set above
92+
- 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
93+
# test that magento is installed
94+
- curl "$PULSESTORM_MAGE2_FAKE_URL/index.php" > /tmp/output.txt
95+
# test that pestle is working
96+
- pestle.phar hello_world
97+
script: test 'grep -Fx "magento-2-travis.dev" /tmp/output.txt'

0 commit comments

Comments
 (0)