-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path.gitlab-ci.yml
174 lines (159 loc) Β· 4.11 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
stages:
- prepare
- linters
- test
- swagger
- deploy
- release
variables:
CACHE_FALLBACK_KEY: fallback-key
.cache-tpl: &cache-tpl
key: "$CI_COMMIT_REF_SLUG"
paths:
- node_modules
- frontend/components
.test-template: &test-template
image: node:10-stretch
stage: test
tags:
- docker
cache:
<<: *cache-tpl
variables:
TZ: "America/New_York"
before_script:
- 'echo "INFO: NB node packages : $(ls node_modules | wc -l)"'
- 'echo "INFO: NB bower packages : $(ls frontend/components | wc -l)"'
except:
variables:
- $SKIP_TESTS
refs:
- tags@linagora/lgs/openpaas/linagora.esn.calendar
prepare:
image: node:10-stretch
stage: prepare
tags:
- docker
cache:
<<: *cache-tpl
script:
- npm install
# Weird behaviour: at the time, npm postinstall was not called.
- ./node_modules/.bin/bower install --allow-root
- 'echo "INFO: NB node packages : $(ls node_modules | wc -l)"'
- 'echo "INFO: NB bower packages : $(ls frontend/components | wc -l)"'
except:
variables:
- $SKIP_PREPARE
linters:
<<: *test-template
stage: linters
script:
- ./node_modules/.bin/grunt -v linters
except:
variables:
- $SKIP_LINTERS
refs:
- tags@linagora/lgs/openpaas/linagora.esn.calendar
check_author:
image: docker-registry.linagora.com:5000/lgs-releases/gitlab-integrity-checks:latest
stage: linters
variables:
GIT_DEPTH: "1"
tags:
- docker-medium
- check-author
script:
- check_author.py check "$GITLAB_USER_EMAIL" "$GITLAB_USER_NAME" --no-accents
except:
refs:
- master@linagora/lgs/openpaas/linagora.esn.calendar
- tags@linagora/lgs/openpaas/linagora.esn.calendar
- /^release-.*/@linagora/lgs/openpaas/linagora.esn.calendar
####### tests without services requirements
test_frontend:
<<: *test-template
image: docker-registry.linagora.com:5000/public-releases/openpaas-esn-test-helper:1.1.0
script:
- ./node_modules/.bin/grunt -v test-frontend
test_unit_backtend:
<<: *test-template
script:
- ./node_modules/.bin/grunt -v --chunk=1 test-unit-backend
####### tests with services requirements
test_midway_backtend:
<<: *test-template
services:
- name: docker.elastic.co/elasticsearch/elasticsearch:6.3.2
alias: elasticsearch
command: [ "bin/elasticsearch", "-Ediscovery.type=single-node" ]
- name: mongo:3.2.0
alias: mongo
- name: redis:latest
alias: redis
- name: rabbitmq:3.6.5-management
alias: rabbitmq
variables:
MONGO_HOST: mongo
MONGO_PORT: 27017
AMQP_HOST: rabbitmq
AMQP_PORT: 5672
ELASTICSEARCH_HOST : elasticsearch
ELASTICSEARCH_PORT: 9200
REDIS_HOST: redis
REDIS_PORT: 6379
script:
- TZ="Europe/Paris" ./node_modules/.bin/grunt -v --chunk=1 test-midway-backend
swagger:
<<: *test-template
stage: swagger
script:
- ./node_modules/.bin/grunt swagger-generate
- ./node_modules/.bin/grunt swagger-validate
artifacts:
paths:
- ./doc/swagger/calendar-swagger.json
deploy-swagger:
stage: deploy
tags:
- deployment
- api.open-paas.org
- shell
environment:
name: api
url: https://api.open-paas.org
only:
- master@linagora/lgs/openpaas/linagora.esn.calendar
script:
- perl -i -pe's/"host":"localhost:8080"/"schemes":["https"],"host":"demo.open-paas.org"/' ./doc/swagger/calendar-swagger.json
- cp ./doc/swagger/calendar-swagger.json /var/www/html
deploy_dev:
stage: deploy
except:
- triggers
tags:
- dev.open-paas.org
- deployment
environment:
name: dev
url: https://dev.open-paas.org
only:
- master@linagora/lgs/openpaas/linagora.esn.calendar
script:
- cd /srv/${CI_PROJECT_NAME}
- git fetch --all
- git checkout ${CI_COMMIT_SHA}
- npm install --ignore-scripts --production
- npm update --production
- npm prune
- bower install --production
- bower prune
- git checkout -- .
- sudo /etc/init.d/rse.dev restart
release:
stage: release
only:
- triggers
script:
- if [ -z "${VERSION}" ]; then exit 0; fi
- ./node_modules/.bin/grunt release:${VERSION}