From 560197eebeeb25af7c34cad12516a217426b26f7 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 11 Sep 2017 12:34:58 -0400 Subject: [PATCH] Testing some gitlab ci changes --- .gitlab-ci.yml | 21 ++++++++++++++++++--- ci/php_lint.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 ci/php_lint.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 22ba8e8b..1fd7b24a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,24 +1,39 @@ -image: tetraweb/php - stages: - test - deploy before_script: + - bash ci/docker_install.sh > /dev/null - cd api - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - php composer-setup.php - php -r "unlink('composer-setup.php');" - php composer.phar update -test: +test:7.1: + image: php:7.1 stage: test script: - composer install - cd Tests - phpunit + - cd ../../ + - bash ci/php_lint.sh ./ + +test:7.0: + image: php:7.0 + stage: test + script: + - bash ci/php_lint.sh ./ + +test:5.5: + image: php:5.5 + stage: test + script: + - bash ci/php_lint.sh ./ deploy: + image: tetraweb/php when: manual stage: deploy script: diff --git a/ci/php_lint.sh b/ci/php_lint.sh new file mode 100644 index 00000000..1e0c3ad1 --- /dev/null +++ b/ci/php_lint.sh @@ -0,0 +1,33 @@ +#!/bin/bash +error=false + +while test $# -gt 0; do + current=$1 + shift + + if [ ! -d $current ] && [ ! -f $current ] ; then + echo "Invalid directory or file: $current" + error=true + + continue + fi + + for file in `find $current -type f -not -path "*vendor/*" -name "*.php"` ; do + RESULTS=`php -l $file` + echo $RESULTS + + if [ "$RESULTS" != "No syntax errors detected in $file" ] ; then + echo $RESULTS + error=true + fi + done +done + + +if [ "$error" = true ] ; then + exit 1 +else + exit 0 +fi + +