-
Notifications
You must be signed in to change notification settings - Fork 36
/
.gitlab-ci.yml
61 lines (57 loc) · 1.76 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
image: php
stages:
- test
- deploy
- funky
# 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
cache:
paths:
- vendor/
# 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 --no-dev
- php composer.phar dump-autoload --optimize --no-dev --classmap-authoritative
- mkdir tpl_c
- zip -r latest.zip .
- mkdir .public
- cp latest.zip .public
- mv .public public
artifacts:
paths:
- public
only:
- master
# Deploy on funky
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