.gitlab-ci.yml 18.9 KB
Newer Older
Piotr Gawron's avatar
Piotr Gawron committed
1
2
image: node

3
4
stages:
  - build
Piotr Gawron's avatar
Piotr Gawron committed
5
  - packaging
6
  - test
Piotr Gawron's avatar
Piotr Gawron committed
7

8
9
10
11
12
variables:
  POSTGRES_DB: map_viewer
  POSTGRES_USER: map_viewer
  POSTGRES_PASSWORD: "123qweasdzxc"

Piotr Gawron's avatar
Piotr Gawron committed
13
test:frontend:
14
  stage: test
15
  coverage: '/Statements[:\ ]+(\d+.\d+)\%/'
Piotr Gawron's avatar
Piotr Gawron committed
16
17
  script:
    - cd frontend-js
18
    - npm install  
Piotr Gawron's avatar
Piotr Gawron committed
19
    - npm test
20

Piotr Gawron's avatar
Piotr Gawron committed
21
.jdk_8_template: &jdk_8_definition
Piotr Gawron's avatar
Piotr Gawron committed
22
  image: maven:3.6.0-jdk-8
Piotr Gawron's avatar
Piotr Gawron committed
23
24
  services:
    - postgres:9.6
25
  stage: test
26
  coverage: '/(\d+.\d+) \% covered/'
Piotr Gawron's avatar
Piotr Gawron committed
27
28
29
30
31
32
33
34
35
36

.jdk_11_template: &jdk_11_definition
  image: maven:3.6.0-jdk-11
  services:
    - postgres:9.6
  stage: test
  coverage: '/(\d+.\d+) \% covered/'

.test_backend_commons_template: 
  script: &test_backend_commons_definition
37
#xvfb is for X11 connection used by some parts of the java code: https://stackoverflow.com/a/47575851/1127920
Piotr Gawron's avatar
Piotr Gawron committed
38
    - apt-get update
39
    - DEBIAN_FRONTEND=noninteractive apt-get install -y xvfb
40
41
    - Xvfb :99 &
    - export DISPLAY=:99
42
43
44

    - mvn -DskipTests=true clean install -pl commons -am
    - mvn test -pl commons
Piotr Gawron's avatar
Piotr Gawron committed
45
    - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' commons/target/site/jacoco/jacoco.csv
46

Piotr Gawron's avatar
Piotr Gawron committed
47
48
.test_backend_annotation_template:
  script: &test_backend_annotation_definition
49
    - mkdir /etc/minerva/
50
    - cp test-db-ci.properties /etc/minerva/db.properties
51
52
53

    - mvn -DskipTests=true clean install -pl annotation -am
    - mvn test -pl annotation
Piotr Gawron's avatar
Piotr Gawron committed
54
    - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' annotation/target/site/jacoco/jacoco.csv
55

Piotr Gawron's avatar
Piotr Gawron committed
56
57
58

.test_backend_CellDesigner-plugin_template:
  script: &test_backend_CellDesigner_plugin_definition
Piotr Gawron's avatar
Piotr Gawron committed
59
60
61
62
63
64
#xvfb is for X11 connection used by some parts of the java code: https://stackoverflow.com/a/47575851/1127920
    - apt-get update
    - apt-get install -y xvfb
    - Xvfb :99 &
    - export DISPLAY=:99

65
66
    - mvn -DskipTests=true clean install -pl CellDesigner-plugin -am
    - mvn test -pl CellDesigner-plugin
Piotr Gawron's avatar
Piotr Gawron committed
67
    - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' CellDesigner-plugin/target/site/jacoco/jacoco.csv
68

Piotr Gawron's avatar
Piotr Gawron committed
69
70
.test_backend_converter_template:
  script: &test_backend_converter_definition
71
72
    - mvn -DskipTests=true clean install -pl converter -am
    - mvn test -pl converter
Piotr Gawron's avatar
Piotr Gawron committed
73
    - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' converter/target/site/jacoco/jacoco.csv
74

Piotr Gawron's avatar
Piotr Gawron committed
75
76
.test_backend_converter_graphics_template:
  script: &test_backend_converter_graphics_definition
77
78
    - mvn -DskipTests=true clean install -pl converter-graphics -am
    - mvn test -pl converter-graphics
Piotr Gawron's avatar
Piotr Gawron committed
79
    - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' converter-graphics/target/site/jacoco/jacoco.csv
80

Piotr Gawron's avatar
Piotr Gawron committed
81
82
.test_backend_converter_CellDesigner_template:
  script: &test_backend_converter_CellDesigner_definition
83
    - mvn -DskipTests=true clean install -pl converter-CellDesigner -am
Piotr Gawron's avatar
Piotr Gawron committed
84
    - mvn test -pl converter-CellDesigner
Piotr Gawron's avatar
Piotr Gawron committed
85
    - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' converter-CellDesigner/target/site/jacoco/jacoco.csv
86

Piotr Gawron's avatar
Piotr Gawron committed
87
88
.test_backend_converter_SBGNML_template:
  script: &test_backend_converter_SBGNML_definition
89
    - mkdir /etc/minerva/
90
    - cp test-db-ci.properties /etc/minerva/db.properties
91
92
    - mvn -DskipTests=true clean install -pl converter-SBGNML -am
    - mvn test -pl converter-SBGNML
Piotr Gawron's avatar
Piotr Gawron committed
93
    - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' converter-SBGNML/target/site/jacoco/jacoco.csv
94

Piotr Gawron's avatar
Piotr Gawron committed
95
96
.test_backend_converter_SBML_template:
  script: &test_backend_converter_SBML_definition
97
98
    - mvn -DskipTests=true clean install -pl converter-sbml -am
    - mvn test -pl converter-sbml
Piotr Gawron's avatar
Piotr Gawron committed
99
    - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' converter-sbml/target/site/jacoco/jacoco.csv
100

Piotr Gawron's avatar
Piotr Gawron committed
101
102
.test_backend_model_template:
  script: &test_backend_model_definition
103
104
    - mvn -DskipTests=true clean install -pl model -am
    - mvn test -pl model
Piotr Gawron's avatar
Piotr Gawron committed
105
    - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' model/target/site/jacoco/jacoco.csv
106

Piotr Gawron's avatar
Piotr Gawron committed
107
108
.test_backend_model_command_template:
  script: &test_backend_model_command_definition
109
110
    - mvn -DskipTests=true clean install -pl model-command -am
    - mvn test -pl model-command
Piotr Gawron's avatar
Piotr Gawron committed
111
    - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' model-command/target/site/jacoco/jacoco.csv
112

Piotr Gawron's avatar
Piotr Gawron committed
113
114
.test_backend_pathvisio_template:
  script: &test_backend_pathvisio_definition
115
116
    - mvn -DskipTests=true clean install -pl pathvisio -am
    - mvn test -pl pathvisio
Piotr Gawron's avatar
Piotr Gawron committed
117
    - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' pathvisio/target/site/jacoco/jacoco.csv
118

Piotr Gawron's avatar
Piotr Gawron committed
119
120
.test_backend_persist_template:
  script: &test_backend_persist_definition
Piotr Gawron's avatar
Piotr Gawron committed
121
    - mkdir /etc/minerva/
122
    - cp test-db-ci.properties /etc/minerva/db.properties
123
124
    - mvn -DskipTests=true clean install -pl persist -am
    - mvn test -pl persist
Piotr Gawron's avatar
Piotr Gawron committed
125
    - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' persist/target/site/jacoco/jacoco.csv
126

Piotr Gawron's avatar
Piotr Gawron committed
127
128
.test_backend_rest_template:
  script: &test_backend_rest_definition
129
    - mkdir /etc/minerva/
130
    - cp test-db-ci.properties /etc/minerva/db.properties
131
132
    - mvn -DskipTests=true clean install -pl rest-api -am
    - mvn test -pl rest-api
Piotr Gawron's avatar
Piotr Gawron committed
133
    - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' rest-api/target/site/jacoco/jacoco.csv
134

Piotr Gawron's avatar
Piotr Gawron committed
135
136
.test_backend_web_template:
  script: &test_backend_web_definition
137
138
139
140
    - apt-get update
    - DEBIAN_FRONTEND=noninteractive apt-get install -y curl gnupg git ant
    - curl -sL https://deb.nodesource.com/setup_9.x | bash -
    - DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs
141
142
143
144
    - mkdir /etc/minerva/
    - cp test-db-ci.properties /etc/minerva/db.properties
    - mvn -DskipTests=true clean install -pl web -am
    - mvn test -pl web
Piotr Gawron's avatar
Piotr Gawron committed
145
    - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' web/target/site/jacoco/jacoco.csv
146

Piotr Gawron's avatar
Piotr Gawron committed
147
148
.test_backend_service_template:
  script: &test_backend_service_definition
149
    - mkdir /etc/minerva/
150
    - cp test-db-ci.properties /etc/minerva/db.properties
151
152
    - mvn -DskipTests=true clean install -pl service -am
    - mvn test -pl service
Piotr Gawron's avatar
Piotr Gawron committed
153
    - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' service/target/site/jacoco/jacoco.csv
154

Piotr Gawron's avatar
Piotr Gawron committed
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175

test:backend:commons:jdk-8:
  <<: *jdk_8_definition
  script: *test_backend_commons_definition

test:backend:commons:jdk-11:
  <<: *jdk_11_definition
  script: *test_backend_commons_definition

test:backend:annotation:jdk-8:
  <<: *jdk_8_definition
  script: *test_backend_annotation_definition

test:backend:annotation:jdk-11:
  <<: *jdk_11_definition
  script: *test_backend_annotation_definition

test:backend:CellDesigner_plugin:jdk-8:
  <<: *jdk_8_definition
  script: *test_backend_CellDesigner_plugin_definition

176
177
178
179
#CellDesigner is working on java 8 and is incompatible with java 11
#test:backend:CellDesigner_plugin:jdk-11:
#  <<: *jdk_11_definition
#  script: *test_backend_CellDesigner_plugin_definition
Piotr Gawron's avatar
Piotr Gawron committed
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268

test:backend:converter:jdk-8:
  <<: *jdk_8_definition
  script: *test_backend_converter_definition

test:backend:converter:jdk-11:
  <<: *jdk_11_definition
  script: *test_backend_converter_definition

test:backend:converter_graphics:jdk-8:
  <<: *jdk_8_definition
  script: *test_backend_converter_graphics_definition

test:backend:converter_graphics:jdk-11:
  <<: *jdk_11_definition
  script: *test_backend_converter_graphics_definition

test:backend:converter_SBGNML:jdk-8:
  <<: *jdk_8_definition
  script: *test_backend_converter_SBGNML_definition

test:backend:converter_SBGNML:jdk-11:
  <<: *jdk_11_definition
  script: *test_backend_converter_SBGNML_definition

test:backend:converter_SBML:jdk-8:
  <<: *jdk_8_definition
  script: *test_backend_converter_SBML_definition

test:backend:converter_SBML:jdk-11:
  <<: *jdk_11_definition
  script: *test_backend_converter_SBML_definition

test:backend:model:jdk-8:
  <<: *jdk_8_definition
  script: *test_backend_model_definition

test:backend:model:jdk-11:
  <<: *jdk_11_definition
  script: *test_backend_model_definition

test:backend:model_command:jdk-8:
  <<: *jdk_8_definition
  script: *test_backend_model_command_definition

test:backend:model_command:jdk-11:
  <<: *jdk_11_definition
  script: *test_backend_model_command_definition

test:backend:pathvisio:jdk-8:
  <<: *jdk_8_definition
  script: *test_backend_pathvisio_definition

test:backend:pathvisio:jdk-11:
  <<: *jdk_11_definition
  script: *test_backend_pathvisio_definition

test:backend:persist:jdk-8:
  <<: *jdk_8_definition
  script: *test_backend_persist_definition

test:backend:persist:jdk-11:
  <<: *jdk_11_definition
  script: *test_backend_persist_definition

test:backend:rest:jdk-8:
  <<: *jdk_8_definition
  script: *test_backend_rest_definition

test:backend:rest:jdk-11:
  <<: *jdk_11_definition
  script: *test_backend_rest_definition

test:backend:service:jdk-8:
  <<: *jdk_8_definition
  script: *test_backend_service_definition

test:backend:service:jdk-11:
  <<: *jdk_11_definition
  script: *test_backend_service_definition

test:backend:web:jdk-8:
  <<: *jdk_8_definition
  script: *test_backend_web_definition

test:backend:web:jdk-11:
  <<: *jdk_11_definition
  script: *test_backend_web_definition

269
build_war:
Piotr Gawron's avatar
Piotr Gawron committed
270
  image: maven:3.6.0-jdk-8
271
  stage: build
272
273
  only:
    - tags
Piotr Gawron's avatar
Piotr Gawron committed
274
275
  tags:
     - privileged
276
  artifacts:
Piotr Gawron's avatar
Piotr Gawron committed
277
    expire_in: 1 day
278
279
280
    paths:
      - minerva.war
  script:
281
    - apt-get update
282
    - DEBIAN_FRONTEND=noninteractive apt-get install -y curl gnupg git ant
283
    - curl -sL https://deb.nodesource.com/setup_9.x | bash -
284
    - DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs
285
286
287
    - ant maven-build
    - cp web/target/web-1.0.war minerva.war

Piotr Gawron's avatar
Piotr Gawron committed
288
test:dependency_conflict:
Piotr Gawron's avatar
Piotr Gawron committed
289
  image: maven:3.6.0-jdk-8
290
  stage: test
291
292
  script:
    - apt-get update
293
    - DEBIAN_FRONTEND=noninteractive apt-get install -y curl gnupg git ant
294
    - curl -sL https://deb.nodesource.com/setup_9.x | bash -
295
    - DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs
296
297

    - mvn clean install -DskipTests=true
298
299
300
    - set +e
    - mvn dependency:tree -Dverbose | grep conflict | cat > conflicts.txt
    - set -e
301
302
303
304
305
    - conflicts=`cat conflicts.txt| wc -l`
    - echo Found conflicts $conflicts ':'
    - cat conflicts.txt
    - test 0 = $conflicts

306
307
build_debian_package:
  image: debian
Piotr Gawron's avatar
Piotr Gawron committed
308
  stage: packaging
309
310
  only:
    - tags
311
312
  tags:
     - privileged
313
314
  dependencies:
    - build_war
315
316
317
318
  artifacts:
    paths:
      - "debian/*.deb"
  script:
319
    - mkdir web/target/
Piotr Gawron's avatar
Piotr Gawron committed
320
    - mv minerva.war web/target/web-1.0.war
321
    - apt-get update
322
    - DEBIAN_FRONTEND=noninteractive apt-get install -y dh-make build-essential lintian devscripts xsltproc fakeroot xsltproc docbook-xsl
323
324
    - export DEBFULLNAME="Piotr Gawron"
    - export DEBEMAIL="piotr.gawron@uni.lu"
325
    - debian/create-debian-pkg.sh
326

Piotr Gawron's avatar
Piotr Gawron committed
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
test_upgrade_debian_package:
  image: debian
  stage: test
  only:
    - tags
# we need to run it in privileged mode due to: https://stackoverflow.com/questions/29683231/tomcat7-fail-to-start-inside-ubuntu-docker-container
  tags:
     - privileged
  services:
     - name: piotrgawron/debian-repo
       alias: debian-repo
  dependencies:
     - build_debian_package
  script:
     - apt-get update
342
343
     - DEBIAN_FRONTEND=noninteractive apt-get install -y ssh software-properties-common dirmngr wget curl apt-transport-https postgresql
     - service postgresql start
Piotr Gawron's avatar
Piotr Gawron committed
344
345
346
347
348
     - debian_file=$(ls debian/*.deb)
     - version=$(echo $debian_file| cut -f2 -d"_")
     - echo "PUT $debian_file /docker/incoming" | sftp -o StrictHostKeyChecking=no user@debian-repo
     - ssh root@debian-repo /usr/local/sbin/reprepro-import
     - apt-add-repository "deb http://repo-r3lab.uni.lu/debian/ stable main"
Piotr Gawron's avatar
Piotr Gawron committed
349
     - apt-key adv --no-tty --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xcb185f4e31872412
350
351
352
353
354
355
     - echo debconf minerva/internal/skip-preseed boolean true | debconf-set-selections
     - echo debconf minerva/dbconfig-install select true | debconf-set-selections
     - echo debconf minerva/pgsql/app-pass select secret_password | debconf-set-selections
     - echo debconf minerva/remote/host select localhost | debconf-set-selections
     - echo debconf minerva/db/dbname select minerva_db | debconf-set-selections
     - echo debconf minerva/db/app-user select minerva_user@localhost | debconf-set-selections
Piotr Gawron's avatar
Piotr Gawron committed
356
357
358
     - apt-get update
#hacky way of installing minerva on docker - by default rc-invoke is preventing services changes on docker
     - mv /usr/sbin/policy-rc.d /usr/sbin/policy-rc.d.backup
Piotr Gawron's avatar
Piotr Gawron committed
359
     - mv gitlab-ci-policy-rc.d /usr/sbin/policy-rc.d
360
     - chmod 0755 /usr/sbin/policy-rc.d
361
     - DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated minerva
Piotr Gawron's avatar
Piotr Gawron committed
362
363
364
365
366

#local repository with new version
     - apt-add-repository "deb http://debian-repo/ unstable main"
     - apt-get update
     - apt-get dist-upgrade -y --allow-unauthenticated
Piotr Gawron's avatar
Piotr Gawron committed
367
     - mv /usr/sbin/policy-rc.d.backup /usr/sbin/policy-rc.d
Piotr Gawron's avatar
Piotr Gawron committed
368
369
370
371
372
373
374
375
376
377
     - service tomcat8 start
#we need to wait a bit for tomcat start
     - sleep 15
     - wget http://localhost:8080/minerva/

#test if we can login and get configuration using new version
     - test 200 = $(curl --write-out %{http_code} --silent --output /dev/null -c cookie.txt http://localhost:8080/minerva/api/doLogin)
     - test 200 = $(curl --write-out %{http_code} --silent --output configuration.json --cookie cookie.txt http://localhost:8080/minerva/api/configuration/)
     - test 1 = $(cat configuration.json| grep $version | wc -l)

378
test_install_debian_package:
379
380
  image: debian
  stage: test
381
382
  only:
    - tags
Piotr Gawron's avatar
Piotr Gawron committed
383
# we need to run it in privileged mode due to: https://stackoverflow.com/questions/29683231/tomcat7-fail-to-start-inside-ubuntu-docker-container
384
385
  tags:
     - privileged
386
387
388
  services:
     - name: piotrgawron/debian-repo
       alias: debian-repo
389
390
  dependencies:
     - build_debian_package
391
392
  script:
     - apt-get update
393
394
     - DEBIAN_FRONTEND=noninteractive apt-get install -y ssh software-properties-common dirmngr wget curl postgresql
     - service postgresql start
395
     - debian_file=$(ls debian/*.deb)
Piotr Gawron's avatar
Piotr Gawron committed
396
     - echo "PUT $debian_file /docker/incoming" | sftp -o StrictHostKeyChecking=no user@debian-repo
397
398
     - ssh root@debian-repo /usr/local/sbin/reprepro-import
     - apt-add-repository "deb http://debian-repo/ unstable main"
399
400
401
402
403
404
     - echo debconf minerva/internal/skip-preseed boolean true | debconf-set-selections
     - echo debconf minerva/dbconfig-install select true | debconf-set-selections
     - echo debconf minerva/pgsql/app-pass select secret_password | debconf-set-selections
     - echo debconf minerva/remote/host select localhost | debconf-set-selections
     - echo debconf minerva/db/dbname select minerva_db | debconf-set-selections
     - echo debconf minerva/db/app-user select minerva_user@localhost | debconf-set-selections
405
     - apt-get update
Piotr Gawron's avatar
Piotr Gawron committed
406
#hacky way of installing minerva on docker - by default rc-invoke is preventing services changes on docker
407
     - mv /usr/sbin/policy-rc.d /usr/sbin/policy-rc.d.backup
Piotr Gawron's avatar
Piotr Gawron committed
408
     - mv gitlab-ci-policy-rc.d /usr/sbin/policy-rc.d
409
     - chmod 0755 /usr/sbin/policy-rc.d
410
     - DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated minerva
411
412
     - mv /usr/sbin/policy-rc.d.backup /usr/sbin/policy-rc.d 
     - service tomcat8 start
Piotr Gawron's avatar
Piotr Gawron committed
413
#we need to wait a bit for tomcat start
414
415
     - sleep 15
     - wget http://localhost:8080/minerva/
Piotr Gawron's avatar
Piotr Gawron committed
416
#test if we can login and list projects
417
418
419
     - test 200 = $(curl --write-out %{http_code} --silent --output /dev/null -c cookie.txt http://localhost:8080/minerva/api/doLogin)
     - test 200 = $(curl --write-out %{http_code} --silent --output /dev/null --cookie cookie.txt http://localhost:8080/minerva/api/projects/)

Piotr Gawron's avatar
Piotr Gawron committed
420
421
build_rpm:
  image: centos:7
Piotr Gawron's avatar
Piotr Gawron committed
422
  stage: packaging
Piotr Gawron's avatar
Piotr Gawron committed
423
424
  dependencies:
    - build_war
425
426
  only:
    - tags
Piotr Gawron's avatar
Piotr Gawron committed
427
428
429
430
431
432
433
434
  tags:
     - privileged
  artifacts:
    paths:
      - "rpm/rpmbuildtemp/RPMS/noarch/minerva-*.rpm"
  script:
    - yum -y install rpmdevtools unzip
    - rpm/buildrpm.sh minerva.war
435

Piotr Gawron's avatar
Piotr Gawron committed
436
437
438
439
440
441
442
rpmlint:
  image: centos:7
  stage: test
  dependencies:
    - build_rpm
  tags:
     - privileged
443
444
  only:
    - tags
Piotr Gawron's avatar
Piotr Gawron committed
445
446
447
  script:
    - yum -y install rpmlint
    - rpmlint rpm/rpmbuildtemp/RPMS/noarch/minerva-*.rpm
Piotr Gawron's avatar
Piotr Gawron committed
448

449
450
451
452
453
454
455
456
457
458
459
460
461
test_deploy_with_db_without_superadmin_rights:
  image: tomcat:7-jre8
  stage: test
  services:
    - postgres:9.6
  dependencies:
    - build_war
  tags:
    - privileged
  only:
    - tags
  script:
    - apt-get update
462
    - DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql-client
463
464
465
466
467
468
    - mkdir /etc/minerva
    - echo "database.uri=jdbc:postgresql://postgres:5432/test" > /etc/minerva/db.properties
    - echo "database.username=test" >> /etc/minerva/db.properties
    - echo "database.password=test" >> /etc/minerva/db.properties
    - echo "CREATE DATABASE test;CREATE USER test WITH ENCRYPTED PASSWORD 'test';GRANT ALL PRIVILEGES ON DATABASE test TO test;" >tmp.sql
    - PGPASSWORD=$POSTGRES_PASSWORD psql -h postgres -U $POSTGRES_USER $POSTGRES_DB < tmp.sql
469
    - mv minerva.war /usr/local/tomcat/webapps/minerva.war
470
471
    - /usr/local/tomcat/bin/startup.sh
    - sleep 15
472
    - wget http://localhost:8080/minerva/
473
474
475
476
#test if we can login and list projects
    - test 200 = $(curl --write-out %{http_code} --silent --output /dev/null -c cookie.txt http://localhost:8080/minerva/api/doLogin)
    - test 200 = $(curl --write-out %{http_code} --silent --output /dev/null --cookie cookie.txt http://localhost:8080/minerva/api/projects/)

477
478

.test_database_template: &test_database_definition
479
480
481
482
483
484
485
486
  image: maven:3.6.0-jdk-8
  stage: test
  script:
    - mkdir /etc/minerva/
    - cp test-db-ci.properties /etc/minerva/db.properties
    - mvn -DskipTests=true clean install -pl persist -am
    - mvn test -pl persist

487
488
489
490
491
test_postgres_9_3_compatibility:
  <<: *test_database_definition
  services:
    - postgres:9.3

492
test_postgres_10_compatibility:
493
  <<: *test_database_definition
494
495
496
497
  services:
    - postgres:10

test_postgres_11_compatibility:
498
  <<: *test_database_definition
499
500
  services:
    - postgres:11