From 4a396bdb78deaf4fa963d8b3338347a0ce723b79 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Fri, 31 May 2019 11:47:42 +1200 Subject: [PATCH] Tidying up GitLab CI file --- .gitlab-ci.yml | 36 ++++++++++++++++++++++++++++++------ test/docker_install.sh | 18 ------------------ test/misc/redis.conf | 8 -------- 3 files changed, 30 insertions(+), 32 deletions(-) delete mode 100644 test/docker_install.sh delete mode 100644 test/misc/redis.conf diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c97831d..8b90d0b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,21 +1,45 @@ -before_script: -- bash test/docker_install.sh > /dev/null -- cp test/misc/redis.conf /usr/local/etc/redis/redis.conf +.docker_boostrap: &docker_boostrap | + [[ ! -e /.dockerenv ]] && exit 0 + set -xe + + # Install git (the php image doesn't have it) which is required by composer + apt-get update -yq + apt-get install git redis-server php-redis -y + + # Install phpunit, the tool that we will use for testing + curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar + chmod +x /usr/local/bin/phpunit + + # Install mysql driver + # Here you can install any other extension that you need + docker-php-ext-install redis # Test PHP 7.0 test:7.0: image: php:7.0 + before_script: + - *docker_boostrap script: - - phpunit --configuration phpunit.xml.dist + - phpunit --configuration phpunit.xml.dist + tag: + - docker # Test PHP 7.2 test:7.1: image: php:7.1 + before_script: + - *docker_boostrap script: - - phpunit --configuration phpunit.xml.dist + - phpunit --configuration phpunit.xml.dist + tag: + - docker # Test PHP 7.2 test:7.2: image: php:7.2 + before_script: + - *docker_boostrap script: - - phpunit --configuration phpunit.xml.dist + - phpunit --configuration phpunit.xml.dist + tag: + - docker diff --git a/test/docker_install.sh b/test/docker_install.sh deleted file mode 100644 index 28b213f..0000000 --- a/test/docker_install.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# We need to install dependencies only for Docker -[[ ! -e /.dockerenv ]] && exit 0 - -set -xe - -# Install git (the php image doesn't have it) which is required by composer -apt-get update -yqq -apt-get install git redis php-redis -yqq - -# Install phpunit, the tool that we will use for testing -curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar -chmod +x /usr/local/bin/phpunit - -# Install mysql driver -# Here you can install any other extension that you need -docker-php-ext-install redis \ No newline at end of file diff --git a/test/misc/redis.conf b/test/misc/redis.conf deleted file mode 100644 index 971f66e..0000000 --- a/test/misc/redis.conf +++ /dev/null @@ -1,8 +0,0 @@ -daemonize yes -pidfile ./redis.pid -port 6379 -bind 127.0.0.1 -timeout 300 -dbfilename dump.rdb -dir ./ -loglevel debug \ No newline at end of file