forked from bolt/bolt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
124 lines (115 loc) · 6.02 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
language: php
php:
- 5.5
- 5.6
- 7.0
- hhvm
matrix:
fast_finish: true
allow_failures:
- php: hhvm
services:
- mysql
- postgresql
addons:
postgresql: "9.3"
before_install:
- sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"
- sudo add-apt-repository -y ppa:nginx/stable
- sudo apt-get update
- sudo apt-get --reinstall install -qq language-pack-en language-pack-fr && sudo locale-gen fr_FR
- sudo apt-get install nginx postfix
# Set up HHVM
- if [[ $TRAVIS_PHP_VERSION =~ ^hhvm ]]; then echo 'xdebug.enable = On' >> /etc/hhvm/php.ini ; fi
- if [[ $TRAVIS_PHP_VERSION =~ ^hhvm ]]; then echo 'hhvm.jit = false' >> /etc/hhvm/php.ini ; fi
- if [[ $TRAVIS_PHP_VERSION =~ ^hhvm ]]; then sudo sh -c 'echo RUN_AS_USER=\"travis\" >> /etc/default/hhvm' ; fi
- if [[ $TRAVIS_PHP_VERSION =~ ^hhvm ]]; then sudo sh -c 'echo RUN_AS_GROUP=\"travis\" >> /etc/default/hhvm' ; fi
- if [[ $TRAVIS_PHP_VERSION =~ ^hhvm ]]; then sudo service hhvm restart ; sleep 1 ; fi
# Set up PHP-FPM
- if [[ $TRAVIS_PHP_VERSION =~ ^[57] ]]; then export PHP_BASE=~/.phpenv/versions/$(phpenv version-name) ; fi
- if [[ $TRAVIS_PHP_VERSION =~ ^[57] ]]; then echo "cgi.fix_pathinfo = 1" >> $PHP_BASE/etc/php.ini ; fi
- if [[ $TRAVIS_PHP_VERSION =~ ^[57] ]]; then sudo cp $PHP_BASE/etc/php-fpm.conf.default $PHP_BASE/etc/php-fpm.conf ; fi
- if [[ $TRAVIS_PHP_VERSION =~ ^5 ]]; then perl -p -i -e 's/nobody/travis/g' $PHP_BASE/etc/php-fpm.conf ; fi
- if [[ $TRAVIS_PHP_VERSION =~ ^7 ]]; then sudo cp $PHP_BASE/etc/php-fpm.d/www.conf.default $PHP_BASE/etc/php-fpm.d/www.conf ; fi
- if [[ $TRAVIS_PHP_VERSION =~ ^7 ]]; then perl -p -i -e 's/nobody/travis/g' $PHP_BASE/etc/php-fpm.d/www.conf ; fi
- if [[ $TRAVIS_PHP_VERSION =~ ^[57] ]]; then sudo $PHP_BASE/sbin/php-fpm ; fi
# Set up Nginx
- cat tests/travis/nginx.conf > nginx.conf
- PWD=$(pwd) ; perl -p -i -e 's/%ROOTDIR%/$ENV{PWD}/g' nginx.conf
- sudo rm -f /etc/nginx/nginx.conf && sudo mv nginx.conf /etc/nginx/nginx.conf
- sudo service nginx restart
# Start postfix
- sudo service postfix restart
# Increase PHP memory limit. Required for Composer & PHPUnit.
- echo "memory_limit=2G" ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
# Environment set up
- export COMPOSER_PR_REPO=../.bolt-git-install/
- export COMPOSER_INSTALL=../.composer-install/
before_script:
# Set up Composer
- composer self-update || true
# - composer global require hirak/prestissimo:^0.2
- composer install --prefer-dist
# Set up permissions
- chmod -R 777 app/database/ app/cache/ app/config/ extensions/ files/ theme/
# Set up MySQL
- mysql -e "CREATE DATABASE IF NOT EXISTS bolt_travis;" -u root
- mysql -e "CREATE USER 'bolt_travis'@'localhost' IDENTIFIED BY 'bolt_travis';" -u root
- mysql -e "GRANT ALL PRIVILEGES ON bolt_travis.* TO 'bolt_travis'@'localhost';" -u root
- mysql -e "FLUSH PRIVILEGES;" -u root
# Set up PostgreSQL
- psql -c "CREATE DATABASE bolt_travis;" -U postgres || true
- psql -c "CREATE USER bolt_travis WITH PASSWORD 'bolt_travis';" -U postgres
- psql -c "GRANT ALL PRIVILEGES ON DATABASE bolt_travis TO bolt_travis;" -U postgres
# Composer install set up
- ./tests/travis/composer-setup
script:
## Default install tests
# PHPUnit
- php -d memory_limit=2G ./vendor/bin/phpunit
# Codeception set up (PHP >5.3)
- if [[ $TRAVIS_PHP_VERSION =~ (^5.[456]|^7|^hhvm) ]]; then ./vendor/codeception/codeception/codecept build ; fi
# Codeception Sqlite run (PHP >5.3)
- if [[ $TRAVIS_PHP_VERSION =~ (^5.[456]|^7|^hhvm) ]]; then ./vendor/codeception/codeception/codecept run ; fi
# Codeception MySQL run (PHP >5.3)
- ./tests/travis/test-db-config mysql
- if [[ $TRAVIS_PHP_VERSION =~ (^5.[456]|^7|^hhvm) ]]; then ./vendor/codeception/codeception/codecept run ; fi
# Codeception PostgreSQL run (PHP >5.3)
- ./tests/travis/test-db-config postgres
- if [[ $TRAVIS_PHP_VERSION =~ (^5.[456]|^7|^hhvm) ]]; then ./vendor/codeception/codeception/codecept run ; fi
## Composer install test
# To enable Composer tests, set RUN_COMPOSER_TEST=true in the web UI at https://travis-ci.org/bolt/bolt/settings/env_vars
# - if [[ $RUN_COMPOSER_TEST != true ]] ; then echo "Composer tests disabled. " ; exit 0 ; fi
# Sync in composer install
- rsync -a --delete $COMPOSER_INSTALL ./
# Set up Nginx
- find . -name '*nginx*'
- cat vendor/bolt/bolt/tests/travis/nginx.conf > nginx.conf
- PWD=$(pwd) ; perl -p -i -e 's/%ROOTDIR%/$ENV{PWD}\/public/g' nginx.conf
- sudo rm -f /etc/nginx/nginx.conf && sudo mv nginx.conf /etc/nginx/nginx.conf
- sudo service nginx restart
# Set up MySQL
# - mysql -e "DROP DATABASE bolt_travis;" -u root
# - mysql -e "CREATE DATABASE IF NOT EXISTS bolt_travis;" -u root
# - mysql -e "GRANT ALL PRIVILEGES ON bolt_travis.* TO 'bolt_travis'@'localhost';" -u root
# - mysql -e "FLUSH PRIVILEGES;" -u root
# Set up PostgreSQL
# - psql -c "DROP DATABASE bolt_travis;" -U postgres
# - psql -c "CREATE DATABASE bolt_travis;" -U postgres
# - psql -c "GRANT ALL PRIVILEGES ON DATABASE bolt_travis TO bolt_travis;" -U postgres
# Codeception set up (PHP >5.3)
- if [[ $TRAVIS_PHP_VERSION =~ (^5.[456]|^7|^hhvm) ]]; then ./vendor/codeception/codeception/codecept build --config ./vendor/bolt/bolt/codeception.yml ; fi
# Codeception Sqlite run (PHP >5.3)
- if [[ $TRAVIS_PHP_VERSION =~ (^5.[456]|^7|^hhvm) ]]; then ./vendor/codeception/codeception/codecept run --config ./vendor/bolt/bolt/codeception.yml ; fi
# Codeception MySQL run (PHP >5.3)
# - ./vendor/bolt/bolt/tests/travis/test-db-config mysql
# - if [[ $TRAVIS_PHP_VERSION =~ (^5.[456]|^7|^hhvm) ]]; then ./vendor/codeception/codeception/codecept run --config ./vendor/bolt/bolt/codeception.yml ; fi
# Codeception PostgreSQL run (PHP >5.3)
# - ./vendor/bolt/bolt/tests/travis/test-db-config postgres
# - if [[ $TRAVIS_PHP_VERSION =~ (^5.[456]|^7|^hhvm) ]]; then ./vendor/codeception/codeception/codecept run --config ./vendor/bolt/bolt/codeception.yml ; fi
after_script:
# cache vendor dirs
#cache:
# directories:
# - vendor
# - $COMPOSER_CACHE_DIR