Skip to content

Commit

Permalink
Add container for every supported php version
Browse files Browse the repository at this point in the history
  • Loading branch information
Albin Kerouanton authored and PedroTroller committed Mar 15, 2017
1 parent 71e7c53 commit 9ad673b
Show file tree
Hide file tree
Showing 16 changed files with 230 additions and 27 deletions.
14 changes: 14 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.idea/
bin/tests-all
doc/
docker/
vendor/
.dockerignore
.editorconfig
.gitignore
.travis.yml
appveyor.yml
composer.lock
docker-compose.yml
LICENSE
README.md
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
bin/*
!bin/tests
!bin/tests-all
doc/.couscous
tests/adapters/*
!tests/adapters/*.dist
vendor/
composer.lock
phpunit.xml
tests/adapters/*
!tests/adapters/*.dist
bin/*
!bin/configure_test_env.sh
doc/.couscous
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ before_script:
- if [[ ${TRAVIS_PHP_VERSION:0:3} != "5.4" ]]; then composer require microsoft/windowsazure:^0.4.3; fi

script:
- php bin/phpspec run -fpretty --verbose
- php bin/phpunit
- php vendor/bin/phpspec run -fpretty --verbose
- php vendor/bin/phpunit
22 changes: 7 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,19 @@ Read the official [Gaufrette documentation](http://knplabs.github.io/Gaufrette/)

Symfony integration is available through [KnpLabs/KnpGaufretteBundle](https://github.com/KnpLabs/KnpGaufretteBundle).

### Setup the vendor libraries

As some filesystem adapters use vendor libraries, you should install the vendors:

$ composer install
$ composer require microsoft/windowsazure # Needs php >= 5.5
$ sh bin/configure_test_env.sh

It will avoid skip a lot of tests.

### Launch the Test Suite

In the Gaufrette root directory:
Requires:
* docker
* docker-compose

To check if classes specification pass:
Build images:

$ php bin/phpspec run
$ docker-compose build

To check basic functionality of the adapters (adapters should be configured you will see many skipped tests):
Launch the tests:

$ bin/phpunit
$ bin/tests-all

Is it green?

Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ install:

test_script:
- cd C:\projects\gaufrette
- php bin\phpspec.bat run -fpretty --verbose
- php bin\phpunit.bat
- php vendor\bin\phpspec.bat run -fpretty --verbose
- php vendor\bin\phpunit.bat
14 changes: 14 additions & 0 deletions bin/tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -o nounset
set -o errexit
set -o xtrace

DIR=$(dirname ${BASH_SOURCE[0]})/..

cp \
${DIR}/tests/Gaufrette/Functional/adapters/DoctrineDbal.php.dist \
${DIR}/tests/Gaufrette/Functional/adapters/DoctrineDbal.php

${DIR}/vendor/bin/phpspec run --format=pretty
${DIR}/vendor/bin/phpunit
10 changes: 10 additions & 0 deletions bin/tests-all
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -o xtrace

docker-compose run --rm php54
docker-compose run --rm php55
docker-compose run --rm php56
docker-compose run --rm php70
docker-compose run --rm php71
docker-compose run --rm hhvm
3 changes: 0 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,5 @@
"branch-alias": {
"dev-master": "0.4.x-dev"
}
},
"config": {
"bin-dir": "bin"
}
}
32 changes: 32 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: '2'

services:
php54:
build:
context: .
dockerfile: docker/Dockerfile-php54

php55:
build:
context: .
dockerfile: docker/Dockerfile-php55

php56:
build:
context: .
dockerfile: docker/Dockerfile-php56

php70:
build:
context: .
dockerfile: docker/Dockerfile-php70

php71:
build:
context: .
dockerfile: docker/Dockerfile-php71

hhvm:
build:
context: .
dockerfile: docker/Dockerfile-hhvm
16 changes: 16 additions & 0 deletions docker/Dockerfile-hhvm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM webdevops/hhvm:ubuntu-16.04

ENV SRC_DIR /usr/src/gaufrette
WORKDIR ${SRC_DIR}

COPY composer.json ${SRC_DIR}/
RUN composer global require hirak/prestissimo && \
composer remove --dev --no-update herzult/php-ssh && \
composer update --prefer-lowest --prefer-stable && \
composer require microsoft/windowsazure:~0.5 && \
rm -rf ~/.composer/cache/*

VOLUME ${SRC_DIR}/vendor

COPY . ${SRC_DIR}/
CMD "${SRC_DIR}/bin/tests"
22 changes: 22 additions & 0 deletions docker/Dockerfile-php54
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM jolicode/php54:latest

ENV SRC_DIR /usr/src/gaufrette
WORKDIR ${SRC_DIR}/

RUN sudo apt-get update && \
sudo apt-get install -y libssh2-1-dev && \
sudo rm -rf /var/lib/apt/lists/* && \
pecl install mongo ssh2

COPY composer.json ${SRC_DIR}/
RUN sudo chown -R travis ${SRC_DIR} && \
composer global require hirak/prestissimo && \
composer install --prefer-dist && \
rm -rf ~/.composer/cache/*

VOLUME ${SRC_DIR}/vendor

COPY . ${SRC_DIR}/
RUN sudo chown -R travis ${SRC_DIR}

CMD "${SRC_DIR}/bin/tests"
22 changes: 22 additions & 0 deletions docker/Dockerfile-php55
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM jolicode/php55:latest

ENV SRC_DIR /usr/src/gaufrette
WORKDIR ${SRC_DIR}/

RUN sudo apt-get update && \
sudo apt-get install -y libssh2-1-dev && \
sudo rm -rf /var/lib/apt/lists/* && \
pecl install mongo ssh2

COPY composer.json ${SRC_DIR}/
RUN sudo chown -R travis ${SRC_DIR} && \
composer global require hirak/prestissimo && \
composer install --prefer-dist && \
rm -rf ~/.composer/cache/*

VOLUME ${SRC_DIR}/vendor

COPY . ${SRC_DIR}/
RUN sudo chown -R travis ${SRC_DIR}

CMD "${SRC_DIR}/bin/tests"
23 changes: 23 additions & 0 deletions docker/Dockerfile-php56
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM jolicode/php56:latest

ENV SRC_DIR /usr/src/gaufrette
WORKDIR ${SRC_DIR}/

RUN sudo apt-get update && \
sudo apt-get install -y libssh2-1-dev && \
sudo rm -rf /var/lib/apt/lists/* && \
pecl install mongo ssh2

COPY composer.json ${SRC_DIR}/
RUN sudo chown -R travis ${SRC_DIR} && \
composer global require hirak/prestissimo && \
composer update --prefer-lowest --prefer-stable && \
composer require microsoft/windowsazure:~0.4.3 && \
rm -rf ~/.composer/cache/*

VOLUME ${SRC_DIR}/vendor

COPY . ${SRC_DIR}/
RUN sudo chown -R travis ${SRC_DIR}

CMD "${SRC_DIR}/bin/tests"
28 changes: 28 additions & 0 deletions docker/Dockerfile-php70
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM php:7.0-cli

ENV SRC_DIR /usr/src/gaufrette
WORKDIR ${SRC_DIR}

RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
libssh2-1-dev \
libssl-dev \
unzip \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/* && \
pecl install mongodb ssh2-alpha zip && \
echo 'extension=/usr/local/lib/php/extensions/no-debug-non-zts-20151012/mongodb.so' >> /usr/local/etc/php/conf.d/mongodb.ini && \
echo 'extension=/usr/local/lib/php/extensions/no-debug-non-zts-20151012/ssh2.so' >> /usr/local/etc/php/conf.d/ssh2.ini && \
echo 'extension=/usr/local/lib/php/extensions/no-debug-non-zts-20151012/zip.so' >> /usr/local/etc/php/conf.d/zip.ini

COPY composer.json ${SRC_DIR}/
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
composer install && \
composer require microsoft/windowsazure:dev-master && \
rm -rf ~/.composer/cache/*

VOLUME ${SRC_DIR}/vendor

COPY . ${SRC_DIR}/
CMD "${SRC_DIR}/bin/tests"
29 changes: 29 additions & 0 deletions docker/Dockerfile-php71
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM php:7.1-cli

ENV SRC_DIR /usr/src/gaufrette
WORKDIR ${SRC_DIR}

RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
libssh2-1-dev \
libssl-dev \
unzip \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/* && \
pecl install mongodb ssh2-alpha zip && \
echo 'extension=/usr/local/lib/php/extensions/no-debug-non-zts-20160303/mongodb.so' >> /usr/local/etc/php/conf.d/mongodb.ini && \
echo 'extension=/usr/local/lib/php/extensions/no-debug-non-zts-20160303/ssh2.so' >> /usr/local/etc/php/conf.d/ssh2.ini && \
echo 'extension=/usr/local/lib/php/extensions/no-debug-non-zts-20160303/zip.so' >> /usr/local/etc/php/conf.d/zip.ini

COPY composer.json ${SRC_DIR}/
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
composer global require hirak/prestissimo && \
composer update --prefer-lowest --prefer-stable && \
composer require microsoft/windowsazure:~0.5 && \
rm -rf ~/.composer/cache/*

VOLUME ${SRC_DIR}/vendor

COPY . ${SRC_DIR}/
CMD "${SRC_DIR}/bin/tests"

0 comments on commit 9ad673b

Please sign in to comment.