Browse Source

Testing some gitlab ci changes

master
Mike Koch 3 years ago
parent
commit
560197eebe
No known key found for this signature in database GPG Key ID: 9BA5D7F8391455ED
2 changed files with 51 additions and 3 deletions
  1. +18
    -3
      .gitlab-ci.yml
  2. +33
    -0
      ci/php_lint.sh

+ 18
- 3
.gitlab-ci.yml View File

@@ -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:


+ 33
- 0
ci/php_lint.sh View File

@@ -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



Loading…
Cancel
Save