##// END OF EJS Templates
ci: move some variables closer to their usage...
marmoute -
r53102:74a9fbc1 stable
parent child Browse files
Show More
@@ -1,326 +1,327
1 1 # Don't run pipelines on branch "merge", since we're fast-forward only.
2 2 # Gitlab sees a new branch (since e.g. `topic/stable/my-topic` becomes
3 3 # `branch/stable`), but the hash hasn't changed. There is no reason to
4 4 # re-run the CI in our case, since we haven't built up any specific automation.
5 5 # Right now it's just wasted CI and developer time.
6 6 # One can still run the pipeline manually via the web interface,
7 7 # like in the case of releases, to make *extra* sure that the actual branch
8 8 # has succeeded.
9 9 workflow:
10 10 rules:
11 11 - if: $CI_COMMIT_BRANCH =~ /^branch\/.*/ && $CI_PIPELINE_SOURCE != "web"
12 12 when: never
13 13 - if: $CI_PIPELINE_SOURCE == "merge_request_event"
14 14 when: never
15 15 - if: $CI_PIPELINE_SOURCE == "push"
16 16 when: always
17 17 - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
18 18 when: never
19 19 - if: $CI_COMMIT_BRANCH
20 20 when: always
21 21
22 22 stages:
23 23 - build
24 24 - checks
25 25 - tests
26 26 - platform-compat
27 27 - py-version-compat
28 28
29 29
30 30 image: registry.heptapod.net/mercurial/ci-images/mercurial-core:$HG_CI_IMAGE_TAG
31 31
32 32 variables:
33 33 PYTHON: python
34 34 HG_CI_IMAGE_TAG: "v2.1"
35 TEST_HGTESTS_ALLOW_NETIO: "0"
36 SHOW_VERSION_OF: "$PYTHON"
37 35
38 36 .all:
39 37 # help changing all job at once when debugging
40 38 when: on_success
41 39 # make sure jobs from later steps does not wait for anything implicit before
42 40 # starting.
43 41 needs: []
44 42
45 43 .build-wheel:
46 44 extends: .all
47 45 image: "registry.heptapod.net/mercurial/ci-images/core-wheel-x86_64-c:v3.0"
48 46 stage: build
49 47 variables:
50 48 WHEEL_TYPE: ""
51 49 FLAVOR: ""
52 50 MERCURIAL_SETUP_FORCE_TRANSLATIONS: "1"
53 51 CI_CLEVER_CLOUD_FLAVOR: "XS"
54 52 before_script:
55 53 - echo $WHEEL_TYPE
56 54 - test -n "$WHEEL_TYPE"
57 55 - echo $FLAVOR
58 56 - mkdir -p wheels/$WHEEL_TYPE/$BUILD_PY_ID
59 57 script:
60 58 - /opt/python/$BUILD_PY_ID/bin/python setup.py bdist_wheel --dist-dir tmp-wheelhouse
61 59 - auditwheel repair tmp-wheelhouse/*.whl -w wheels/$WHEEL_TYPE/$BUILD_PY_ID
62 60 artifacts:
63 61 paths:
64 62 - wheels/$WHEEL_TYPE/$BUILD_PY_ID
65 63 expire_in: 1 week
66 64
67 65 build-c-wheel:
68 66 extends: .build-wheel
69 67 variables:
70 68 WHEEL_TYPE: "c"
71 69 parallel:
72 70 matrix:
73 71 - BUILD_PY_ID:
74 72 - cp38-cp38
75 73 - cp39-cp39
76 74 - cp310-cp310
77 75 - cp311-cp311
78 76 - cp312-cp312
79 77 - cp313-cp313
80 78
81 79 .runtests:
82 80 extends: .all
83 81 stage: tests
82 variables:
83 SHOW_VERSION_OF: "$PYTHON"
84 TEST_HGTESTS_ALLOW_NETIO: "0"
84 85 # The runner made a clone as root.
85 86 # We make a new clone owned by user used to run the step.
86 87 before_script:
87 88 - echo "python used, $PYTHON"
88 89 - for tool in $SHOW_VERSION_OF ; do echo '#' version of $tool; $tool --version; done
89 90 - rm -rf /tmp/mercurial-ci/ # Clean slate if not using containers
90 91 - hg clone . /tmp/mercurial-ci/ --noupdate --config phases.publish=no
91 92 - hg -R /tmp/mercurial-ci/ update `hg log --rev '.' --template '{node}'`
92 93 - cd /tmp/mercurial-ci/
93 94 - ls -1 tests/test-check-*.* > /tmp/check-tests.txt
94 95 script:
95 96 - echo "$RUNTEST_ARGS"
96 97 - echo "$WHEEL_TYPE"
97 98 - WHEEL=""
98 99 - if test -n "$WHEEL_TYPE"; then
99 100 PY_TAG=`$PYTHON -c 'import sys; v=sys.version_info; t=f"cp{v.major}{v.minor}"; print(f"{t}-{t}")'`;
100 101 echo "$PY_TAG";
101 102 test -n "PY_TAG";
102 103 WHEEL="`ls -1 $CI_PROJECT_DIR/wheels/$WHEEL_TYPE/$PY_TAG/*.whl`";
103 104 test -n "$WHEEL";
104 105 fi
105 106 - if test -n "$WHEEL"; then
106 107 echo installing from $WHEEL;
107 108 HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO" "$PYTHON" tests/run-tests.py --hg-wheel $WHEEL --color=always $RUNTEST_ARGS;
108 109 else
109 110 echo installing from source;
110 111 HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO" "$PYTHON" tests/run-tests.py --color=always $RUNTEST_ARGS;
111 112 fi
112 113
113 114 checks:
114 115 extends: .runtests
115 116 stage: checks
116 117 variables:
117 118 SHOW_VERSION_OF: "$PYTHON black clang-format"
118 119 RUNTEST_ARGS: "--time --test-list /tmp/check-tests.txt"
119 120 CI_CLEVER_CLOUD_FLAVOR: S
120 121
121 122 rust-cargo-test:
122 123 extends: .all
123 124 stage: checks
124 125 script:
125 126 - make rust-tests
126 127 - make cargo-clippy
127 128 variables:
128 129 CI_CLEVER_CLOUD_FLAVOR: S
129 130
130 131 .test-c:
131 132 extends: .runtests
132 133 variables:
133 134 RUNTEST_ARGS: " --no-rust --blacklist /tmp/check-tests.txt"
134 135 TEST_HGTESTS_ALLOW_NETIO: "1"
135 136
136 137 test-c:
137 138 extends: .test-c
138 139 needs:
139 140 - job: build-c-wheel
140 141 parallel:
141 142 matrix:
142 143 - BUILD_PY_ID: "cp311-cp311"
143 144
144 145 variables:
145 146 WHEEL_TYPE: "c"
146 147 RUNTEST_ARGS: "--blacklist /tmp/check-tests.txt"
147 148 TEST_HGTESTS_ALLOW_NETIO: "1"
148 149
149 150 test-pure:
150 151 extends: .runtests
151 152 variables:
152 153 RUNTEST_ARGS: "--pure --blacklist /tmp/check-tests.txt"
153 154
154 155 test-rust:
155 156 extends: .runtests
156 157 variables:
157 158 HGWITHRUSTEXT: cpython
158 159 RUNTEST_ARGS: "--rust --blacklist /tmp/check-tests.txt"
159 160
160 161 test-rhg:
161 162 extends: .runtests
162 163 variables:
163 164 HGWITHRUSTEXT: cpython
164 165 RUNTEST_ARGS: "--rust --rhg --blacklist /tmp/check-tests.txt"
165 166
166 167 test-chg:
167 168 extends: .runtests
168 169 variables:
169 170 RUNTEST_ARGS: "--blacklist /tmp/check-tests.txt --chg"
170 171
171 172 # note: we should probably get a full matrix for flavor Γ— py-version, but this
172 173 # is a simple start to be able to check if we break the lowest supported
173 174 # version (and 3.12 have been giving us various troubles)
174 175 test-3.8-c:
175 176 extends: .test-c
176 177 stage: py-version-compat
177 178 when: manual # avoid overloading the CI by default
178 179 variables:
179 180 PYTHON: python3.8
180 181 WHEEL_TYPE: "c"
181 182 RUNTEST_ARGS: " --blacklist /tmp/check-tests.txt"
182 183 TEST_HGTESTS_ALLOW_NETIO: "1"
183 184 needs:
184 185 - job: build-c-wheel
185 186 parallel:
186 187 matrix:
187 188 - BUILD_PY_ID: "cp38-cp38"
188 189
189 190 test-3.12-c:
190 191 extends: .test-c
191 192 stage: py-version-compat
192 193 when: manual # avoid overloading the CI by default
193 194 variables:
194 195 PYTHON: python3.12
195 196 WHEEL_TYPE: "c"
196 197 RUNTEST_ARGS: " --blacklist /tmp/check-tests.txt"
197 198 TEST_HGTESTS_ALLOW_NETIO: "1"
198 199 needs:
199 200 - job: build-c-wheel
200 201 parallel:
201 202 matrix:
202 203 - BUILD_PY_ID: "cp312-cp312"
203 204
204 205 test-3.12-rust:
205 206 extends: test-rust
206 207 stage: py-version-compat
207 208 when: manual # avoid overloading the CI by default
208 209 variables:
209 210 PYTHON: python3.12
210 211
211 212 test-3.13-c:
212 213 extends: .test-c
213 214 stage: py-version-compat
214 215 when: manual # avoid overloading the CI by default
215 216 variables:
216 217 PYTHON: python3.13
217 218 WHEEL_TYPE: "c"
218 219 RUNTEST_ARGS: " --blacklist /tmp/check-tests.txt"
219 220 TEST_HGTESTS_ALLOW_NETIO: "1"
220 221 needs:
221 222 - job: build-c-wheel
222 223 parallel:
223 224 matrix:
224 225 - BUILD_PY_ID: "cp313-cp313"
225 226
226 227 test-3.13-rust:
227 228 extends: test-rust
228 229 stage: py-version-compat
229 230 when: manual # avoid overloading the CI by default
230 231 variables:
231 232 PYTHON: python3.13
232 233
233 234 check-pytype:
234 235 extends: test-rust
235 236 stage: checks
236 237 before_script:
237 238 - export PATH="/home/ci-runner/vendor/pyenv/pyenv-2.4.7-adf3c2bccf09cdb81febcfd15b186711a33ac7a8/shims:/home/ci-runner/vendor/pyenv/pyenv-2.4.7-adf3c2bccf09cdb81febcfd15b186711a33ac7a8/bin:$PATH"
238 239 - echo "PATH, $PATH"
239 240 - hg clone . /tmp/mercurial-ci/ --noupdate --config phases.publish=no
240 241 - hg -R /tmp/mercurial-ci/ update `hg log --rev '.' --template '{node}'`
241 242 - cd /tmp/mercurial-ci/
242 243 - make local PYTHON=$PYTHON
243 244 - ./contrib/setup-pytype.sh
244 245 script:
245 246 - echo "Entering script section"
246 247 - sh contrib/check-pytype.sh
247 248
248 249 # `sh.exe --login` sets a couple of extra environment variables that are defined
249 250 # in the MinGW shell, but switches CWD to /home/$username. The previous value
250 251 # is stored in OLDPWD. Of the added variables, MSYSTEM is crucial to running
251 252 # run-tests.py- it is needed to make run-tests.py generate a `python3` script
252 253 # that satisfies the various shebang lines and delegates to `py -3`.
253 254 .windows-runtests:
254 255 extends: .all
255 256 when: manual # we don't have any Windows runners anymore at the moment
256 257 stage: platform-compat
257 258 before_script:
258 259 - C:/hgdev/MinGW/msys/1.0/bin/sh.exe --login -c 'cd "$OLDPWD" && ls -1 tests/test-check-*.* > C:/hgdev/tmp/check-tests.txt'
259 260 # TODO: find/install cvs, bzr, perforce, gpg, sqlite3
260 261
261 262 script:
262 263 - echo "Entering script section"
263 264 - echo "python used, $Env:PYTHON"
264 265 - Invoke-Expression "$Env:PYTHON -V"
265 266 - echo "$Env:RUNTEST_ARGS"
266 267 - echo "$Env:TMP"
267 268 - echo "$Env:TEMP"
268 269
269 270 - C:/hgdev/MinGW/msys/1.0/bin/sh.exe --login -c 'cd "$OLDPWD" && HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO" $PYTHON tests/run-tests.py --color=always $RUNTEST_ARGS'
270 271
271 272 windows:
272 273 extends: .windows-runtests
273 274 when: manual
274 275 tags:
275 276 - windows
276 277 variables:
277 278 RUNTEST_ARGS: "-j 8 --blacklist C:/hgdev/tmp/check-tests.txt"
278 279 PYTHON: C:/hgdev/venvs/python39-x64/Scripts/python.exe
279 280
280 281 windows-pyox:
281 282 extends: .windows-runtests
282 283 when: manual # pyoxidizer builds seem broken with --no-use-pep517
283 284 tags:
284 285 - windows
285 286 variables:
286 287 RUNTEST_ARGS: "--blacklist C:/hgdev/tmp/check-tests.txt --pyoxidized"
287 288 PYTHON: C:/hgdev/venvs/python39-x64/Scripts/python.exe
288 289
289 290 macos:
290 291 extends: .test-c
291 292 stage: platform-compat
292 293 when: manual # avoid overloading the CI by default
293 294 tags:
294 295 - macos
295 296 variables:
296 297 WHEEL_TYPE: "c"
297 298 RUNTEST_ARGS: "--blacklist /tmp/check-tests.txt"
298 299 TEST_HGTESTS_ALLOW_NETIO: "1"
299 300 needs:
300 301 - build-c-wheel-macos
301 302
302 303 # we use CIBW_SKIP="pp*" to prevent the building of pypy wheel that are neither
303 304 # needed nor working.
304 305 #
305 306 # We could use CIBW_BUILD="cp310-*" to only build the Python 3.10 wheel for now as
306 307 # this is the only one we need to test. However testing that build work on all version is useful and match what we do with Linux.
307 308 #
308 309 # The weird directory structure match the one we use for Linux to deal with the
309 310 # multiple jobs. (all this might be unnecessary)
310 311 build-c-wheel-macos:
311 312 when: manual # avoid overloading the CI by default
312 313 stage: build
313 314 tags:
314 315 - macos
315 316 script:
316 317 - rm -rf tmp-wheels
317 318 - CIBW_SKIP="pp*" cibuildwheel --output-dir tmp-wheels/
318 319 - for py_version in cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313; do
319 320 mkdir -p wheels/c/$py_version/;
320 321 mv tmp-wheels/*$py_version*.whl wheels/c/$py_version/;
321 322 done
322 323 - rm -rf tmp-wheels
323 324 artifacts:
324 325 paths:
325 326 - wheels
326 327 expire_in: 1 week
General Comments 0
You need to be logged in to leave comments. Login now