Skip to content

Commit 9565460

Browse files
authored
👷 added travis-ci #12 (#14)
* 👷 added travis-ci build scripts * ⬆️ update composer requirements * 👷 added vagrant to run phpunit tests under linux #13 * 🚧 temporarily disable problematic test * 🚧 debugging travis-ci build * 🚧 fixing for case sensitive file systems
1 parent 732bceb commit 9565460

File tree

10 files changed

+354
-182
lines changed

10 files changed

+354
-182
lines changed

.travis.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
language: php
2+
3+
sudo: false
4+
5+
matrix:
6+
include:
7+
- php: 5.6
8+
- php: 7.0
9+
- php: 7.1
10+
- php: nightly
11+
allow_failures:
12+
- php: nightly
13+
fast_finish: true
14+
15+
cache:
16+
directories:
17+
- $HOME/.composer/cache
18+
19+
before_install:
20+
- source .travis/travis.sh
21+
- xdebug-disable
22+
- travis_retry composer self-update
23+
24+
install:
25+
- travis_retry composer install --no-interaction --prefer-dist --no-suggest;
26+
27+
script:
28+
- run-tests

.travis/travis.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
# The problem is that we do not want to remove the configuration file, just disable it for a few tasks, then enable it
4+
#
5+
# For reference, see
6+
#
7+
# - https://docs.travis-ci.com/user/languages/php#Disabling-preinstalled-PHP-extensions
8+
# - https://docs.travis-ci.com/user/languages/php#Custom-PHP-configuration
9+
#
10+
# Original Source (this was copied from):
11+
# - https://github.com/codeclimate/php-test-reporter/blob/master/.travis/travis.sh
12+
13+
config="/home/travis/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini"
14+
15+
function xdebug-disable() {
16+
if [[ -f $config ]]; then
17+
mv $config "$config.bak"
18+
fi
19+
}
20+
21+
function xdebug-enable() {
22+
if [[ -f "$config.bak" ]]; then
23+
mv "$config.bak" $config
24+
fi
25+
}
26+
27+
function run-tests() {
28+
if [[ "$WITH_COVERAGE" == "true" ]]; then
29+
xdebug-enable
30+
vendor/bin/phpunit --coverage-clover=$TRAVIS_BUILD_DIR/build/logs/clover.xml
31+
xdebug-disable
32+
else
33+
vendor/bin/phpunit
34+
fi
35+
}

.vagrant/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
machines

.vagrant/bootstrap.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
Update () {
4+
echo "-- Update packages --"
5+
sudo apt-get update
6+
sudo apt-get upgrade
7+
}
8+
Update
9+
10+
echo "-- Install PPA's --"
11+
sudo add-apt-repository ppa:ondrej/php
12+
Update
13+
14+
echo "-- Install packages --"
15+
sudo apt-get install -y --force-yes curl git git-core
16+
sudo apt-get install -y --force-yes php7.0-common php7.0-dev php7.0-json php7.0-opcache php7.0-cli php7.0 php7.0-mysql php7.0-fpm php7.0-curl php7.0-gd php7.0-mcrypt php7.0-mbstring php7.0-bcmath php7.0-zip php7.0-xml
17+
18+
echo "-- Install Composer --"
19+
curl -s https://getcomposer.org/installer | php
20+
sudo mv composer.phar /usr/local/bin/composer
21+
sudo chmod +x /usr/local/bin/composer

Vagrantfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
Vagrant.configure("2") do |config|
5+
config.vm.box = "ubuntu/trusty64"
6+
config.vm.network "private_network", ip: "192.168.33.10"
7+
config.vm.synced_folder ".", "/vagrant_data"
8+
config.vm.provider "virtualbox" do |vb|
9+
# Setup VM with 1 CPU and 512MB of RAM, this should be
10+
# more than enough for development.
11+
vb.memory = "512"
12+
end
13+
config.vm.provision "shell", path: "./.vagrant/bootstrap.sh"
14+
end

0 commit comments

Comments
 (0)