From 091c628c164f920dedd512b3100bf485b9371c6b Mon Sep 17 00:00:00 2001 From: Serban Ghita Date: Fri, 27 Oct 2023 21:30:37 +0300 Subject: [PATCH] Docker setup for running unit tests on PHP 5.6 --- .gitattributes | 2 ++ .gitignore | 2 ++ composer.json | 4 ++-- docker-compose.yml | 31 +++++++++++++++---------------- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.gitattributes b/.gitattributes index fa706cfb..061dca14 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,5 @@ /examples export-ignore +/docs export-ignore +/export export-ignore /tests export-ignore /.* export-ignore diff --git a/.gitignore b/.gitignore index 8e2df89c..60443463 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ nbproject/ /coverage /phpunit.phar composer.lock +composer.phar +.phpunit.result.cache \ No newline at end of file diff --git a/composer.json b/composer.json index 25cd99a3..f92acb5e 100644 --- a/composer.json +++ b/composer.json @@ -14,10 +14,10 @@ } ], "require": { - "php": ">=5.0.0" + "php": "5.6.*" }, "require-dev": { - "phpunit/phpunit": "~4.8.35||~5.7" + "phpunit/phpunit": "~4.8.36" }, "autoload": { "classmap": ["Mobile_Detect.php"], diff --git a/docker-compose.yml b/docker-compose.yml index 58ce75e8..0fade5f4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,16 +1,15 @@ -app: - restart: 'on-failure' - image: php:7 - working_dir: /app - command: vendor/bin/phpunit -v -c tests/phpunit.xml --coverage-text --strict-coverage --stop-on-risky - ports: - - "8000:8000" - volumes: - - .:/app - -composer: - restart: 'no' - image: composer/composer:php7 - command: install - volumes: - - .:/app \ No newline at end of file +services: + app: + image: php:5.6-cli-alpine3.8 + working_dir: /app + command: > + /bin/sh -c " + rm -rf vendor && + rm -f composer.lock composer.phar && + curl -s https://getcomposer.org/download/2.0.0/composer.phar -o composer.phar && + php composer.phar update --no-interaction --prefer-dist -vvv && + vendor/bin/phpunit -v -c tests/phpunit.xml --coverage-text --strict-coverage --stop-on-risky" + ports: + - "8000:8000" + volumes: + - .:/app \ No newline at end of file