From a2a7c10c101bba79650fc72dee9a25d60f15a797 Mon Sep 17 00:00:00 2001 From: Matthias Kalb Date: Sun, 20 Jan 2019 00:00:17 +0100 Subject: [PATCH] CI Syntaxchecks --- .gitlab-ci.yml | 9 +++++++++ .test/php_syntax.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100755 .test/php_syntax.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..e8104ff --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,9 @@ +stages: + - test + +check_code: + stage: test + script: + - ./.test/php_syntax.sh + tags: + - php diff --git a/.test/php_syntax.sh b/.test/php_syntax.sh new file mode 100755 index 0000000..d353c01 --- /dev/null +++ b/.test/php_syntax.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +PHP=/usr/bin/php + +COUNT=0 +HIT=0 + +cd .. + +for file in `find . -name \*.php`; do + OUTPUT=`$PHP -l $file` + if ! [ 0 = $? ]; then + echo $OUTPUT + HIT=$(($HIT+1)) + fi + COUNT=$(($COUNT+1)) +done + + +if ! [ 0 = $HIT ]; then + echo "Syntax check: FAILED" + echo "Checked Files: $COUNT, Files with Errors: $HIT" + exit 1 +else + echo "Syntax check: PASSED" + echo "Checked Files: $COUNT" + exit 0 +fi