-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
130 lines (119 loc) · 6.07 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
125
126
127
128
129
language: php
# Prevent cutover to GCE. Can be removed once full Travis legacy envvironment is upgraded
sudo: required
dist: precise
group: legacy
php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm
matrix:
fast_finish: true
allow_failures:
- php: 7.0
- 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
- PWD=$(pwd) ; perl -p -i -e 's/%ROOTDIR%/$ENV{PWD}/g' tests/travis/nginx.conf
- sudo cp tests/travis/nginx.conf /etc/nginx/nginx.conf
- sudo service nginx restart
# Start postfix
- sudo service postfix restart
before_script:
# Set up Composer
- composer self-update || true
- 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
# Get the composer.json from our bolt/composer-install repo
- git clone https://github.com/bolt/composer-install.git .tmp
# - cd .tmp
# Add requires
- composer require --working-dir=.tmp/ --no-update "bolt/bolt:2.2.*@dev" "phpunit/phpunit:^4.5" "codeception/codeception:<=2.1.2" lstrojny/phpunit-function-mocker:dev-master
# Create the project
- composer create-project --working-dir=.tmp/ --no-interaction --prefer-dist
# Update the Composer Bolt install with the PR files
- rsync -av --delete src/ .tmp/vendor/bolt/bolt/src/
- rsync -av --delete app/ .tmp/vendor/bolt/bolt/app/
- rsync -av --delete tests/ .tmp/vendor/bolt/bolt/tests/
script:
## Default install tests
# PHPUnit
- phpunit -c phpunit.xml.dist
# 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
# Remove git installed stuff
- rm ./* -rf ; rm .git* -rf
- mv .tmp/* .
# 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