-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
206 lines (188 loc) · 4.56 KB
/
.gitlab-ci.yml
File metadata and controls
206 lines (188 loc) · 4.56 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
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
image: ghcr.io/prefix-dev/pixi:0.62.2
variables:
FF_USE_FASTZIP: "true"
CACHE_COMPRESSION_LEVEL: "fastest"
SSH_COMMAND: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
default:
before_script:
- pixi global install git
- git config --global --add safe.directory $CI_PROJECT_DIR
- git fetch --tags
.test_template:
artifacts:
reports:
junit: tests.xml
cache:
key: "$CI_JOB_NAME"
paths:
- .pixi
- build
run tests:
parallel:
matrix:
- PIXI_ENV:
- minimal-no-extras
- minimal
- default
script:
- pixi run -e $PIXI_ENV test
extends: .test_template
run coverage:
variables:
PIXI_ENV: minimal
script:
- pixi run -e $PIXI_ENV test-cov
artifacts:
paths:
- htmlcov
reports:
junit: tests.xml
cache:
key: "$CI_JOB_NAME"
paths:
- .pixi
- build
build documentation:
variables:
PIXI_ENV: docs
script:
- pixi run -e $PIXI_ENV build-docs
artifacts:
paths:
- doc/build/html/
expire_in: 1 month
cache:
key: "$CI_JOB_NAME"
paths:
- .pixi
- build
check for broken links in doc:
variables:
PIXI_ENV: docs
script:
- pixi run -e $PIXI_ENV make -C doc linkcheck
allow_failure: true
cache:
key: "$CI_JOB_NAME"
paths:
- .pixi
- build
run pre-commit:
variables:
PRE_COMMIT_HOME: $CI_PROJECT_DIR/.pre-commit-cache
script:
- git config --global --add safe.directory $CI_PROJECT_DIR
- pixi run pre-commit run --all-files
cache:
key: "$CI_JOB_NAME"
paths:
- .pre-commit-cache
- .pixi
# Keep the existing upload jobs
## Upload coverage reports and dev documentation
upload coverage:
image: eeacms/rsync
only:
- schedules
needs:
- run coverage
environment:
name: coverage/$CI_COMMIT_REF_NAME
url: https://kwant-project.org/coverage/$CI_COMMIT_REF_SLUG
on_stop: remove_coverage
before_script:
- eval $(ssh-agent -s)
- echo $MASTER_WEBSITE_KEY | base64 -d | ssh-add -
script:
- mv htmlcov $CI_COMMIT_REF_SLUG
- rsync -rlv -e "$SSH_COMMAND" --delete --relative $CI_COMMIT_REF_SLUG kwant@kwant-project.org:coverage/
remove_coverage:
only:
- branches@kwant/kwant
when: manual
environment:
name: coverage/$CI_COMMIT_REF_NAME
action: stop
before_script:
- eval $(ssh-agent -s)
- echo $MASTER_WEBSITE_KEY | base64 -d | ssh-add -
script:
- mkdir empty/
- rsync -rlv -e "$SSH_COMMAND" --delete empty/ kwant@kwant-project.org:coverage/$CI_COMMIT_REF_SLUG
upload documentation to the test server:
image: eeacms/rsync
environment:
name: docs review/$CI_COMMIT_REF_NAME
url: https://test.kwant-project.org/doc/$CI_COMMIT_REF_SLUG
on_stop: remove_docs
needs:
- build documentation
only:
- branches@kwant/kwant
before_script:
- eval $(ssh-agent -s)
- echo $TEST_WEBSITE_KEY | base64 -d | ssh-add -
script:
- rsync -rlv -e "$SSH_COMMAND" --delete doc/build/html/* kwant2@test.kwant-project.org:doc/$CI_COMMIT_REF_SLUG
remove_docs:
image: eeacms/rsync
when: manual
only:
- branches@kwant/kwant
environment:
name: docs review/$CI_COMMIT_REF_NAME
action: stop
before_script:
- eval $(ssh-agent -s)
- echo $TEST_WEBSITE_KEY | base64 -d | ssh-add -
script:
- mkdir empty
- rsync -arv -e "$SSH_COMMAND" --delete empty/ kwant2@test.kwant-project.org:doc/$CI_COMMIT_REF_SLUG/
upload dev version docs:
image: eeacms/rsync
environment:
name: production
url: https://kwant-project.org/doc/dev
needs:
- build documentation
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PROJECT_PATH == "kwant/kwant"
before_script:
- eval $(ssh-agent -s)
- echo $MASTER_WEBSITE_KEY | base64 -d | ssh-add -
script:
- rsync -rlv -e "$SSH_COMMAND" --delete doc/build/html/* kwant@kwant-project.org:doc/dev
## Build documentation for tagged releases
.tagged-version:
only:
- /^v[0-9]+\.[0-9]+.[0-9]+$/@kwant/kwant
build distribution:
extends: .tagged-version
variables:
PIXI_ENV: default
script:
- rm -rf dist
- pixi run -e $PIXI_ENV build-dist
artifacts:
paths:
- dist/
expire_in: 1 week
cache:
key: "$CI_JOB_NAME"
paths:
- .pixi
- build
gather release artifacts:
extends: .tagged-version
needs:
- run tests
- build documentation
- build distribution
script:
- mkdir docs
- mv doc/build/html docs/html
- zip -r docs/kwant-doc-${CI_COMMIT_TAG//v}.zip docs/html
artifacts:
paths:
- docs
- dist