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