Skip to content

Commit

Permalink
added xdebug container to the mix in order to run
Browse files Browse the repository at this point in the history
unit tests on with codecoverage.
added a couple of new servers to docker-compose to run display html for codecoverage and phpunit docs
  • Loading branch information
mattKendon committed Jul 31, 2017
1 parent ea323d6 commit 015ba02
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ npm-debug.log
yarn-error.log
composer.phar
.env
/reports/
12 changes: 9 additions & 3 deletions docker/bin/dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@
cd docker
case "$1" in
'start')
docker-compose up -d web phppgadmin
cd docker
docker-compose up -d web phppgadmin codecoverage docs
docker-compose run --rm composer install
docker-compose run --rm php php artisan doctrine:migrations:migrate
cd ..
docker/bin/composer install
docker/bin/artisan doctrine:migrations:migrate
docker/bin/test unit
;;
'stop')
cd docker
docker-compose stop
cd ..
;;
*)
echo $"Usage: $0 {start|stop}"
;;
esac
cd ..
esac
2 changes: 1 addition & 1 deletion docker/bin/test
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ case "$1" in
docker/bin/composer run-script code
;;
'unit')
docker/bin/php vendor/bin/phpunit --testsuite=Unit
docker/bin/xdebug vendor/bin/phpunit --testsuite=Unit --coverage-html reports/codecoverage --testdox-html reports/docs/index.html
;;
'feature')
docker/bin/php vendor/bin/phpunit --testsuite=Feature
Expand Down
4 changes: 4 additions & 0 deletions docker/bin/xdebug
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
cd docker
docker-compose run --rm xdebug php $@
cd ..
47 changes: 47 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,37 @@ services:
- [email protected]
networks:
- proxy-tier
restart: always

codecoverage:
image: nginx
container_name: restartproject_codecoverage
volumes:
- ../reports/codecoverage:/usr/share/nginx/html:ro
environment:
- VIRTUAL_HOST=cc.restart-project.local
- LETSENCRYPT_HOST=cc.restart-project.local
- [email protected]
- NGINX_HOST=cc.restart-project.local
- NGINX_PORT=80
networks:
- proxy-tier
restart: always

docs:
image: nginx
container_name: restartproject_docs
volumes:
- ../reports/docs:/usr/share/nginx/html:ro
environment:
- VIRTUAL_HOST=docs.restart-project.local
- LETSENCRYPT_HOST=docs.restart-project.local
- [email protected]
- NGINX_HOST=docs.restart-project.local
- NGINX_PORT=80
networks:
- proxy-tier
restart: always

web:
depends_on:
Expand Down Expand Up @@ -76,6 +107,22 @@ services:
networks:
- proxy-tier

xdebug:
depends_on:
- database
- maildev
build: ./xdebug
image: restartproject_xdebug
container_name: restartproject_xdebug
working_dir: /app
volumes:
- ../:/app
environment:
- XDEBUG_CONFIG="idekey=PHPSTORM"
command: ["php", "--version"]
networks:
- proxy-tier

composer:
depends_on:
- database
Expand Down
9 changes: 9 additions & 0 deletions docker/xdebug/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM restartproject_php

RUN apk update \
&& apk add autoconf g++ make \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini
1 change: 1 addition & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<php>
Expand Down

0 comments on commit 015ba02

Please sign in to comment.