-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
106 lines (86 loc) · 2.24 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
include:
- project: 'controls/reports/ci_templates'
ref: master
file: 'defaults.yml'
.dls_internal:
# Use Kubernetes runners
tags:
- rhel7-k8s
image:
name: gcr.io/diamond-privreg/controls/gitlab-runners:latest
before_script:
- source /etc/dlsprofile
- load_controls_modules
# Each job needs the Pipenv to be installed.
- pipenv install --dev --deploy
.dls_external:
# Use default Kubernetes runners
tags:
- argus
image:
name: python:3.7
before_script:
- pip install pipenv
- pipenv install --dev --deploy
stages:
- install
- build
- test
install packages (DLS internal):
stage: install
extends: ".dls_internal"
script:
- echo "Installation successful"
install packages:
stage: install
extends: ".dls_external"
script:
- echo "Installation successful"
build project:
stage: build
needs: ["install packages"]
extends: ".dls_external"
script:
- "pipenv run build"
tests and coverage:
stage: test
needs: ["build project"]
extends: ".dls_external"
coverage: '/TOTAL.*\s+(\d+\%)/'
script:
- pipenv run tests --junitxml=tests.xml --cov-report html
artifacts:
paths:
- tests.xml
reports:
junit: tests.xml
tests and publish coverage:
stage: test
needs: ["build project"]
extends: ".dls_internal"
rules:
# ${CI_MERGE_REQUEST_ID} only present if the below rule is used.
- if: $CI_MERGE_REQUEST_ID && $COVERAGE_REPORT_TOKEN
coverage: '/TOTAL.*\s+(\d+\%)/'
script:
- pipenv run tests --cov-report html --cov-report xml
- dls-py3 publish-coverage ${CI_PROJECT_ID} ${CI_MERGE_REQUEST_IID} ${COVERAGE_REPORT_NAME} ${COVERAGE_REPORT_TOKEN}
build and publish docs:
stage: test
needs: ["build project"]
extends: ".dls_external"
except:
variables:
- $SKIP_DOCS # Define this to skip docs build
script:
- pipenv run docs
- mkdir -p ${DOCS_PUBLISH_ROOT}/latest
- cp -rf build/html/* ${DOCS_PUBLISH_ROOT}/latest
- echo "Documentation is available at ${DOCS_PUBLISH_URL}/latest"
wheel and metadata check:
stage: test
needs: ["build project", "install packages (DLS internal)"]
extends: ".dls_internal"
script:
- dls-python3 setup.py bdist_wheel
- dls-py3 check --no-tag-check