forked from iqm-finland/KQCircuits
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
230 lines (216 loc) · 5.21 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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
default:
image:
name: $KQC_IMAGE_REPOSITORY
entrypoint: ['']
cache:
key: "$CI_PROJECT_ID-$CI_COMMIT_REF_SLUG"
paths:
- .pip-cache
before_script:
- ci/init_kqc.sh
tags:
- docker
test:
stage: test
parallel:
matrix:
- KLAYOUT_VERSION: [klayout27, klayout28, latest]
script:
- if [ $KLAYOUT_VERSION != "latest" ]; then pip install --force-reinstall -r "ci/requirements/${KLAYOUT_VERSION}-requirements.txt"; fi
- tox -e matrix
artifacts:
reports:
junit: test_report.xml
only:
- master
- merge_requests
- tags
except:
- schedules
static_analysis:
stage: test
script:
- pip install -r ci/requirements/pylint-gitlab-requirements.txt
- export CODEQUALITY_JSON=codeclimate.json
- >
tox -e static_analysis --
--exit-zero
--output-format=pylint_gitlab.GitlabCodeClimateReporter
--output=
- if [ $(jq '. | length' $CODEQUALITY_JSON) != "0" ]; then exit 1; else exit 0; fi # raise error if not empty
artifacts:
reports:
codequality: codeclimate.json
when: always
only:
- master
- merge_requests
- tags
except:
- schedules
shell_check:
stage: test
script:
- find . -type f \( -name '*.sh' \) | xargs shellcheck
only:
- master
- merge_requests
- tags
except:
- schedules
layer_properties:
stage: test
script:
- python util/check_layer_props.py
only:
- master
- merge_requests
- tags
except:
- schedules
verify_documentation:
stage: test
script:
- cd docs
- make html SPHINXOPTS="-W --keep-going"
after_script:
- echo "See documentation at $KQC_GITLAB_PAGES/-/jobs/$CI_JOB_ID/artifacts/docs/_build/html/index.html"
artifacts:
expose_as: 'HTML docs PNG and OAS files'
paths:
- docs/pcell_images/
- docs/_build/html/
expire_in: 1 week
when: always
only:
- merge_requests
except:
- schedules
check_package_building:
stage: test
script:
- python -m pip install -r ci/requirements/twine-requirements.txt
- cd klayout_package/python
- python -m build
- python -m twine check dist/*
only:
- merge_requests
except:
- schedules
check_confidential_strings:
stage: test
variables:
GIT_DEPTH: 0
GIT_STRATEGY: clone
FILTER_BRANCH_SQUELCH_WARNING: 1
script:
- >
bash ci/check_files_for_strings.sh "$KQC_CONFIDENTIAL_STRINGS"
"remotes/origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" "remotes/origin/$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME"
only:
refs:
- merge_requests
variables:
- $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
except:
- schedules
check_copyright_headers:
stage: test
script:
- >
python ci/check_copyright_headers.py --exclude-paths
only:
refs:
- merge_requests
variables:
- $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
except:
- schedules
check_license:
stage: test
script:
- sha256sum -c ci/license_manifest.txt
only:
refs:
- merge_requests
variables:
- $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
except:
- schedules
pages:
stage: deploy
script:
- Xvfb :99 -screen 0 640x480x24 -nolisten tcp &
- cd docs
- make html SPHINXOPTS="-W --keep-going"
- find _build/html -name "*.html" -exec sed -i "s#github.com/iqm-finland/KQCircuits#$KQC_REPOSITORY_STRING#g" {} +
- mv _build/html ../public
artifacts:
paths:
- public
only:
- master
except:
- schedules
.kaniko:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
before_script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
deploy_image:
extends: .kaniko
stage: deploy
script:
- |
if expr $CI_COMMIT_REF_NAME : "v[0-9]\+.\?[0-9]\+\?.\?[0-9]\+\?" ; then
export "LATEST=--destination $CI_REGISTRY_IMAGE:latest"
fi
- >
/kaniko/executor
--context $CI_PROJECT_DIR
--dockerfile $CI_PROJECT_DIR/ci/Dockerfile
--destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
--cache-repo=$CI_REGISTRY_IMAGE/cache
--cache=true
--build-arg KL_FILE=klayout_0.29.0-1_amd64.deb
--build-arg KL_HASH=421df42661a3d795b534da5048261044
$LATEST
only:
- master
- tags
except:
- schedules
test_image:
extends: .kaniko
stage: test
script:
- >
/kaniko/executor
--context $CI_PROJECT_DIR
--dockerfile $CI_PROJECT_DIR/ci/Dockerfile
--destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
--cache-repo=$CI_REGISTRY_IMAGE/cache
--cache=true
--build-arg KL_FILE=klayout_0.29.0-1_amd64.deb
--build-arg KL_HASH=421df42661a3d795b534da5048261044
--no-push
only:
refs:
- merge_requests
variables:
- $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
except:
- schedules
copy_github_issues:
stage: test
before_script:
- pip install -r ci/requirements/requests-requirements.txt
script:
- python ci/copy_github_issues.py $ACCESS_TOKEN ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/issues $LABELS
only:
- schedules
except:
- tags
- merge_requests