-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy path.gitlab-ci.yml
236 lines (213 loc) · 5.37 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
231
232
233
234
235
236
stages:
- image-pixi
- pixi
- image
- lint
- test
- report
- test-release
- doc
- build
- release
variables:
COVERAGE_DIR: .coverage_$CI_COMMIT_SHA
DOCKER_IMAGE_PATH: registry.heptapod.net:443/fluiddyn/fluidsim/ci/default
image: $DOCKER_IMAGE_PATH:stable
# ugly workaround https://gitlab.com/gitlab-org/gitlab/-/issues/370052#note_1207556577
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_BRANCH
- if: $CI_COMMIT_TAG
# check_bug:
# image: fluiddyn/python3-stable:lastest
# script:
# - pip index versions flit-core
# - pip install requests
# - python3.9 tmp_bug_unearth.py
image-pixi:build:
stage: image-pixi
tags:
- container-registry-push
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: '$CI_BUILD_IMAGES == "1"'
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [ "" ]
before_script:
- ""
script:
- |
cat > /kaniko/.docker/config.json <<EOF
{
"auths": {
"$CI_REGISTRY": {
"username": "$CI_REGISTRY_USER",
"password": "$CI_REGISTRY_PASSWORD"
}
}
}
EOF
- >
/kaniko/executor --context $CI_PROJECT_DIR
--dockerfile $CI_PROJECT_DIR/docker/Dockerfile_pixi
--single-snapshot
--cleanup
--destination $DOCKER_IMAGE_PATH:pixi
pixi-test:
stage: pixi
image: $DOCKER_IMAGE_PATH:pixi
needs:
- job: "image-pixi:build"
optional: true
script:
- pixi info
# - rm -rf ../transonic
# - hg clone https://foss.heptapod.net/fluiddyn/transonic ../transonic
- pixi run install-dependencies
- pixi run pip install -e . -v --no-build-isolation --no-deps -C compile-args=-j2
- pixi run pytest -v lib
- pixi run fluidsim-test -v
# currently broken because of fluidfft conda issues
# - pixi run mpirun -np 2 fluidsim-test -v --exitfirst
# Build an image for the other tasks; this should be a scheduled job, as
# it is quite unnecessary to run on every invocation.
image:build:
stage: image
needs: []
tags:
- container-registry-push
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: '$CI_BUILD_IMAGES == "1"'
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [ "" ]
before_script:
- ""
script:
- |
cat > /kaniko/.docker/config.json <<EOF
{
"auths": {
"$CI_REGISTRY": {
"username": "$CI_REGISTRY_USER",
"password": "$CI_REGISTRY_PASSWORD"
}
}
}
EOF
- >
/kaniko/executor --context $CI_PROJECT_DIR
--dockerfile $CI_PROJECT_DIR/docker/Dockerfile
--single-snapshot
--cleanup
--destination $DOCKER_IMAGE_PATH:stable
validate_code:
stage: lint
needs:
- job: "image:build"
optional: true
script:
- nox -s validate_code
test_without_fft_and_pythran:
stage: test
needs:
- job: "image:build"
optional: true
script:
- nox -s test_without_fft_and_pythran
- mkdir $COVERAGE_DIR
- cp -r .coverage/* $COVERAGE_DIR
artifacts:
paths:
- $COVERAGE_DIR/*
expire_in: 60 mins
test_with_fft_and_pythran:
stage: test
timeout: 2 hours
needs:
- job: "image:build"
optional: true
script:
- nox -s test_with_fft_and_pythran
- mkdir $COVERAGE_DIR
- cp -r .coverage/* $COVERAGE_DIR
artifacts:
paths:
- $COVERAGE_DIR/*
expire_in: 60 mins
report_coverage:
stage: report
rules:
- when: on_success
script:
- mv $COVERAGE_DIR .coverage
- pip install coverage
- coverage report
test-release:examples:
stage: test-release
needs:
- job: "image:build"
optional: true
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: '$CI_TEST_RELEASE == "1"'
script:
- nox -s test-examples
pages:
stage: doc
needs:
- job: "image:build"
optional: true
script:
- pdm sync -G doc -G fft -G test -G dev --no-self
- pdm run pip install . --config-settings=setup-args=-Dtransonic-backend=python --no-deps
- pdm run xvfb-run --auto-servernum sphinx-build -W -b html -d doc/_build/doctrees doc doc/_build/html
- mkdir -p public/$CI_COMMIT_REF_NAME
- rsync -rvc --delete doc/_build/html/* public/$CI_COMMIT_REF_NAME/
# This directory can become too large leading to error.
# It can be purged with the bottom "Clear runner caches"
# in https://foss.heptapod.net/fluiddyn/fluidsim/-/pipelines
- ls public
- echo "CI_COMMIT_REF_NAME="$CI_COMMIT_REF_NAME
- echo See https://fluiddyn.pages.heptapod.net/fluidsim/$CI_COMMIT_REF_NAME
artifacts:
name: "$CI_COMMIT_REF_NAME"
paths:
- public
expire_in: 5 days
when: always
build:package:
stage: build
before_script:
- pip install build twine
script:
- cd lib
- rm -rf dist
- python -m build
- ls dist
- twine check --strict dist/*
needs: []
artifacts:
when: always
paths:
- lib/dist
expire_in: 24 hrs
# manually set TWINE_PASSWORD in web interface to your PyPI API token
release:package:
stage: release
rules:
- if: '$CI_MERGE_REQUEST_ID'
when: never
- if: '$CI_COMMIT_TAG'
when: on_success
variables:
TWINE_USERNAME: __token__
script:
- pip install twine -U
- twine upload lib/dist/*
needs: [ "build:package" ]