-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
118 lines (107 loc) · 2.77 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
# SPDX-FileCopyrightText: 2022 Genome Research Ltd.
#
# SPDX-License-Identifier: MIT
# Used to set up the build environment
variables:
GOOGLE_CLIENT_SECRETS: $GOOGLE_CLIENT_SECRETS_DEV
BUILT_IMAGE: $CI_REGISTRY_IMAGE/tol-sdk-test-image:$CI_COMMIT_SHA
UUID_PREFIX: $CI_JOB_ID
include:
- project: 'tol/tol-core'
ref: v1.6.0
file: '/gitlab/main.yml'
# Linting is already set in main.yml
stages:
- lint
- scan
- build
- unit test
- system test
- integration test
- deploy
build-test-image:
extends: .build
variables:
DOCKERFILE: Dockerfile
PART: '.'
NAME: tol-sdk-test-image
rules:
- if: $CI_COMMIT_REF_NAME == "qa"
when: never
- if: $CI_COMMIT_REF_NAME == "staging"
when: never
- if: $CI_COMMIT_REF_NAME == "production"
when: never
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: never
- when: always
unit-test-python-package:
extends: .unit-test-python-package
image: $BUILT_IMAGE
rules:
- if: $CI_COMMIT_REF_NAME == "qa"
when: never
- if: $CI_COMMIT_REF_NAME == "staging"
when: never
- if: $CI_COMMIT_REF_NAME == "production"
when: never
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: never
- when: always
system-test-python-package:
extends: .test-python
image: $DOCKER_IMAGE
stage: system test
services:
- name: $DIND_IMAGE
alias: docker
environment:
name: system-test
variables:
TEST_TYPE: system
POSTGRES_DB: system_test
POSTGRES_USER: system_test
POSTGRES_PASSWORD: system_test
POSTGRES_HOST_AUTH_METHOD: trust
DB_URI: postgresql://system_test:system_test@db:5432/system_test
API_PATH: /api
DOCKER_HOST: "tcp://docker:2376"
DOCKER_SECURE: "true"
DOCKER_TLS_VERIFY: "1"
before_script:
- cd test/system
- docker-compose up -d db elastic
- sleep 20s
- docker-compose up -d system-test-api-sql system-test-api-elastic
script:
- docker-compose run system-test
rules:
- if: $CI_COMMIT_REF_NAME == "qa"
when: never
- if: $CI_COMMIT_REF_NAME == "staging"
when: never
- if: $CI_COMMIT_REF_NAME == "production"
when: never
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: never
- when: always
integration-test-python-package:
extends: .unit-test-python-package
image: $BUILT_IMAGE
stage: integration test
variables:
TEST_TYPE: integration
needs:
- unit-test-python-package
rules:
- if: $CI_COMMIT_REF_NAME == "qa"
when: never
- if: $CI_COMMIT_REF_NAME == "staging"
when: never
- if: $CI_COMMIT_REF_NAME == "production"
when: never
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: never
- when: always
deploy-package:
extends: .deploy-python-package