Run tests on CI, refactor .gitlab-ci.yml

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2018-02-20 08:43:46 +01:00
parent 819220997c
commit 89dd2fbc35

View File

@ -1,20 +1,36 @@
image: php
stages:
- test
- deploy
- funky
pages:
stage: deploy
# install zip, git, composer on each build
before_script:
- apt-get update -yqq
- apt-get install zip unzip git -yqq
- curl --silent --show-error https://getcomposer.org/installer | php
# Run php-cs-fixer and phpunit on all branches
test:
stage: test
script:
- php composer.phar install -o --no-interaction --no-progress --prefer-dist
- mkdir tpl_c
- php vendor/bin/php-cs-fixer fix --verbose --dry-run
- vendor/bin/phpunit --bootstrap app/tests/bootstrap.php --debug app/tests
except:
- master
# Create artifacts on master
pages:
stage: deploy
script:
- latesttag=$(git describe --tags)
- git checkout ${latesttag}
- php composer.phar install -o --no-interaction --no-progress --prefer-dist
- mkdir tpl_c
- php vendor/bin/php-cs-fixer fix --verbose --dry-run
- vendor/bin/phpunit --bootstrap app/tests/bootstrap.php --debug app/tests
- mkdir tpl_c
- zip -r latest.zip .
- mkdir .public
- cp latest.zip .public
@ -25,12 +41,9 @@ pages:
only:
- master
# Deploy on funky
funky:
stage: funky
before_script:
- apt-get update -y -qq
- DEBIAN_FRONTEND=noninteractive apt-get install -y -qq zip unzip git
- curl --silent --show-error https://getcomposer.org/installer | php
script:
- git checkout funky
- php composer.phar install