2017-12-14 15:30:21 +01:00
|
|
|
image: php
|
|
|
|
stages:
|
2018-02-20 08:43:46 +01:00
|
|
|
- test
|
2017-12-14 15:30:21 +01:00
|
|
|
- deploy
|
|
|
|
- funky
|
2018-02-20 08:43:46 +01:00
|
|
|
|
|
|
|
# install zip, git, composer on each build
|
|
|
|
before_script:
|
2017-12-14 15:30:21 +01:00
|
|
|
- apt-get update -yqq
|
|
|
|
- apt-get install zip unzip git -yqq
|
|
|
|
- curl --silent --show-error https://getcomposer.org/installer | php
|
2018-02-20 08:43:46 +01:00
|
|
|
|
|
|
|
# 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
|
2018-02-20 08:58:49 +01:00
|
|
|
cache:
|
|
|
|
paths:
|
|
|
|
- vendor/
|
2018-02-20 08:43:46 +01:00
|
|
|
|
|
|
|
# Create artifacts on master
|
|
|
|
pages:
|
|
|
|
stage: deploy
|
2017-12-14 15:30:21 +01:00
|
|
|
script:
|
|
|
|
- latesttag=$(git describe --tags)
|
|
|
|
- git checkout ${latesttag}
|
2018-02-20 08:54:11 +01:00
|
|
|
- php composer.phar install -o --no-interaction --no-progress --prefer-dist --no-dev
|
|
|
|
- php composer.phar dump-autoload --optimize --no-dev --classmap-authoritative
|
2018-02-20 08:43:46 +01:00
|
|
|
- mkdir tpl_c
|
2017-12-14 15:30:21 +01:00
|
|
|
- zip -r latest.zip .
|
|
|
|
- mkdir .public
|
|
|
|
- cp latest.zip .public
|
|
|
|
- mv .public public
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- public
|
|
|
|
only:
|
2018-02-20 08:43:46 +01:00
|
|
|
- master
|
2018-02-19 00:38:51 +01:00
|
|
|
|
2018-02-20 08:43:46 +01:00
|
|
|
# Deploy on funky
|
2017-12-14 15:30:21 +01:00
|
|
|
funky:
|
|
|
|
stage: funky
|
|
|
|
script:
|
|
|
|
- git checkout funky
|
|
|
|
- php composer.phar install
|
|
|
|
- mkdir tpl_c
|
|
|
|
- mkdir .public
|
|
|
|
- cp -r * .public
|
|
|
|
- mv .public public
|
|
|
|
- mkdir "${HOME}/.ssh"
|
|
|
|
- chmod 700 "${HOME}/.ssh"
|
|
|
|
- if [ ! -z ${DEPLOYEMENT_KNOWN_HOSTS+x} ]; then echo -e "${DEPLOYEMENT_KNOWN_HOSTS}" > ${HOME}/.ssh/known_hosts; fi
|
|
|
|
- eval `ssh-agent -s`
|
|
|
|
- if [ ! -z ${DEPLOYEMENT_KEY+x} ]; then ssh-add <(echo "${DEPLOYEMENT_KEY}" | base64 --decode -i); fi
|
|
|
|
- if [ ! -z ${DEPLOYEMENT_KEY+x} ]; then rsync -a --delete --exclude admin/.stdout.log --exclude admin/.htpasswd --exclude app/inc/config.php --exclude stats/ --exclude errors/ public/ ${DEPLOYEMENT_USER}@${DEPLOYEMENT_HOST}:../../web/; fi
|
|
|
|
only:
|
|
|
|
- funky
|