-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
80 lines (72 loc) · 1.94 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
include:
- project: cs/gitlabci-templates
file: /build-image-using-kaniko.yml
image: python:3.8
stages:
- lint
- test
- generate
- deploy
linting:
before_script:
- python -m venv venv
- source venv/bin/activate
- pip install .[dev]
stage: lint
script:
- tox -e lint
- tox -e type
unit-tests:
before_script:
- python -m venv venv
- source venv/bin/activate
- pip install .[dev]
stage: test
script: tox -e unit_test
integration-tests:
before_script:
- python -m venv venv
- source venv/bin/activate
- pip install .[dev]
stage: test
script:
- tox -e integration_test
# Generate sphinx documentation and stores the artifact under docs/generated/html
generate-sphinx-documentation:
stage: generate
image: python:3.8
rules:
- if: '$CI_COMMIT_BRANCH == "develop"'
when: on_success
- if: $CI_COMMIT_TAG
when: on_success
script:
- pip install docs/
- sphinx-build -T --keep-going -b html -d _build/doctrees -c ./docs/source -D language=en ./docs/source docs/generated/html
artifacts:
paths:
- docs/generated/html
variables:
KUBERNETES_MEMORY_LIMIT: 4Gi
KUBERNETES_MEMORY_REQUEST: 4Gi
# Executes deployment of project documentation
deploy-sphinx-documentation:
stage: deploy
extends: .build-image-using-kaniko
dependencies:
- generate-sphinx-documentation
rules:
- if: '$CI_COMMIT_BRANCH == "develop"'
when: on_success
variables:
CI_REGISTRY_IMAGE: $CI_REGISTRY_IMAGE/sphinx-documentation-dev
- if: $CI_COMMIT_TAG
when: on_success
variables:
CI_REGISTRY_IMAGE: $CI_REGISTRY_IMAGE/sphinx-documentation-prod
variables:
KUBERNETES_MEMORY_LIMIT: 4Gi
KUBERNETES_MEMORY_REQUEST: 4Gi
CI_COMMIT_SHORT_SHA: $CI_COMMIT_SHORT_SHA
REGISTRY_IMAGE_TAG: $CI_COMMIT_SHORT_SHA-$(date +%s)
KANIKO_EXTRA_ARGS: "--build-arg GENERATED_DOCS_PATH=./docs/generated/html -f ./docs/Dockerfile"