-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
189 lines (171 loc) · 4.45 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
image: python:3.9
stages:
- analysis
- test
- end-to-end testing
- build
- deploy
documentation-coverage:
stage: analysis
allow_failure: true
script:
- pip install docstr-coverage
- docstr-coverage -F 60.0 asimov
coverage: '/Total coverage: (\d+\.\d+%)/'
flake8:
stage: analysis
script:
- pip install flake8 flake8_formatter_junit_xml
- flake8 --max-line-length=120 --format junit-xml --verbose asimov > report.xml
allow_failure: true
artifacts:
reports:
junit: report.xml
pylint:
stage: analysis
allow_failure: True
script:
- pip install pylint pylint-gitlab
- pylint --exit-zero --load-plugins=pylint_gitlab --output-format=gitlab-codeclimate asimov > codeclimate.json
artifacts:
reports:
codequality: codeclimate.json
when: always
test-python-36:
stage: test
image: python:3.6
script:
- git config --global user.email "you@example.com"
- git config --global user.name "Your Name"
- pip install -r requirements.txt
- python setup.py install
- python -m unittest discover tests/
test-python-37:
stage: test
image: python:3.7
script:
- git config --global user.email "you@example.com"
- git config --global user.name "Your Name"
- pip install -r requirements.txt
- python setup.py install
- python -m unittest discover tests/
test-python-38:
stage: test
image: python:3.8
script:
- git config --global user.email "you@example.com"
- git config --global user.name "Your Name"
- pip install -r requirements.txt
- python setup.py install
- python -m unittest discover tests/
test-python-39:
stage: test
image: python:3.9
script:
- git config --global user.email "you@example.com"
- git config --global user.name "Your Name"
- pip install -r requirements.txt
- pip install coverage
- pip install unittest-xml-reporting
- python setup.py install
- coverage run -m xmlrunner discover tests/ -o junit-reports
- coverage report
- coverage xml
artifacts:
when: always
paths:
- public/coverage.txt
reports:
junit: junit-reports/*
coverage_report:
coverage_format: cobertura
path: coverage.xml
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
test-python-310:
stage: test
image: python:3.10
script:
- git config --global user.email "you@example.com"
- git config --global user.name "Your Name"
- pip install -r requirements.txt
- pip install coverage
- python setup.py install
- python -m unittest discover tests/
# Build docs for multiple code versions
pages:
stage: build
script:
- pip install -r docs-requirements.txt
- pip install -r requirements.txt
- pip install .
- sphinx-multiversion docs/source public
- echo "<!DOCTYPE html><html><head><title>Redirecting to master branch</title><meta
charset=\"utf-8\"><meta http-equiv=\"refresh\" content=\"0; url=./master/index.html\"> <link
rel=\"canonical\" href=\"https://asimov.docs.ligo.org/asimov/master/index.html\"></head></html>"
> public/index.html
artifacts:
paths:
- public
only:
- master
wheel-36:
image: python:3.6
stage: build
script:
- pip install wheel
- python setup.py bdist_wheel --universal
dependencies: []
artifacts:
expire_in: 3h
paths:
- dist
wheel-37:
image: python:3.7
stage: build
script:
- pip install wheel
- python setup.py bdist_wheel --universal
dependencies: []
artifacts:
expire_in: 3h
paths:
- dist
wheel-38:
image: python:3.8
stage: build
script:
- pip install wheel
- pip install twine
- python setup.py bdist_wheel --universal
- twine check dist/*
dependencies: []
artifacts:
expire_in: 3h
paths:
- dist
# stage: test
include:
- template: Security/SAST.gitlab-ci.yml
include:
- template: Security/Dependency-Scanning.gitlab-ci.yml
include:
- template: Code-Quality.gitlab-ci.yml
include:
- template: Security/Secret-Detection.gitlab-ci.yml
deploy:wheel:
stage: deploy
script:
- pip install twine
- twine upload --non-interactive --skip-existing dist/*
rules:
- if: $CI_COMMIT_TAG
release_job:
stage: deploy
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG # Run this job when a tag is created
script:
- echo "running release_job"
release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
tag_name: '$CI_COMMIT_TAG'
description: '$CI_COMMIT_TAG'