-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
135 lines (122 loc) · 3.12 KB
/
.gitlab-ci.yml
File metadata and controls
135 lines (122 loc) · 3.12 KB
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
# 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
PYPI_PACKAGE_NAME: tol-sdk
include:
- project: 'tol/tol-core'
ref: v1.7.5
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: on_success
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: on_success
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
- 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: on_success
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: on_success
deploy-package:
extends: .deploy-python-package
deploy-package-public:
extends: .deploy-python-package-public
needs:
- deploy-package
deploy-doc:
stage: deploy
image: $BUILT_IMAGE
script:
- pip install sphinx sphinx-rtd-theme
- sphinx-apidoc -o doc/source/ src/tol
- sphinx-build -b html doc/source .public
- mv .public public
pages:
publish: public
only:
- production