1
|
# variables:
|
2
|
# IMAGE_NAME: zcu-campus-life-app:$CI_COMMIT_REF_NAME
|
3
|
|
4
|
stages:
|
5
|
- test
|
6
|
- build
|
7
|
- deploy
|
8
|
|
9
|
# Now the runner is on the same server as production environment - which is not good - so ssh is not needed
|
10
|
# before_script:
|
11
|
# - apt-get update -qq
|
12
|
# - apt-get install -qq git
|
13
|
# # Setup SSH deploy keys
|
14
|
# - 'which ssh-agent || ( apt-get install -qq openssh-client )'
|
15
|
# - eval $(ssh-agent -s)
|
16
|
# - ssh-add <(echo "$SSH_PRIVATE_KEY")
|
17
|
# - mkdir -p ~/.ssh
|
18
|
# - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
19
|
|
20
|
unit_tests:
|
21
|
image: php:7.2-alpine
|
22
|
stage: test
|
23
|
script:
|
24
|
- apk add composer
|
25
|
- cd website
|
26
|
- composer require --dev symfony/phpunit-bridge
|
27
|
- php bin/phpunit
|
28
|
|
29
|
build:
|
30
|
stage: build
|
31
|
tags:
|
32
|
- build
|
33
|
script:
|
34
|
# Test whether container can be build or not
|
35
|
- docker-compose build
|
36
|
# We could also push docker image to some registry or docker hub
|
37
|
|
38
|
deploy_prod:
|
39
|
stage: deploy
|
40
|
tags:
|
41
|
- deploy
|
42
|
variables:
|
43
|
GIT_STRATEGY: none
|
44
|
environment:
|
45
|
name: heatmap
|
46
|
url: https://heatmap.zcu.cz
|
47
|
script:
|
48
|
- cd ~
|
49
|
- rm -rf aswi2020sebela
|
50
|
- git clone https://gitlab.kiv.zcu.cz/aswi/aswi-2020/aswi2020sebela.git
|
51
|
- cd aswi2020sebela
|
52
|
- ./build.sh
|
53
|
# only:
|
54
|
# - master
|
55
|
when: manual
|