Skip to content

Commit 39eba1d

Browse files
committed
Add files to run php73 tests inside a docker container
1 parent e75a4c5 commit 39eba1d

File tree

6 files changed

+72
-0
lines changed

6 files changed

+72
-0
lines changed

tests/dockerfiles/php73/1_build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Build an image.
2+
docker build --tag="php-curl-class/php73" .

tests/dockerfiles/php73/2_start.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Run image to create container.
2+
3+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4+
set -x
5+
cd "${SCRIPT_DIR}/../../.."
6+
project_dir="${PWD}"
7+
8+
docker start "php73" ||
9+
docker run \
10+
--detach \
11+
--interactive \
12+
--mount "type=bind,src=${project_dir},dst=/data,readonly=true" \
13+
--name="php73" \
14+
--tty \
15+
"php-curl-class/php73"

tests/dockerfiles/php73/3_test.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Run tests inside container.
2+
command=$(cat <<-END
3+
mkdir --parents "/tmp/php-curl-class" &&
4+
rsync --delete --exclude=".git" --exclude="vendor" --links --recursive "/data/" "/tmp/php-curl-class/" &&
5+
cd "/tmp/php-curl-class" &&
6+
export TRAVIS_PHP_VERSION="7.3" &&
7+
(
8+
[ ! -f "/tmp/.composer_updated" ] &&
9+
composer --no-interaction update &&
10+
touch "/tmp/.composer_updated" ||
11+
exit 0
12+
) &&
13+
bash "tests/before_script.sh" &&
14+
bash "tests/script.sh"
15+
END
16+
)
17+
docker exec --interactive --tty "php73" sh -c "${command}"

tests/dockerfiles/php73/4_stop.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Stop container.
2+
3+
docker stop "php73"

tests/dockerfiles/php73/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# TODO: Change to php:7.3-cli when available.
2+
# -FROM php:7.3-rc-cli
3+
# +FROM php:7.3-cli
4+
FROM php:7.3-rc-cli
5+
ENV DEBIAN_FRONTEND noninteractive
6+
7+
RUN apt-get --assume-yes --quiet update
8+
9+
RUN apt-get --assume-yes --quiet install git && \
10+
apt-get --assume-yes --quiet install libpng-dev && \
11+
apt-get --assume-yes --quiet install zip
12+
13+
RUN curl --silent --show-error "https://getcomposer.org/installer" | php && \
14+
mv "composer.phar" "/usr/local/bin/composer" && \
15+
composer global require --no-interaction "phpunit/phpunit"
16+
17+
RUN docker-php-ext-configure gd && \
18+
docker-php-ext-install gd
19+
20+
ENV PATH /root/.composer/vendor/bin:$PATH
21+
CMD ["bash"]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Run image to create container and attach to it.
2+
3+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4+
set -x
5+
cd "${SCRIPT_DIR}/../../.."
6+
project_dir="${PWD}"
7+
8+
docker run \
9+
--interactive \
10+
--mount "type=bind,src=${project_dir},dst=/data,readonly=true" \
11+
--name="php73" \
12+
--rm \
13+
--tty \
14+
"php-curl-class/php73" /bin/bash

0 commit comments

Comments
 (0)