.gitlab-ci.yml 15.8 KB
Newer Older
Siebers, Michael's avatar
Siebers, Michael committed
1
stages:
2
3
4
5
  - unit_test1
  - unit_test2
  - integration_test
  - pre_build
Siebers, Michael's avatar
Siebers, Michael committed
6
7
8
  - build
  - validate
  - deploy
Siebers, Michael's avatar
Siebers, Michael committed
9

10
variables:
Siebers, Michael's avatar
Siebers, Michael committed
11
  SWI_VERSION: 8.2.2
12
  CONTAINER_DEPLOY_IMAGE: "webapi"
13
  SYSTEM_TEST_IMAGE: "testing/system"
14
  FORCE_UNIT_TESTS:
15
    value: "no"
16
17
    description: >
      Change this variable to "yes" to run unit tests whether required or not. 
18
19
20
21
22
23
      Per default, unit tests run fully for tag commits, run fully for commits 
      on the default branch, and run for MR pipelines targetting the default 
      branch if files depended on have changed. If forced, unit tests run for 
      all MR pipelines if files depended on have changed and run fully for all
      commits on branches without MR.
  FORCE_INTEGRATION_TESTS: 
24
    value: "no"
25
26
27
28
29
30
31
32
    description: >
      Change this variable to "yes" to run integration tests whether required or
      not. Per default, integration tests run fully for tag commits, run fully 
      for commits on the default branch, and run for MR pipelines targetting the 
      default branch if files depended on have changed. If forced, integration
      tests run for all MR pipelines if files depended on have changed and run 
      fully for all commits on branches without MR.
  FORCE_SYSTEM_TESTS: 
Siebers, Michael's avatar
Siebers, Michael committed
33
    value: "no"
34
35
36
37
38
    description: >
      Change this variable to "yes" to run system tests whether required or
      not. Per default, system tests run for tag commits, commits on the default
      branch, and MR pipelines targetting the default branch. If forced, system 
      tests run for all MR pipelines and all commits on branches without MR.
39
  FORCE_DOCKER_BUILD:
40
    value: "no"
41
42
43
44
    description: >
      Change this variable to "yes" to build a docker image for branches other
      than the default branch.

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

# NOTE: Several of job's rules could be simplified or easier to understand by 
#       using workflow:variables. However, this feature is currently not 
#       available at our GitLab server.
#
#       Assuming all variables are initialized to "no", the following might
#       do the trick.
#
# workflow:
#   rules:
#     - if: $CI_PIPELINE_SOURCE == "merge_request_event" 
#           && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
#       variables:
#         MERGE_TO_MASTER: "yes"
#     - if: $CI_PIPELINE_SOURCE == "merge_request_event" 
#       variables:
#         MERGE_TO_OTHER: "yes"
#     - if: $CI_COMMIT_TAG
#       variables:
#         CREATE_TAG: "yes"
#     - if: $CI_PIPELINE_SOURCE == "push"
#           && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
#       variables:
#         PUSH_TO_MASTER: "yes"
#     - if: $CI_PIPELINE_SOURCE == "push"
#           && ($CI_OPEN_MERGE_REQUESTS == null || $CI_OPEN_MERGE_REQUESTS == "")
#       variables:
#         PUSH_TO_OTHER: "yes"
#         PUSH_TO_OTHER_WITHOUT_MR: "yes"
#     - if: $CI_PIPELINE_SOURCE == "push"
#       variables:
#         PUSH_TO_OTHER: "yes"
#         PUSH_TO_OTHER_WITH_MR: "yes"
#


Siebers, Michael's avatar
Siebers, Michael committed
81

82
83
# Template for Prolog test jobs
.prolog_test:
Siebers, Michael's avatar
Siebers, Michael committed
84
85
  image: swipl:$SWI_VERSION
  script:
Siebers, Michael's avatar
Siebers, Michael committed
86
    - swipl "tests/plunit/${TEST_FILE}" > "${REPORT_PATH}"
Siebers, Michael's avatar
Siebers, Michael committed
87
88
89
90
91
  timeout: 15m
  artifacts:
    paths:
      - "$REPORT_PATH"
    expire_in: 3 days
92
93


Siebers, Michael's avatar
Siebers, Michael committed
94
test_theory_common:
Siebers, Michael's avatar
Siebers, Michael committed
95
  extends: .prolog_test
96
  stage: unit_test1
Siebers, Michael's avatar
Siebers, Michael committed
97
98
99
100
  variables:
    TEST_FILE: irrelevance_common.plt
    REPORT_PATH: coverage_irrelevance_common
  rules:
101
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" 
102
103
          &&  ( $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
              || $FORCE_UNIT_TESTS == "yes" )
Siebers, Michael's avatar
Siebers, Michael committed
104
105
      changes:
        - irrelevance_common.pl
Siebers, Michael's avatar
Siebers, Michael committed
106
107
108
        - tests/plunit/irrelevance_common.plt
        - tests/plunit/test_utils.pl
        - tests/plunit/data_theory_common.pl
Siebers, Michael's avatar
Siebers, Michael committed
109
    - if: $CI_COMMIT_TAG
110
111
    - if: $CI_PIPELINE_SOURCE == "push" 
          && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
Siebers, Michael's avatar
Siebers, Michael committed
112
113
114
    - if: $CI_PIPELINE_SOURCE == "push" 
          && ($CI_OPEN_MERGE_REQUESTS == null || $CI_OPEN_MERGE_REQUESTS == "")
          && $FORCE_UNIT_TESTS == "yes"
Siebers, Michael's avatar
Siebers, Michael committed
115

116

Siebers, Michael's avatar
Siebers, Michael committed
117
test_web_api:
Siebers, Michael's avatar
Siebers, Michael committed
118
  extends: .prolog_test
119
  stage: unit_test2
Siebers, Michael's avatar
Siebers, Michael committed
120
121
122
123
  variables:
    TEST_FILE: web_api.plt
    REPORT_PATH: coverage_web_api
  rules:
124
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" 
125
126
          &&  ( $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
              || $FORCE_UNIT_TESTS == "yes" )
Siebers, Michael's avatar
Siebers, Michael committed
127
128
129
      changes:
        - src/web_api.pl
        - src/web_api/*.pl
Siebers, Michael's avatar
Siebers, Michael committed
130
131
132
        - tests/plunit/web_api.plt
        - tests/plunit/test_utils.pl
        - tests/plunit/web_api/*.plt
Siebers, Michael's avatar
Siebers, Michael committed
133
    - if: $CI_COMMIT_TAG
134
135
    - if: $CI_PIPELINE_SOURCE == "push" 
          && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
Siebers, Michael's avatar
Siebers, Michael committed
136
137
138
    - if: $CI_PIPELINE_SOURCE == "push" 
          && ($CI_OPEN_MERGE_REQUESTS == null || $CI_OPEN_MERGE_REQUESTS == "")
          && $FORCE_UNIT_TESTS == "yes"
139
140


Siebers, Michael's avatar
Siebers, Michael committed
141
142

test_types:
Siebers, Michael's avatar
Siebers, Michael committed
143
  extends: .prolog_test
144
  stage: unit_test2
Siebers, Michael's avatar
Siebers, Michael committed
145
146
147
148
  variables:
    TEST_FILE: types.plt
    REPORT_PATH: coverage_types
  rules:
149
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" 
150
151
          &&  ( $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
              || $FORCE_UNIT_TESTS == "yes" )
Siebers, Michael's avatar
Siebers, Michael committed
152
153
      changes:
        - src/types.pl
Siebers, Michael's avatar
Siebers, Michael committed
154
155
156
        - tests/plunit/types.plt
        - tests/plunit/types/*.plt
        - tests/plunit/test_utils.pl
Siebers, Michael's avatar
Siebers, Michael committed
157
    - if: $CI_COMMIT_TAG
158
159
    - if: $CI_PIPELINE_SOURCE == "push" 
          && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
Siebers, Michael's avatar
Siebers, Michael committed
160
161
162
    - if: $CI_PIPELINE_SOURCE == "push" 
          && ($CI_OPEN_MERGE_REQUESTS == null || $CI_OPEN_MERGE_REQUESTS == "")
          && $FORCE_UNIT_TESTS == "yes"
163
  needs: []
164
  
Siebers, Michael's avatar
Siebers, Michael committed
165

Siebers, Michael's avatar
Siebers, Michael committed
166
167
.test_start_stop:
  image: swipl:$SWI_VERSION
168
  stage: integration_test
Siebers, Michael's avatar
Siebers, Michael committed
169
170
171
172
  variables:
    START_SCRIPT: undefined
  timeout: 5m
  rules:
173
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" 
174
175
          &&  ( $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
              || $FORCE_INTEGRATION_TESTS == "yes" )
Siebers, Michael's avatar
Siebers, Michael committed
176
177
178
179
      changes:
        - $START_SCRIPT
        - app_common.pl
        - src/**/*.pl
180
181
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" 
          && $FORCE_INTEGRATION_TESTS == "yes"
Siebers, Michael's avatar
Siebers, Michael committed
182
    - if: $CI_COMMIT_TAG
183
184
    - if: $CI_PIPELINE_SOURCE == "push" 
          && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
185
186
187
    - if: $CI_PIPELINE_SOURCE == "push" 
          && ($CI_OPEN_MERGE_REQUESTS == null || $CI_OPEN_MERGE_REQUESTS == "")
          && $FORCE_INTEGRATION_TESTS == "yes"
Siebers, Michael's avatar
Siebers, Michael committed
188
189
190
191
192
193
194
195
196
197
198
199
200
201

test_interactive:start_stop:
  extends: .test_start_stop
  variables:
    START_SCRIPT: run.pl
  script:
    - swipl -t server_stop $START_SCRIPT


test_daemon:start_stop:
  extends: .test_start_stop
  variables:
    START_SCRIPT: daemon.pl
  script:
Siebers, Michael's avatar
Siebers, Michael committed
202
    - swipl $START_SCRIPT --user nobody
Siebers, Michael's avatar
Siebers, Michael committed
203
204
205
206
    - swipl $START_SCRIPT --shutdown



Siebers, Michael's avatar
Siebers, Michael committed
207
container:build:
Siebers, Michael's avatar
Siebers, Michael committed
208
209
210
  stage: build
  script:
    - docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" ${CI_REGISTRY}
Siebers, Michael's avatar
Siebers, Michael committed
211
212
    - docker image pull "${CI_REGISTRY_IMAGE}/${CONTAINER_DEPLOY_IMAGE}:latest" || true
    - docker image pull "${CI_REGISTRY_IMAGE}/${CONTAINER_DEPLOY_IMAGE}:$CI_COMMIT_REF_SLUG" || true
Siebers, Michael's avatar
Siebers, Michael committed
213
    - "docker build --tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} ${CACHE_OPTION} ."
Siebers, Michael's avatar
Siebers, Michael committed
214
215
216
    - "docker push ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}"
  tags:
    - docker
Siebers, Michael's avatar
Siebers, Michael committed
217
218
219
220
  rules:
    - if: $CI_COMMIT_TAG
      variables:
        CACHE_OPTION: --no-cache
221
    - if: $CI_PIPELINE_SOURCE == "push" 
Siebers, Michael's avatar
Siebers, Michael committed
222
          && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
Siebers, Michael's avatar
Siebers, Michael committed
223
224
      variables:
        CACHE_OPTION: --cache-from "${CI_REGISTRY_IMAGE}/${CONTAINER_DEPLOY_IMAGE}:latest"
Siebers, Michael's avatar
Siebers, Michael committed
225
    - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH 
Siebers, Michael's avatar
Siebers, Michael committed
226
          && $FORCE_DOCKER_BUILD == "yes"
Siebers, Michael's avatar
Siebers, Michael committed
227
      variables:
Siebers, Michael's avatar
Siebers, Michael committed
228
        CACHE_OPTION: --cache-from "${CI_REGISTRY_IMAGE}/${CONTAINER_DEPLOY_IMAGE}:latest" --cache-from "${CI_REGISTRY_IMAGE}/${CONTAINER_DEPLOY_IMAGE}:${CI_COMMIT_REF_SLUG}"
Siebers, Michael's avatar
Siebers, Michael committed
229

Siebers, Michael's avatar
Siebers, Michael committed
230

Siebers, Michael's avatar
Siebers, Michael committed
231

Siebers, Michael's avatar
Siebers, Michael committed
232
container:validate:
Siebers, Michael's avatar
Siebers, Michael committed
233
  stage: validate
234
  image: 
Siebers, Michael's avatar
Siebers, Michael committed
235
    name: postman/newman:5.2.3-alpine
236
    entrypoint: ["/bin/sh", "-c"]
Siebers, Michael's avatar
Siebers, Michael committed
237
238
  services:
    - name: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}
Siebers, Michael's avatar
Siebers, Michael committed
239
      alias: webapi
Siebers, Michael's avatar
Siebers, Michael committed
240
  before_script:
241
    - node --version
Siebers, Michael's avatar
Siebers, Michael committed
242
    - newman --version
Siebers, Michael's avatar
Siebers, Michael committed
243
  script:
Siebers, Michael's avatar
Siebers, Michael committed
244
    - newman run tests/container/up_and_running.json -e tests/container/env.json --reporters junit --reporter-junit-export="container-report.xml" --bail
245
246
247
  rules:
    - if: $CI_COMMIT_TAG
    - if: $CI_PIPELINE_SOURCE == "push" 
248
249
          && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
    - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH 
Siebers, Michael's avatar
Siebers, Michael committed
250
          && $FORCE_DOCKER_BUILD == "yes"
Siebers, Michael's avatar
Siebers, Michael committed
251
252
253
  needs: 
    - job: "container:build"
      artifacts: false
Siebers, Michael's avatar
Siebers, Michael committed
254
255
256
  artifacts:
    when: always
    reports:
Siebers, Michael's avatar
Siebers, Michael committed
257
      junit: container-report.xml
Siebers, Michael's avatar
Siebers, Michael committed
258
259


Siebers, Michael's avatar
Siebers, Michael committed
260
container:deploy:
Siebers, Michael's avatar
Siebers, Michael committed
261
262
263
264
  stage: deploy
  script:
    - docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" ${CI_REGISTRY}
    - "docker image pull ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}"
265
266
    - "docker tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} ${CI_REGISTRY_IMAGE}/${CONTAINER_DEPLOY_IMAGE}:${DEPLOY_TAG}"
    - "docker push ${CI_REGISTRY_IMAGE}/${CONTAINER_DEPLOY_IMAGE}:${DEPLOY_TAG}"
Siebers, Michael's avatar
Siebers, Michael committed
267
268
269
270
271
272
273
    - "docker logout ${DEPLOY_REGISTRY}"  
  tags:
    - docker
  rules:
    - if: $CI_COMMIT_TAG
      variables:
        DEPLOY_TAG: $CI_COMMIT_REF_SLUG
274
275
    - if: $CI_PIPELINE_SOURCE == "push" 
          && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
Siebers, Michael's avatar
Siebers, Michael committed
276
277
      variables:
        DEPLOY_TAG: latest
278
    - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH 
Siebers, Michael's avatar
Siebers, Michael committed
279
          && $FORCE_DOCKER_BUILD == "yes"
Siebers, Michael's avatar
Siebers, Michael committed
280
281
      variables:
        DEPLOY_TAG: $CI_COMMIT_REF_SLUG
282
283


284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
documentation:prepare_container:
  stage: pre_build
  script:
    - "true" # dummy for now
  tags:
    - docker
  rules:
    - if: $CI_COMMIT_TAG
      variables:
        CACHE_OPTION: --no-cache
    - if: $CI_PIPELINE_SOURCE == "push"
          && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
      variables:
        CACHE_OPTION: --cache-from "${CI_REGISTRY_IMAGE}/${SYSTEM_TEST_IMAGE}:${CI_COMMIT_REF_SLUG}"


documentation:build:
301
302
303
304
305
306
307
308
309
310
  stage: build
  image: swipl:$SWI_VERSION
  variables:
    BUILD_DIR: build/docs
  script:
    - apt update
    - apt install -y wget zip python3 python3-pip
    - useradd --system webapi 
    - pip3 install lxml
    - utils/generate_documentation.sh "$BUILD_DIR" "webapi"
Siebers, Michael's avatar
Siebers, Michael committed
311
  rules:
312
    - if: $CI_PIPELINE_SOURCE == "push" 
Siebers, Michael's avatar
Siebers, Michael committed
313
          && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
Siebers, Michael's avatar
Siebers, Michael committed
314
315
316
317
318
      variables:
        NAME: latest
    - if: $CI_COMMIT_TAG
      variables:
        NAME: $CI_COMMIT_REF_SLUG
319
320
321
  artifacts:
    paths: ["${BUILD_DIR}/webapi-docs.zip"]
    name: "webapi-${NAME}-docs"
322
323
  needs: ["documentation:prepare_container"]

324
325

system_test:prepare_container:
326
  stage: pre_build
327
328
  variables:
    CACHE_OPTION: --cache-from "${CI_REGISTRY_IMAGE}/${SYSTEM_TEST_IMAGE}:${CI_COMMIT_REF_SLUG}"
329
330
  script:
    - docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" ${CI_REGISTRY}
Siebers, Michael's avatar
Siebers, Michael committed
331
    - docker image pull "${CI_REGISTRY_IMAGE}/${SYSTEM_TEST_IMAGE}:${CI_COMMIT_REF_SLUG}" || true
Siebers, Michael's avatar
Siebers, Michael committed
332
    - docker build --tag "${CI_REGISTRY_IMAGE}/${SYSTEM_TEST_IMAGE}:${CI_COMMIT_REF_SLUG}" ${CACHE_OPTION} --build-arg "SWI_VERSION=$SWI_VERSION" - < docker/Dockerfile.system_test
333
334
335
336
    - docker push "${CI_REGISTRY_IMAGE}/${SYSTEM_TEST_IMAGE}:${CI_COMMIT_REF_SLUG}"
  tags:
    - docker
  rules:
337
338
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" 
          && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
339
340
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" 
          && $FORCE_SYSTEM_TESTS == "yes"
341
342
343
    - if: $CI_COMMIT_TAG
      variables:
        CACHE_OPTION: --no-cache
344
    - if: $CI_PIPELINE_SOURCE == "push" 
Siebers, Michael's avatar
Siebers, Michael committed
345
          && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
346
347
348
    - if: $CI_PIPELINE_SOURCE == "push" 
          && ($CI_OPEN_MERGE_REQUESTS == null || $CI_OPEN_MERGE_REQUESTS == "")
          && $FORCE_SYSTEM_TESTS == "yes"
349
        
Siebers, Michael's avatar
Siebers, Michael committed
350
351
.system_test:run:
  stage: validate
Siebers, Michael's avatar
Siebers, Michael committed
352
  image: ${CI_REGISTRY_IMAGE}/${SYSTEM_TEST_IMAGE}:${CI_COMMIT_REF_SLUG}
353
354
355
356
357
  before_script:
    - node --version
    - newman --version
    - swipl --version
  script:
Siebers, Michael's avatar
Siebers, Michael committed
358
    - swipl daemon.pl --user nobody
Siebers, Michael's avatar
Siebers, Michael committed
359
    - newman run tests/api/${TEST_NAME}-tests.json -e tests/api/env.json --reporters junit --reporter-junit-export="api-report.xml"
360
    - swipl daemon.pl --shutdown
361
362
363
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" 
          && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
364
365
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" 
          && $FORCE_SYSTEM_TESTS == "yes"
366
367
    - if: $CI_COMMIT_TAG
    - if: $CI_PIPELINE_SOURCE == "push" 
Siebers, Michael's avatar
Siebers, Michael committed
368
          && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
369
370
371
    - if: $CI_PIPELINE_SOURCE == "push" 
          && ($CI_OPEN_MERGE_REQUESTS == null || $CI_OPEN_MERGE_REQUESTS == "")
          && $FORCE_SYSTEM_TESTS == "yes"
372
  needs: ["system_test:prepare_container"]
373
374
375
376
  artifacts:
    when: always
    reports:
      junit: api-report.xml
Siebers, Michael's avatar
Siebers, Michael committed
377

Siebers, Michael's avatar
Siebers, Michael committed
378
379
380
381
.system_test:run_with_data:
  extends: .system_test:run
  script:
    - swipl daemon.pl --user nobody
Siebers, Michael's avatar
Siebers, Michael committed
382
    - newman run tests/api/${TEST_NAME}-tests.json -e tests/api/env.json -d tests/api/${TEST_NAME}-data.json --reporters junit --reporter-junit-export="api-report.xml"
Siebers, Michael's avatar
Siebers, Michael committed
383
384
    - swipl daemon.pl --shutdown

Siebers, Michael's avatar
Siebers, Michael committed
385
386
387
388
.system_test:run_with_data_and_db:
  extends: .system_test:run
  script:
    - cp -f tests/api/${TEST_NAME}-theory_bg.db theory_bg.db
389
    - chown webapi theory_bg.db
Siebers, Michael's avatar
Siebers, Michael committed
390
    - swipl daemon.pl --user webapi
Siebers, Michael's avatar
Siebers, Michael committed
391
    - newman run tests/api/${TEST_NAME}-tests.json -e tests/api/env.json -d tests/api/${TEST_NAME}-data.json --reporters junit --reporter-junit-export="api-report.xml"
Siebers, Michael's avatar
Siebers, Michael committed
392
    - swipl daemon.pl --shutdown
Siebers, Michael's avatar
Siebers, Michael committed
393
394
395
396
397
398
399

.system_test:run_with_db:
  extends: .system_test:run
  script:
    - cp -f tests/api/${TEST_NAME}-theory_bg.db theory_bg.db
    - chown webapi theory_bg.db
    - swipl daemon.pl --user webapi
Siebers, Michael's avatar
Siebers, Michael committed
400
    - newman run tests/api/${TEST_NAME}-tests.json -e tests/api/env.json --reporters junit --reporter-junit-export="api-report.xml"
Siebers, Michael's avatar
Siebers, Michael committed
401
402
403
    - swipl daemon.pl --shutdown


Siebers, Michael's avatar
Siebers, Michael committed
404
405
406
407
system_test:up:
  extends: .system_test:run
  variables:
    TEST_NAME: up_and_serving
Siebers, Michael's avatar
Siebers, Michael committed
408

Siebers, Michael's avatar
Siebers, Michael committed
409
system_test:endpoint_bg@add:
Siebers, Michael's avatar
Siebers, Michael committed
410
411
  extends: .system_test:run_with_data
  variables:
Siebers, Michael's avatar
Siebers, Michael committed
412
    TEST_NAME: endpoint_bg@add
Siebers, Michael's avatar
Siebers, Michael committed
413
414
415
416
417
418

system_test:endpoint_bg@remove:
  extends: .system_test:run_with_data_and_db
  variables:
    TEST_NAME: endpoint_bg@remove

Siebers, Michael's avatar
Siebers, Michael committed
419
420
421
422
423
system_test:endpoint_bg@clear:
  extends: .system_test:run_with_db
  variables:
    TEST_NAME: endpoint_bg@clear

Siebers, Michael's avatar
Siebers, Michael committed
424
425
426
427
system_test:endpoint_bg@show:
  extends: .system_test:run_with_data_and_db
  variables:
    TEST_NAME: endpoint_bg@show
428
    
429
430
431
432
system_test:endpoint_irrelevant@file:
  extends: .system_test:run_with_data_and_db
  variables:
    TEST_NAME: endpoint_irrelevant@file
433
  allow_failure: true # see issue #63
Siebers, Michael's avatar
Siebers, Michael committed
434
435
436
437
438

system_test:endpoint_explain:
  extends: .system_test:run_with_data_and_db
  variables:
    TEST_NAME: endpoint_explain
439
440
  allow_failure: true # see issue #63

441
442
443
444
system_test:robust against wrong method:
  extends: .system_test:run_with_data
  variables:
    TEST_NAME: robust_wrong_method
Siebers, Michael's avatar
Siebers, Michael committed
445

446
system_test:robust against wrong body:
447
448
449
  extends: .system_test:run_with_data
  variables:
    TEST_NAME: robust_wrong_content_payload
450
  allow_failure: true # see issue #61
451

452
453
454
455
system_test:robust against superfluous payload:
  extends: .system_test:run_with_data
  variables:
    TEST_NAME: robust_wrong_content_empty
456
  allow_failure: true # see issue #61
457
    
458
459
460
461
system_test:bg robust against non-item payload:
  extends: .system_test:run_with_data
  variables:
    TEST_NAME: robust_bg_non_item_payload
462
463
464
465
466

system_test:irrelevant robust against non-path payload:
  extends: .system_test:run_with_data
  variables:
    TEST_NAME: robust_irrelevant@file_non_path_payload
467
  allow_failure: true # see issue #64
468

Siebers, Michael's avatar
Siebers, Michael committed
469
470
471
472
473
system_test:explain robust against non-path payload:
  extends: .system_test:run_with_data
  variables:
    TEST_NAME: robust_explain_non_path_payload

474

Siebers, Michael's avatar
Siebers, Michael committed
475
476
477
478
479
480
481
482
# If no FORCE_... variable is set to "yes", no pipeline is created for merge
# requests targetting a non-default branch. Thus, the MR cannot be merged. This
# dummy job remedies the missing pipeline.
dummy for MR:
  stage: deploy
  script: ["true"]
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
483
          && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH
Siebers, Michael's avatar
Siebers, Michael committed
484
485
486
487
488
489
490
          && $FORCE_UNIT_TESTS != "yes"
          && $FORCE_INTEGRATION_TESTS != "yes"
          && $FORCE_SYSTEM_TESTS != "yes"
          && $FORCE_DOCKER_BUILD != "yes"