diff --git a/tests/dockerfiles/php72/1_build.sh b/tests/dockerfiles/php72/1_build.sh new file mode 100755 index 0000000..5d52a06 --- /dev/null +++ b/tests/dockerfiles/php72/1_build.sh @@ -0,0 +1,2 @@ +# Build an image. +docker build --tag="php-curl-class/php72" . diff --git a/tests/dockerfiles/php72/2_run.sh b/tests/dockerfiles/php72/2_run.sh new file mode 100755 index 0000000..11f9899 --- /dev/null +++ b/tests/dockerfiles/php72/2_run.sh @@ -0,0 +1,14 @@ +# Run image to create container and attach to it. + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +set -x +cd "${SCRIPT_DIR}/../../.." +project_dir="${PWD}" + +docker run \ + --interactive \ + --mount "type=bind,src=${project_dir},dst=/data,readonly=true" \ + --name=php72 \ + --rm \ + --tty \ + "php-curl-class/php72" /bin/bash diff --git a/tests/dockerfiles/php72/3_test.sh b/tests/dockerfiles/php72/3_test.sh new file mode 100755 index 0000000..6e73a6d --- /dev/null +++ b/tests/dockerfiles/php72/3_test.sh @@ -0,0 +1,17 @@ +# Run tests inside container. +command=$(cat <<-END +mkdir --parents "/tmp/php-curl-class" && +rsync --exclude=".git" --exclude="vendor" --links --recursive "/data/" "/tmp/php-curl-class/" && +cd "/tmp/php-curl-class" && +export TRAVIS_PHP_VERSION="7.2" && +( + [ ! -f "/tmp/.composer_updated" ] && + composer --no-interaction update && + touch "/tmp/.composer_updated" || + exit 0 +) && +bash "tests/before_script.sh" && +bash "tests/script.sh" +END +) +docker exec --interactive --tty "php72" sh -c "${command}" diff --git a/tests/dockerfiles/php72/Dockerfile b/tests/dockerfiles/php72/Dockerfile new file mode 100644 index 0000000..ba368ed --- /dev/null +++ b/tests/dockerfiles/php72/Dockerfile @@ -0,0 +1,18 @@ +FROM php:7.2-cli +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get --assume-yes --quiet update + +RUN apt-get --assume-yes --quiet install git && \ + apt-get --assume-yes --quiet install libpng-dev && \ + apt-get --assume-yes --quiet install zip + +RUN curl --silent --show-error "https://getcomposer.org/installer" | php && \ + mv "composer.phar" "/usr/local/bin/composer" && \ + composer global require --no-interaction "phpunit/phpunit" + +RUN docker-php-ext-configure gd && \ + docker-php-ext-install gd + +ENV PATH /root/.composer/vendor/bin:$PATH +CMD ["bash"]