##// END OF EJS Templates
ci: for branches, use a single trigger...
marmoute -
r53151:b65f11f4 stable
parent child Browse files
Show More
@@ -1,560 +1,597 b''
1 # Don't run pipelines on branch "merge", since we're fast-forward only.
1 # Don't run pipelines on branch "merge", since we're fast-forward only.
2 # Gitlab sees a new branch (since e.g. `topic/stable/my-topic` becomes
2 # Gitlab sees a new branch (since e.g. `topic/stable/my-topic` becomes
3 # `branch/stable`), but the hash hasn't changed. There is no reason to
3 # `branch/stable`), but the hash hasn't changed. There is no reason to
4 # re-run the CI in our case, since we haven't built up any specific automation.
4 # re-run the CI in our case, since we haven't built up any specific automation.
5 # Right now it's just wasted CI and developer time.
5 # Right now it's just wasted CI and developer time.
6 # One can still run the pipeline manually via the web interface,
6 # One can still run the pipeline manually via the web interface,
7 # like in the case of releases, to make *extra* sure that the actual branch
7 # like in the case of releases, to make *extra* sure that the actual branch
8 # has succeeded.
8 # has succeeded.
9 workflow:
9 workflow:
10 rules:
10 rules:
11 - if: $CI_COMMIT_BRANCH =~ /^branch\/.*/ && $CI_PIPELINE_SOURCE != "web"
11 - if: $CI_COMMIT_BRANCH =~ /^branch\/.*/ && $CI_PIPELINE_SOURCE != "web"
12 when: never
12 when: never
13 - if: $CI_PIPELINE_SOURCE == "merge_request_event"
13 - if: $CI_PIPELINE_SOURCE == "merge_request_event"
14 when: never
14 when: never
15 - if: $CI_PIPELINE_SOURCE == "push"
15 - if: $CI_PIPELINE_SOURCE == "push"
16 when: always
16 when: always
17 - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
17 - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
18 when: never
18 when: never
19 - if: $CI_COMMIT_BRANCH
19 - if: $CI_COMMIT_BRANCH
20 when: always
20 when: always
21
21
22 stages:
22 stages:
23 - nightly-trigger
23 - build
24 - build
24 - checks
25 - checks
25 - tests
26 - tests
26 - platform-compat
27 - platform-compat
27 - py-version-compat
28 - py-version-compat
28 - upload
29 - upload
29
30
30
31
31 image: registry.heptapod.net/mercurial/ci-images/mercurial-core:$HG_CI_IMAGE_TAG
32 image: registry.heptapod.net/mercurial/ci-images/mercurial-core:$HG_CI_IMAGE_TAG
32
33
33 variables:
34 variables:
34 # to debug use:
35 # to debug use:
35 #
36 #
36 # RE_BRANCH: '/^topic/.+/.+$/'
37 # RE_BRANCH: '/^topic/.+/.+$/'
37 # RE_TOPIC: '/^xxx/'
38 # RE_TOPIC: '/^xxx/'
38 #
39 #
39 # Instead of the two following lines:
40 # Instead of the two following lines:
40 RE_BRANCH: '/^branch/.+$/'
41 RE_BRANCH: '/^branch/.+$/'
41 RE_TOPIC: '/^topic/.+/.+$/'
42 RE_TOPIC: '/^topic/.+/.+$/'
42 PYTHON: python
43 PYTHON: python
43 HG_CI_IMAGE_TAG: "v2.1"
44 HG_CI_IMAGE_TAG: "v2.1"
44 # a directory dedicated to creating files and temporary clone
45 # a directory dedicated to creating files and temporary clone
45 # with shell runner, its content is not cleaned from one call to the next,
46 # with shell runner, its content is not cleaned from one call to the next,
46 # so plan for it.
47 # so plan for it.
47 TMP_WORK_DIR: "${CI_PROJECT_DIR}/../.."
48 TMP_WORK_DIR: "${CI_PROJECT_DIR}/../.."
48 # we use CIBW_SKIP="pp*" to prevent the building of pypy wheel that are neither
49 # we use CIBW_SKIP="pp*" to prevent the building of pypy wheel that are neither
49 # needed nor working.
50 # needed nor working.
50 CIBW_SKIP: "pp*"
51 CIBW_SKIP: "pp*"
51
52
52 .all:
53 .all:
53 # help changing all job at once when debugging
54 # help changing all job at once when debugging
54 when: on_success
55 when: on_success
55 # make sure jobs from later steps does not wait for anything implicit before
56 # make sure jobs from later steps does not wait for anything implicit before
56 # starting.
57 # starting.
57 needs: []
58 needs: []
58
59
59 # dummy job that serve dependencies purpose
60 # dummy job that serve dependencies purpose
60 .dummy:
61 .dummy:
61 # smallest I know of
62 # smallest I know of
62 image: busybox
63 image: busybox
63 variables:
64 variables:
64 GIT_STRATEGY: none
65 GIT_STRATEGY: none
65 CI_CLEVER_CLOUD_FLAVOR: "XS"
66 CI_CLEVER_CLOUD_FLAVOR: "XS"
66 script:
67 script:
67 - echo 'nothing to see here'
68 - echo 'nothing to see here'
68
69
69
70
70 # a dummy job that only serve to trigger others
71 # a dummy job that only serve to trigger others
71 #
72 #
72 # This is useful for two reasons:
73 # This is useful for two reasons:
73 # - the UX around parallel jobs is awful so manually starting them is unpractical
74 # - the UX around parallel jobs is awful so manually starting them is unpractical
74 # - manual starting job cannot make the pipeline "fails" and block a merge,
75 # - manual starting job cannot make the pipeline "fails" and block a merge,
75 # while "on_success" job depending on manual trigger works fine in that regard.
76 # while "on_success" job depending on manual trigger works fine in that regard.
76 .trigger:
77 .trigger:
77 extends:
78 extends:
78 - .all
79 - .all
79 - .dummy
80 - .dummy
80 when: manual
81 when: manual
81
82
83
84 trigger-nightly-build:
85 extends: .trigger
86 stage: nightly-trigger
87 rules:
88 - if: $CI_COMMIT_BRANCH =~ $RE_BRANCH
89 when: manual
90 allow_failure: true
91 - if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
92 when: never
93
82 .build-wheel:
94 .build-wheel:
83 extends: .all
95 extends: .all
84 image: "registry.heptapod.net/mercurial/ci-images/core-wheel-x86_64-c:v3.0"
96 image: "registry.heptapod.net/mercurial/ci-images/core-wheel-x86_64-c:v3.0"
85 stage: build
97 stage: build
86 variables:
98 variables:
87 WHEEL_TYPE: ""
99 WHEEL_TYPE: ""
88 FLAVOR: ""
100 FLAVOR: ""
89 MERCURIAL_SETUP_FORCE_TRANSLATIONS: "1"
101 MERCURIAL_SETUP_FORCE_TRANSLATIONS: "1"
90 CI_CLEVER_CLOUD_FLAVOR: "XS"
102 CI_CLEVER_CLOUD_FLAVOR: "XS"
91 script:
103 script:
92 - PLATFORM=`/opt/python/cp313-cp313/bin/python -c 'import sys; print(sys.platform)'`
104 - PLATFORM=`/opt/python/cp313-cp313/bin/python -c 'import sys; print(sys.platform)'`
93 - echo $WHEEL_TYPE
105 - echo $WHEEL_TYPE
94 - test -n "$WHEEL_TYPE"
106 - test -n "$WHEEL_TYPE"
95 - echo $FLAVOR
107 - echo $FLAVOR
96 - mkdir -p wheels/$PLATFORM/$WHEEL_TYPE/$BUILD_PY_ID
108 - mkdir -p wheels/$PLATFORM/$WHEEL_TYPE/$BUILD_PY_ID
97 - contrib/build-one-linux-wheel.sh $BUILD_PY_ID wheels/$PLATFORM/$WHEEL_TYPE/$BUILD_PY_ID
109 - contrib/build-one-linux-wheel.sh $BUILD_PY_ID wheels/$PLATFORM/$WHEEL_TYPE/$BUILD_PY_ID
98 artifacts:
110 artifacts:
99 paths:
111 paths:
100 - wheels/
112 - wheels/
101 expire_in: 1 week
113 expire_in: 1 week
102
114
115
103 build-c-wheel:
116 build-c-wheel:
104 extends: .build-wheel
117 extends: .build-wheel
105 variables:
118 variables:
106 WHEEL_TYPE: "c"
119 WHEEL_TYPE: "c"
107 parallel:
120 parallel:
108 matrix:
121 matrix:
109 - BUILD_PY_ID:
122 - BUILD_PY_ID:
110 - cp38-cp38
123 - cp38-cp38
111 - cp39-cp39
124 - cp39-cp39
112 - cp310-cp310
125 - cp310-cp310
113 - cp311-cp311
126 - cp311-cp311
114 - cp312-cp312
127 - cp312-cp312
115 - cp313-cp313
128 - cp313-cp313
116
129
117 .runtests:
130 .runtests:
118 extends: .all
131 extends: .all
119 stage: tests
132 stage: tests
120 variables:
133 variables:
121 SHOW_VERSION_OF: "$PYTHON"
134 SHOW_VERSION_OF: "$PYTHON"
122 TEST_HGTESTS_ALLOW_NETIO: "0"
135 TEST_HGTESTS_ALLOW_NETIO: "0"
123 FILTER: ""
136 FILTER: ""
124 FLAVOR: ""
137 FLAVOR: ""
125 RUNTEST_ARGS: ""
138 RUNTEST_ARGS: ""
126 # The runner made a clone as root.
139 # The runner made a clone as root.
127 # We make a new clone owned by user used to run the step.
140 # We make a new clone owned by user used to run the step.
128 before_script:
141 before_script:
129 - echo "python used, $PYTHON"
142 - echo "python used, $PYTHON"
130 - for tool in $SHOW_VERSION_OF ; do echo '#' version of $tool; $tool --version; done
143 - for tool in $SHOW_VERSION_OF ; do echo '#' version of $tool; $tool --version; done
131 - rm -rf "${TMP_WORK_DIR}"/mercurial-ci/ # Clean slate if not using containers
144 - rm -rf "${TMP_WORK_DIR}"/mercurial-ci/ # Clean slate if not using containers
132 - hg clone . "${TMP_WORK_DIR}"/mercurial-ci/ --noupdate --config phases.publish=no
145 - hg clone . "${TMP_WORK_DIR}"/mercurial-ci/ --noupdate --config phases.publish=no
133 - hg -R "${TMP_WORK_DIR}"/mercurial-ci/ update `hg log --rev '.' --template '{node}'`
146 - hg -R "${TMP_WORK_DIR}"/mercurial-ci/ update `hg log --rev '.' --template '{node}'`
134 - cd "${TMP_WORK_DIR}"/mercurial-ci/
147 - cd "${TMP_WORK_DIR}"/mercurial-ci/
135 - ls -1 tests/test-check-*.* > "${TMP_WORK_DIR}"/check-tests.txt
148 - ls -1 tests/test-check-*.* > "${TMP_WORK_DIR}"/check-tests.txt
136 script:
149 script:
137 - echo "$TEST_HGTESTS_ALLOW_NETIO"
150 - echo "$TEST_HGTESTS_ALLOW_NETIO"
138 - echo "$RUNTEST_ARGS"
151 - echo "$RUNTEST_ARGS"
139 - echo "$FILTER"
152 - echo "$FILTER"
140 - echo "$FLAVOR"
153 - echo "$FLAVOR"
141 - echo "$WHEEL_TYPE"
154 - echo "$WHEEL_TYPE"
142 - PORT_START=`expr 19051 + 1009 '*' $CI_CONCURRENT_ID`
155 - PORT_START=`expr 19051 + 1009 '*' $CI_CONCURRENT_ID`
143 - PORT_ARG="--port $PORT_START"
156 - PORT_ARG="--port $PORT_START"
144 - echo $PORT_ARG
157 - echo $PORT_ARG
145 - PLATFORM=`$PYTHON -c 'import sys; print(sys.platform)'`
158 - PLATFORM=`$PYTHON -c 'import sys; print(sys.platform)'`
146 - echo $PLATFORM
159 - echo $PLATFORM
147 - WHEEL_ARG=""
160 - WHEEL_ARG=""
148 - SHARDING_ARGS=""
161 - SHARDING_ARGS=""
149 - if test -n "$WHEEL_TYPE"; then
162 - if test -n "$WHEEL_TYPE"; then
150 PY_TAG=`$PYTHON -c 'import sys; v=sys.version_info; t=f"cp{v.major}{v.minor}"; print(f"{t}-{t}")'`;
163 PY_TAG=`$PYTHON -c 'import sys; v=sys.version_info; t=f"cp{v.major}{v.minor}"; print(f"{t}-{t}")'`;
151 echo "$PY_TAG";
164 echo "$PY_TAG";
152 test -n "PY_TAG";
165 test -n "PY_TAG";
153 WHEEL="`ls -1 $CI_PROJECT_DIR/wheels/$PLATFORM/$WHEEL_TYPE/$PY_TAG/*.whl`";
166 WHEEL="`ls -1 $CI_PROJECT_DIR/wheels/$PLATFORM/$WHEEL_TYPE/$PY_TAG/*.whl`";
154 test -n "$WHEEL";
167 test -n "$WHEEL";
155 echo installing from $WHEEL;
168 echo installing from $WHEEL;
156 WHEEL_ARG="--hg-wheel $WHEEL";
169 WHEEL_ARG="--hg-wheel $WHEEL";
157 echo disabling flavor as this is currently incompatible with '"--hg-wheel"';
170 echo disabling flavor as this is currently incompatible with '"--hg-wheel"';
158 FLAVOR="";
171 FLAVOR="";
159 else
172 else
160 echo installing from source;
173 echo installing from source;
161 fi;
174 fi;
162 - if [ -n "$CI_NODE_INDEX" ]; then
175 - if [ -n "$CI_NODE_INDEX" ]; then
163 echo "Running the test in multiple shard - [$CI_NODE_INDEX/$CI_NODE_TOTAL]";
176 echo "Running the test in multiple shard - [$CI_NODE_INDEX/$CI_NODE_TOTAL]";
164 SHARDING_ARGS="--shard-index $CI_NODE_INDEX --shard-total $CI_NODE_TOTAL";
177 SHARDING_ARGS="--shard-index $CI_NODE_INDEX --shard-total $CI_NODE_TOTAL";
165 echo "sharding... $SHARDING_ARGS";
178 echo "sharding... $SHARDING_ARGS";
166 fi
179 fi
167 - HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO"
180 - HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO"
168 "$PYTHON" tests/run-tests.py
181 "$PYTHON" tests/run-tests.py
169 --color=always
182 --color=always
170 $PORT_ARG
183 $PORT_ARG
171 $WHEEL_ARG
184 $WHEEL_ARG
172 $FLAVOR
185 $FLAVOR
173 $SHARDING_ARGS
186 $SHARDING_ARGS
174 $FILTER
187 $FILTER
175 $RUNTEST_ARGS;
188 $RUNTEST_ARGS;
176
189
177 checks:
190 checks:
178 extends: .runtests
191 extends: .runtests
179 stage: checks
192 stage: checks
180 variables:
193 variables:
181 SHOW_VERSION_OF: "$PYTHON black clang-format"
194 SHOW_VERSION_OF: "$PYTHON black clang-format"
182 RUNTEST_ARGS: "--time"
195 RUNTEST_ARGS: "--time"
183 FILTER: "--test-list ${TMP_WORK_DIR}/check-tests.txt"
196 FILTER: "--test-list ${TMP_WORK_DIR}/check-tests.txt"
184 CI_CLEVER_CLOUD_FLAVOR: S
197 CI_CLEVER_CLOUD_FLAVOR: S
185
198
186 rust-cargo-test:
199 rust-cargo-test:
187 extends: .all
200 extends: .all
188 stage: checks
201 stage: checks
189 script:
202 script:
190 - make rust-tests
203 - make rust-tests
191 - make cargo-clippy
204 - make cargo-clippy
192 variables:
205 variables:
193 CI_CLEVER_CLOUD_FLAVOR: S
206 CI_CLEVER_CLOUD_FLAVOR: S
194
207
195 .runtests-no-check:
208 .runtests-no-check:
196 extends: .runtests
209 extends: .runtests
197 variables:
210 variables:
198 FILTER: "--blacklist ${TMP_WORK_DIR}/check-tests.txt"
211 FILTER: "--blacklist ${TMP_WORK_DIR}/check-tests.txt"
199 TEST_HGTESTS_ALLOW_NETIO: "1"
212 TEST_HGTESTS_ALLOW_NETIO: "1"
200
213
201 .test-c:
214 .test-c:
202 extends: .runtests-no-check
215 extends: .runtests-no-check
203 variables:
216 variables:
204 FLAVOR: "--no-rust"
217 FLAVOR: "--no-rust"
205
218
206 test-c:
219 test-c:
207 extends: .test-c
220 extends: .test-c
208 needs:
221 needs:
209 - job: build-c-wheel
222 - job: build-c-wheel
210 parallel:
223 parallel:
211 matrix:
224 matrix:
212 - BUILD_PY_ID: "cp311-cp311"
225 - BUILD_PY_ID: "cp311-cp311"
213 variables:
226 variables:
214 WHEEL_TYPE: "c"
227 WHEEL_TYPE: "c"
215
228
216 test-pure:
229 test-pure:
217 extends: .runtests-no-check
230 extends: .runtests-no-check
218 variables:
231 variables:
219 FLAVOR: "--pure"
232 FLAVOR: "--pure"
220
233
221 test-rust:
234 test-rust:
222 extends: .runtests-no-check
235 extends: .runtests-no-check
223 variables:
236 variables:
224 HGWITHRUSTEXT: "cpython"
237 HGWITHRUSTEXT: "cpython"
225 FLAVOR: "--rust"
238 FLAVOR: "--rust"
226
239
227 test-rhg:
240 test-rhg:
228 extends: .runtests-no-check
241 extends: .runtests-no-check
229 variables:
242 variables:
230 HGWITHRUSTEXT: "cpython"
243 HGWITHRUSTEXT: "cpython"
231 FLAVOR: "--rust --rhg"
244 FLAVOR: "--rust --rhg"
232
245
233 test-chg:
246 test-chg:
234 extends: .runtests-no-check
247 extends: .runtests-no-check
235 variables:
248 variables:
236 FLAVOR: "--chg"
249 FLAVOR: "--chg"
237
250
238
251
239 trigger-pycompat:
252 trigger-pycompat:
240 extends: .trigger
253 extends: .trigger
241 stage: py-version-compat
254 stage: py-version-compat
255 rules:
256 - if: $CI_COMMIT_BRANCH =~ $RE_BRANCH
257 when: on_success
258 needs:
259 - trigger-nightly-build
260 - if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
261 when: manual
262 allow_failure: true
242
263
243 .test-c-pycompat:
264 .test-c-pycompat:
244 extends: .test-c
265 extends: .test-c
245 stage: py-version-compat
266 stage: py-version-compat
246 needs:
247 - trigger-pycompat
248 variables:
267 variables:
249 WHEEL_TYPE: "c"
268 WHEEL_TYPE: "c"
250
269
251 # note: we should probably get a full matrix for flavor Γ— py-version, but this
270 # note: we should probably get a full matrix for flavor Γ— py-version, but this
252 # is a simple start to be able to check if we break the lowest supported
271 # is a simple start to be able to check if we break the lowest supported
253 # version (and 3.12 have been giving us various troubles)
272 # version (and 3.12 have been giving us various troubles)
254 test-3.8-c:
273 test-3.8-c:
255 extends: .test-c-pycompat
274 extends: .test-c-pycompat
256 variables:
275 variables:
257 PYTHON: python3.8
276 PYTHON: python3.8
258 needs:
277 needs:
278 - job: trigger-pycompat
259 - job: build-c-wheel
279 - job: build-c-wheel
260 parallel:
280 parallel:
261 matrix:
281 matrix:
262 - BUILD_PY_ID: "cp38-cp38"
282 - BUILD_PY_ID: "cp38-cp38"
263
283
264 test-3.12-c:
284 test-3.12-c:
265 extends: .test-c-pycompat
285 extends: .test-c-pycompat
266 variables:
286 variables:
267 PYTHON: python3.12
287 PYTHON: python3.12
268 needs:
288 needs:
289 - job: trigger-pycompat
269 - job: build-c-wheel
290 - job: build-c-wheel
270 parallel:
291 parallel:
271 matrix:
292 matrix:
272 - BUILD_PY_ID: "cp312-cp312"
293 - BUILD_PY_ID: "cp312-cp312"
273
294
274 test-3.12-rust:
295 test-3.12-rust:
275 extends: test-rust
296 extends: test-rust
276 stage: py-version-compat
297 stage: py-version-compat
277 needs:
298 needs:
278 - trigger-pycompat
299 - trigger-pycompat
279 variables:
300 variables:
280 PYTHON: python3.12
301 PYTHON: python3.12
281
302
282 test-3.13-c:
303 test-3.13-c:
283 extends: .test-c-pycompat
304 extends: .test-c-pycompat
284 variables:
305 variables:
285 PYTHON: python3.13
306 PYTHON: python3.13
286 needs:
307 needs:
308 - job: trigger-pycompat
287 - job: build-c-wheel
309 - job: build-c-wheel
288 parallel:
310 parallel:
289 matrix:
311 matrix:
290 - BUILD_PY_ID: "cp313-cp313"
312 - BUILD_PY_ID: "cp313-cp313"
291
313
292 test-3.13-rust:
314 test-3.13-rust:
293 extends: test-rust
315 extends: test-rust
294 stage: py-version-compat
316 stage: py-version-compat
295 needs:
317 needs:
296 - trigger-pycompat
318 - trigger-pycompat
297 variables:
319 variables:
298 PYTHON: python3.13
320 PYTHON: python3.13
299
321
300 check-pytype:
322 check-pytype:
301 extends: test-rust
323 extends: test-rust
302 stage: checks
324 stage: checks
303 before_script:
325 before_script:
304 - 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"
326 - 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"
305 - echo "PATH, $PATH"
327 - echo "PATH, $PATH"
306 - hg clone . "${TMP_WORK_DIR}"/mercurial-ci/ --noupdate --config phases.publish=no
328 - hg clone . "${TMP_WORK_DIR}"/mercurial-ci/ --noupdate --config phases.publish=no
307 - hg -R "${TMP_WORK_DIR}"/mercurial-ci/ update `hg log --rev '.' --template '{node}'`
329 - hg -R "${TMP_WORK_DIR}"/mercurial-ci/ update `hg log --rev '.' --template '{node}'`
308 - cd "${TMP_WORK_DIR}"/mercurial-ci/
330 - cd "${TMP_WORK_DIR}"/mercurial-ci/
309 - make local PYTHON=$PYTHON
331 - make local PYTHON=$PYTHON
310 - ./contrib/setup-pytype.sh
332 - ./contrib/setup-pytype.sh
311 script:
333 script:
312 - echo "Entering script section"
334 - echo "Entering script section"
313 - sh contrib/check-pytype.sh
335 - sh contrib/check-pytype.sh
314
336
315 # `sh.exe --login` sets a couple of extra environment variables that are defined
337 # `sh.exe --login` sets a couple of extra environment variables that are defined
316 # in the MinGW shell, but switches CWD to /home/$username. The previous value
338 # in the MinGW shell, but switches CWD to /home/$username. The previous value
317 # is stored in OLDPWD. Of the added variables, MSYSTEM is crucial to running
339 # is stored in OLDPWD. Of the added variables, MSYSTEM is crucial to running
318 # run-tests.py- it is needed to make run-tests.py generate a `python3` script
340 # run-tests.py- it is needed to make run-tests.py generate a `python3` script
319 # that satisfies the various shebang lines and delegates to `py -3`.
341 # that satisfies the various shebang lines and delegates to `py -3`.
320
342
321 .windows:
343 .windows:
322 extends: .all
344 extends: .all
323 when: manual # we don't have any Windows runners anymore at the moment
345 when: manual # we don't have any Windows runners anymore at the moment
324 tags:
346 tags:
325 - windows
347 - windows
326 before_script:
348 before_script:
327 - C:/hgdev/MinGW/msys/1.0/bin/sh.exe --login -c 'cd "$OLDPWD" && ls -1 tests/test-check-*.* > "${TMP_WORK_DIR}"/check-tests.txt'
349 - C:/hgdev/MinGW/msys/1.0/bin/sh.exe --login -c 'cd "$OLDPWD" && ls -1 tests/test-check-*.* > "${TMP_WORK_DIR}"/check-tests.txt'
328 # TODO: find/install cvs, bzr, perforce, gpg, sqlite3
350 # TODO: find/install cvs, bzr, perforce, gpg, sqlite3
329 variables:
351 variables:
330 PYTHON: C:/hgdev/venvs/python39-x64/Scripts/python.exe
352 PYTHON: C:/hgdev/venvs/python39-x64/Scripts/python.exe
331
353
332 # a dummy job that only serve to trigger the wider windows build
354 # a dummy job that only serve to trigger the wider windows build
333 trigger-wheel-windows:
355 trigger-wheel-windows:
334 extends: .trigger
356 extends: .trigger
335 stage: build
357 stage: build
358 rules:
359 - if: $CI_COMMIT_BRANCH =~ $RE_BRANCH
360 when: never
361 - if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
362 when: manual
363 allow_failure: true
336
364
337 build-c-wheel-windows:
365 build-c-wheel-windows:
338 extends: .windows
366 extends: .windows
339 stage: build
367 stage: build
340 # wait for someone to click on "trigger-wheel-windows"
368 # wait for someone to click on "trigger-wheel-windows"
341 when: on_success
369 when: on_success
342 needs:
370 needs:
343 - "trigger-wheel-windows"
371 rules:
372 - if: $CI_COMMIT_BRANCH =~ $RE_BRANCH
373 needs:
374 - trigger-nightly-build
375 - if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
376 needs:
377 - "trigger-wheel-windows"
344 variables:
378 variables:
345 MERCURIAL_SETUP_FORCE_TRANSLATIONS: "1"
379 MERCURIAL_SETUP_FORCE_TRANSLATIONS: "1"
346 script:
380 script:
347 - echo "Entering script section"
381 - echo "Entering script section"
348 - echo "python used, $Env:PYTHON"
382 - echo "python used, $Env:PYTHON"
349 - Invoke-Expression "$Env:PYTHON -V"
383 - Invoke-Expression "$Env:PYTHON -V"
350 - echo "$Env:RUNTEST_ARGS"
384 - echo "$Env:RUNTEST_ARGS"
351 - echo "$Env:TMP"
385 - echo "$Env:TMP"
352 - echo "$Env:TEMP"
386 - echo "$Env:TEMP"
353 - "C:/hgdev/venvs/python39-x64/Scripts/python.exe -m cibuildwheel --output-dir wheels/win32"
387 - "C:/hgdev/venvs/python39-x64/Scripts/python.exe -m cibuildwheel --output-dir wheels/win32"
354 artifacts:
388 artifacts:
355 paths:
389 paths:
356 - wheels
390 - wheels
357 expire_in: 1 week
391 expire_in: 1 week
358 parallel:
392 parallel:
359 matrix:
393 matrix:
360 # "cp39" is first as it unlock the tests
394 # "cp39" is first as it unlock the tests
361 - CIBW_BUILD:
395 - CIBW_BUILD:
362 - "cp39-*"
396 - "cp39-*"
363 - "cp38-*"
397 - "cp38-*"
364 - "cp310-*"
398 - "cp310-*"
365 - "cp311-*"
399 - "cp311-*"
366 - "cp312-*"
400 - "cp312-*"
367 - "cp313-*"
401 - "cp313-*"
368 CIBW_ARCHS:
402 CIBW_ARCHS:
369 - "AMD64"
403 - "AMD64"
370 - "x86"
404 - "x86"
371 - CIBW_BUILD:
405 - CIBW_BUILD:
372 - "cp311-*"
406 - "cp311-*"
373 - "cp312-*"
407 - "cp312-*"
374 - "cp313-*"
408 - "cp313-*"
375 CIBW_ARCHS:
409 CIBW_ARCHS:
376 - "ARM64"
410 - "ARM64"
377
411
378
412
379 .windows-runtests:
413 .windows-runtests:
380 extends: .windows
414 extends: .windows
381 stage: platform-compat
415 stage: platform-compat
382 # the UX for manual parallel jobs is quite awful, and the job que depends
416 # the UX for manual parallel jobs is quite awful, and the job que depends
383 # upon are manual anyway, so we can make this start automatically once the
417 # upon are manual anyway, so we can make this start automatically once the
384 # associated wheel is ready.
418 # associated wheel is ready.
385 when: on_success
419 when: on_success
386 parallel: 20
420 parallel: 20
387 script:
421 script:
388 - echo "Entering script section"
422 - echo "Entering script section"
389 - echo "python used, $Env:PYTHON"
423 - echo "python used, $Env:PYTHON"
390 - Invoke-Expression "$Env:PYTHON -V"
424 - Invoke-Expression "$Env:PYTHON -V"
391 - echo "$Env:HGTESTS_ALLOW_NETIO"
425 - echo "$Env:HGTESTS_ALLOW_NETIO"
392 - echo "$Env:WHEEL_ARG"
426 - echo "$Env:WHEEL_ARG"
393 - echo "$Env:FLAVOR"
427 - echo "$Env:FLAVOR"
394 - echo "$Env:FILTER"
428 - echo "$Env:FILTER"
395 - echo "$Env:RUNTEST_ARGS"
429 - echo "$Env:RUNTEST_ARGS"
396 - echo "$Env:TMP"
430 - echo "$Env:TMP"
397 - echo "$Env:TEMP"
431 - echo "$Env:TEMP"
398 # This test is hanging the worker and not that important, so lets skip
432 # This test is hanging the worker and not that important, so lets skip
399 # it for now
433 # it for now
400 - C:/hgdev/MinGW/msys/1.0/bin/sh.exe -c 'cd "$OLDPWD" && echo tests/test-clonebundles-autogen.t > $TMP_WORK_DIR/windows-skip.txt'
434 - C:/hgdev/MinGW/msys/1.0/bin/sh.exe -c 'cd "$OLDPWD" && echo tests/test-clonebundles-autogen.t > $TMP_WORK_DIR/windows-skip.txt'
401
435
402 - C:/hgdev/MinGW/msys/1.0/bin/sh.exe
436 - C:/hgdev/MinGW/msys/1.0/bin/sh.exe
403 --login -c 'cd "$OLDPWD"
437 --login -c 'cd "$OLDPWD"
404 && HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO"
438 && HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO"
405 $PYTHON tests/run-tests.py
439 $PYTHON tests/run-tests.py
406 --color=always
440 --color=always
407 $WHEEL_ARG
441 $WHEEL_ARG
408 $FLAVOR
442 $FLAVOR
409 --port `expr 19051 + 1009 "*" $CI_CONCURRENT_ID`
443 --port `expr 19051 + 1009 "*" $CI_CONCURRENT_ID`
410 --shard-index $CI_NODE_INDEX --shard-total $CI_NODE_TOTAL
444 --shard-index $CI_NODE_INDEX --shard-total $CI_NODE_TOTAL
411 $FILTER
445 $FILTER
412 $RUNTEST_ARGS;
446 $RUNTEST_ARGS;
413 '
447 '
414 variables:
448 variables:
415 WHEEL_ARG: ""
449 WHEEL_ARG: ""
416 RUNTEST_ARGS: ""
450 RUNTEST_ARGS: ""
417 FLAVOR: ""
451 FLAVOR: ""
418 FILTER: "--blacklist ${TMP_WORK_DIR}/check-tests.txt --blacklist ${TMP_WORK_DIR}/windows-skip.txt"
452 FILTER: "--blacklist ${TMP_WORK_DIR}/check-tests.txt --blacklist ${TMP_WORK_DIR}/windows-skip.txt"
419
453
420 windows:
454 windows:
421 extends: .windows-runtests
455 extends: .windows-runtests
422 variables:
456 variables:
423 RUNTEST_ARGS: ""
457 RUNTEST_ARGS: ""
424 WHEEL_ARG: "--hg-wheel wheels/win32/mercurial-*-cp39-cp39-win_amd64.whl"
458 WHEEL_ARG: "--hg-wheel wheels/win32/mercurial-*-cp39-cp39-win_amd64.whl"
425 needs:
459 needs:
426 - job: build-c-wheel-windows
460 - job: build-c-wheel-windows
427 parallel:
461 parallel:
428 matrix:
462 matrix:
429 - CIBW_BUILD: "cp39-*"
463 - CIBW_BUILD: "cp39-*"
430 CIBW_ARCHS: "AMD64"
464 CIBW_ARCHS: "AMD64"
431
465
432 windows-pyox:
466 windows-pyox:
433 extends: .windows-runtests
467 extends: .windows-runtests
434 when: manual # pyoxidizer builds seem broken with --no-use-pep517
468 when: manual # pyoxidizer builds seem broken with --no-use-pep517
435 variables:
469 variables:
436 FLAVOR: "--pyoxidized"
470 FLAVOR: "--pyoxidized"
437
471
438 macos:
472 macos:
439 extends: .test-c
473 extends: .test-c
440 stage: platform-compat
474 stage: platform-compat
441 # run the test in multiple shard to help spread the load between concurrent
475 # run the test in multiple shard to help spread the load between concurrent
442 # MR as the macos runner is a shell runner there is not startup overhead
476 # MR as the macos runner is a shell runner there is not startup overhead
443 # for tests.
477 # for tests.
444 parallel: 10
478 parallel: 10
445 tags:
479 tags:
446 - macos
480 - macos
447 variables:
481 variables:
448 WHEEL_TYPE: "c"
482 WHEEL_TYPE: "c"
449 needs:
483 needs:
450 - build-c-wheel-macos
484 - build-c-wheel-macos
451
485
452 # We could use CIBW_BUILD="cp310-*" to only build the Python 3.10 wheel for now as
486 # We could use CIBW_BUILD="cp310-*" to only build the Python 3.10 wheel for now as
453 # this is the only one we need to test. However testing that build work on all
487 # this is the only one we need to test. However testing that build work on all
454 # version is useful and match what we do with Linux.
488 # version is useful and match what we do with Linux.
455 #
489 #
456 # CIBW_SKIP is set globally at the start of the file. See comment there.
490 # CIBW_SKIP is set globally at the start of the file. See comment there.
457 #
491 #
458 # The weird directory structure match the one we use for Linux to deal with the
492 # The weird directory structure match the one we use for Linux to deal with the
459 # multiple jobs. (all this might be unnecessary)
493 # multiple jobs. (all this might be unnecessary)
460 build-c-wheel-macos:
494 build-c-wheel-macos:
461 when: manual # avoid overloading the CI by default
495 rules:
496 - if: $CI_COMMIT_BRANCH =~ $RE_BRANCH
497 needs:
498 - trigger-nightly-build
499 - if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
500 when: manual # avoid overloading the CI by default
501 allow_failure: true
462 stage: build
502 stage: build
463 tags:
503 tags:
464 - macos
504 - macos
465 variables:
505 variables:
466 MERCURIAL_SETUP_FORCE_TRANSLATIONS: "1"
506 MERCURIAL_SETUP_FORCE_TRANSLATIONS: "1"
467 script:
507 script:
468 - PLATFORM=`$PYTHON -c 'import sys; print(sys.platform)'`
508 - PLATFORM=`$PYTHON -c 'import sys; print(sys.platform)'`
469 - rm -rf tmp-wheels
509 - rm -rf tmp-wheels
470 - cibuildwheel --output-dir tmp-wheels/
510 - cibuildwheel --output-dir tmp-wheels/
471 - for py_version in cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313; do
511 - for py_version in cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313; do
472 mkdir -p wheels/$PLATFORM/c/$py_version/;
512 mkdir -p wheels/$PLATFORM/c/$py_version/;
473 mv tmp-wheels/*$py_version*.whl wheels/$PLATFORM/c/$py_version/;
513 mv tmp-wheels/*$py_version*.whl wheels/$PLATFORM/c/$py_version/;
474 done
514 done
475 - rm -rf tmp-wheels
515 - rm -rf tmp-wheels
476 artifacts:
516 artifacts:
477 paths:
517 paths:
478 - wheels
518 - wheels
479 expire_in: 1 week
519 expire_in: 1 week
480
520
481
521
482 .nightly_build_step:
522 .nightly_build_step:
483 extends: .all
523 extends: .all
484 stage: upload
524 stage: upload
485 rules:
525 rules:
486 - if: '$CI_COMMIT_BRANCH =~ $RE_BRANCH'
526 - if: '$CI_COMMIT_BRANCH =~ $RE_BRANCH'
487 # note that at the time of writing this, this job depends on multiple
527 # note that at the time of writing this, this job depends on multiple
488 # manual one. So it will not run by default, but will automatically run
528 # manual one. So it will not run by default, but will automatically run
489 # if the manual jobs are triggered.
529 # if the manual jobs are triggered.
490 #
530 #
491 # Also beware that "on_success" will ignore failure of manual test we
531 # Also beware that "on_success" will ignore failure of manual test we
492 # directly depends on. This currently relevant for the "test-3.x-c"
532 # directly depends on. This currently relevant for the "test-3.x-c"
493 # tests.
533 # tests.
494 when: on_success
534 when: on_success
495 - if: '$CI_COMMIT_BRANCH =~ $RE_TOPIC'
535 - if: '$CI_COMMIT_BRANCH =~ $RE_TOPIC'
496 when: never
536 when: never
497 # if you need to test this, make it
498 # when: manual
499 # allow_failure: true
500
537
501 # a dummy job that gather greatly parallel object into one.
538 # a dummy job that gather greatly parallel object into one.
502 #
539 #
503 # It exists because gitlab-ci has a "50 jobs" limit on "needs" entries.
540 # It exists because gitlab-ci has a "50 jobs" limit on "needs" entries.
504 # (yes, this is sad)
541 # (yes, this is sad)
505 #
542 #
506 .sink:
543 .sink:
507 extends:
544 extends:
508 - .nightly_build_sink
545 - .nightly_build_step
509 - .dummy
546 - .dummy
510
547
511 linux-test-result:
548 test-result-linux:
512 extends: .sink
549 extends: .sink
513 needs:
550 needs:
514 - test-c
551 - test-c
515 - test-3.8-c
552 - test-3.8-c
516 - test-3.12-c
553 - test-3.12-c
517 - test-3.13-c
554 - test-3.13-c
518
555
519 macos-test-result:
556 test-result-macos:
520 extends: .sink
557 extends: .sink
521 needs:
558 needs:
522 - macos
559 - macos
523
560
524 windows-test-result:
561 test-result-windows:
525 extends: .sink
562 extends: .sink
526 needs:
563 needs:
527 - windows
564 - windows
528
565
529 # Upload nightly build wheel on the heptapod registry on test success
566 # Upload nightly build wheel on the heptapod registry on test success
530 #
567 #
531 # At the time this task is added, since the mac wheels are built on shell
568 # At the time this task is added, since the mac wheels are built on shell
532 # runner, those nightly are not be considered fully secured.
569 # runner, those nightly are not be considered fully secured.
533 #
570 #
534 # In addition, since any job can upload package, pretty much anyone with CI
571 # In addition, since any job can upload package, pretty much anyone with CI
535 # access can upload anything pretending to be any version. To fix it we would
572 # access can upload anything pretending to be any version. To fix it we would
536 # have to prevent the CI token to upload to the registry and have dedicated
573 # have to prevent the CI token to upload to the registry and have dedicated
537 # credential accessible only from protected branches.
574 # credential accessible only from protected branches.
538 upload-wheel-nightly:
575 upload-wheel-nightly:
539 extends: .nightly_build_step
576 extends: .nightly_build_step
540 image: "registry.heptapod.net/mercurial/ci-images/twine:v3.0"
577 image: "registry.heptapod.net/mercurial/ci-images/twine:v3.0"
541 # because we don't want to upload only half of a wheel
578 # because we don't want to upload only half of a wheel
542 interruptible: false
579 interruptible: false
543 needs:
580 needs:
544 - build-c-wheel
581 - build-c-wheel
545 - build-c-wheel-macos
582 - build-c-wheel-macos
546 - build-c-wheel-windows
583 - build-c-wheel-windows
547 - linux-test-result
584 - test-result-linux
548 - macos-test-result
585 - test-result-macos
549 - windows-test-result
586 - test-result-windows
550 # It would be nice to be able to restrict that a bit to protected branch only
587 # It would be nice to be able to restrict that a bit to protected branch only
551 variables:
588 variables:
552 TWINE_USERNAME: gitlab-ci-token
589 TWINE_USERNAME: gitlab-ci-token
553 TWINE_PASSWORD: $CI_JOB_TOKEN
590 TWINE_PASSWORD: $CI_JOB_TOKEN
554 script:
591 script:
555 - twine
592 - twine
556 upload
593 upload
557 --verbose
594 --verbose
558 --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi
595 --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi
559 wheels/*/*/*/*.whl
596 wheels/*/*/*/*.whl
560 wheels/*/*.whl
597 wheels/*/*.whl
General Comments 0
You need to be logged in to leave comments. Login now