forked from astorm/pestle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
124 lines (116 loc) · 5.67 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
env:
#global environmental variables control magento install parameters
#see also hosts in addons
global:
- PULSESTORM_MAGE2_FAKE_URL=http://magento-2-travis.dev
- PULSESTORM_MAGE2_ADMIN_FIRST_NAME=Alan
- PULSESTORM_MAGE2_ADMIN_LAST_NAME=Storm
- PULSESTORM_MAGE2_ADMIN_USERNAME=astorm
- PULSESTORM_MAGE2_ADMIN_PASSWORD=ih3artmagento
- PULSESTORM_MAGE2_ADMIN_DBNAME=magento_2_travis
- PULSESTORM_PESTLE_URL=http://pestle.pulsestorm.net
#- [email protected]:astorm/pestle.git
- PULSESTORM_COMPOSER_REPOSITORY_TO_TEST=https://github.com/astorm/pestle/
- PULSESTORM_COMPOSER_PACKAGE_TO_TEST=pulsestorm/pestle
addons:
hosts:
# should match PULSESTORM_MAGE2_FAKE_URL above
- magento-2-travis.dev
language: php
sudo: required
dist: trusty
php:
- 7.1
before_script:
#- env
# 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
#
# composer started complaining about not having this
- mkdir ~/.composer
- echo "{}" > ~/.composer/composer.json
# 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
- BRANCH_SHA=`git rev-parse $TRAVIS_BRANCH`
# clone main magento github repository
- git clone -b 2.3 https://github.com/magento/magento2
# install Magento
- cd magento2
# switch to specific branch in you like
#- git checkout 2.0;git checkout tags/2.0.2
# add composer package under test, composer require will trigger update/install
- composer config repositories.travis_to_test git $PULSESTORM_COMPOSER_REPOSITORY_TO_TEST
- cat composer.json
#- env
- composer require $PULSESTORM_COMPOSER_PACKAGE_TO_TEST dev-master#$BRANCH_SHA -vvv
# 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"
# leave m2 folder
- cd ..
# install phpcs
- mkdir phpcs/
- cd phpcs/
- echo "{}" > composer.json
- composer require magento/magento-coding-standard -vvv
# return to the base folder and composer install pestle,
# build/install latest
- cd ..
- composer install
- php -d phar.readonly=0 vendor/bin/phing package_phar
- sudo mv pestle.phar /usr/bin
- sudo chmod +x /usr/bin/pestle.phar
- pestle.phar hello_world
# cd to magento 2 folder, generate the code for phpcs and leave
- cd magento2
- ../travis/for-lint.sh
- cd ..
script:
# unit tests
- vendor/bin/phpunit tests
# integration tests
- cd magento2
- vendor/bin/phpunit vendor/pulsestorm/pestle/tests-integration
# run phpcs
- cd ../phpcs
- find ../magento2/app/code/Pulsestorm
- vendor/bin/phpcs vendor/bin/phpcs -s --standard=vendor/magento/magento-coding-standard/Magento2/ ../magento2/app/code/Pulsestorm/Travis