| 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 |
| 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. |
| 5 |
# Right now it's just wasted CI and developer time. |
| 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 |
| 8 |
# has succeeded. |
| 9 |
workflow: |
| 10 |
rules: |
| 11 |
- if: ($CI_COMMIT_BRANCH =~ /^branch\/.*/ || $CI_COMMIT_TAG) && $CI_PIPELINE_SOURCE !~ "/web|schedule/" |
| 12 |
when: never |
| 13 |
- if: ($CI_COMMIT_BRANCH =~ /^branch\/.*/ || $CI_COMMIT_TAG) && $CI_COMMIT_REF_PROTECTED == "true" |
| 14 |
when: always |
| 15 |
variables: |
| 16 |
WHEEL_MACOS_TAG: "macos-wheel" |
| 17 |
WHEEL_WINDOWS_TAG: "windows-wheel" |
| 18 |
- if: $CI_PIPELINE_SOURCE == "merge_request_event" |
| 19 |
when: never |
| 20 |
- if: $CI_PIPELINE_SOURCE == "push" |
| 21 |
when: always |
| 22 |
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS |
| 23 |
when: never |
| 24 |
- if: $CI_COMMIT_BRANCH |
| 25 |
when: always |
| 26 |
|
| 27 |
stages: |
| 28 |
- nightly-trigger |
| 29 |
- build |
| 30 |
- checks |
| 31 |
- tests |
| 32 |
- platform-compat |
| 33 |
- py-version-compat |
| 34 |
- upload |
| 35 |
|
| 36 |
|
| 37 |
image: "$HG_CI_REG/each-job-should-set-this:$HG_CI_IMAGE_TAG" |
| 38 |
|
| 39 |
variables: |
| 40 |
# to debug use: |
| 41 |
# |
| 42 |
# RE_BRANCH: '/^topic/.+/.+$/' |
| 43 |
# RE_TOPIC: '/^xxx/' |
| 44 |
# |
| 45 |
# Instead of the two following lines: |
| 46 |
RE_BRANCH: '/^branch/.+$/' |
| 47 |
RE_TOPIC: '/^topic/.+/.+$/' |
| 48 |
WHEEL_MACOS_TAG: "macos" |
| 49 |
WHEEL_WINDOWS_TAG: "windows" |
| 50 |
PYTHON: python |
| 51 |
HG_CI_REG: "registry.heptapod.net/mercurial/ci-images" |
| 52 |
HG_CI_IMAGE_TAG: "v3.3" |
| 53 |
# a directory dedicated to creating files and temporary clone |
| 54 |
# with shell runner, its content is not cleaned from one call to the next, |
| 55 |
# so plan for it. |
| 56 |
TMP_WORK_DIR: "${CI_PROJECT_DIR}/../.." |
| 57 |
|
| 58 |
.all: |
| 59 |
# help changing all job at once when debugging |
| 60 |
when: on_success |
| 61 |
# make sure jobs from later steps does not wait for anything implicit before |
| 62 |
# starting. |
| 63 |
needs: [] |
| 64 |
|
| 65 |
# dummy job that serve dependencies purpose |
| 66 |
.dummy: |
| 67 |
# smallest I know of |
| 68 |
image: busybox |
| 69 |
variables: |
| 70 |
GIT_STRATEGY: none |
| 71 |
CI_CLEVER_CLOUD_FLAVOR: "XS" |
| 72 |
script: |
| 73 |
- echo 'nothing to see here' |
| 74 |
|
| 75 |
|
| 76 |
# a dummy job that only serve to trigger others |
| 77 |
# |
| 78 |
# This is useful for two reasons: |
| 79 |
# - the UX around parallel jobs is awful so manually starting them is unpractical |
| 80 |
# - manual starting job cannot make the pipeline "fails" and block a merge, |
| 81 |
# while "on_success" job depending on manual trigger works fine in that regard. |
| 82 |
.trigger: |
| 83 |
extends: |
| 84 |
- .all |
| 85 |
- .dummy |
| 86 |
when: manual |
| 87 |
|
| 88 |
|
| 89 |
trigger-nightly-build: |
| 90 |
extends: .trigger |
| 91 |
stage: nightly-trigger |
| 92 |
rules: |
| 93 |
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG) && $CI_PIPELINE_SOURCE == "schedule" |
| 94 |
when: always |
| 95 |
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG) |
| 96 |
when: manual |
| 97 |
allow_failure: true |
| 98 |
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC |
| 99 |
when: never |
| 100 |
|
| 101 |
.build-wheel: |
| 102 |
extends: .all |
| 103 |
image: "$HG_CI_REG/core-wheel-$ARCH-$WHEEL_TYPE:$HG_CI_IMAGE_TAG" |
| 104 |
stage: build |
| 105 |
variables: |
| 106 |
ARCH: "x86_64" |
| 107 |
WHEEL_TYPE: "" |
| 108 |
FLAVOR: "" |
| 109 |
CI_CLEVER_CLOUD_FLAVOR: "XS" |
| 110 |
parallel: |
| 111 |
matrix: |
| 112 |
- BUILD_PY_ID: |
| 113 |
- cp39-cp39 |
| 114 |
- cp311-cp311 |
| 115 |
- cp310-cp310 |
| 116 |
- cp312-cp312 |
| 117 |
- cp313-cp313 |
| 118 |
- cp314-cp314 |
| 119 |
script: |
| 120 |
- PLATFORM=`/opt/python/cp313-cp313/bin/python -c 'import sys; print(sys.platform)'` |
| 121 |
- echo $WHEEL_TYPE |
| 122 |
- test -n "$WHEEL_TYPE" |
| 123 |
- echo $FLAVOR |
| 124 |
- mkdir -p wheels/$PLATFORM/$WHEEL_TYPE/$BUILD_PY_ID |
| 125 |
- contrib/build-one-linux-wheel.sh $BUILD_PY_ID wheels/$PLATFORM/$WHEEL_TYPE/$BUILD_PY_ID $WHEEL_TYPE |
| 126 |
artifacts: |
| 127 |
paths: |
| 128 |
- wheels/ |
| 129 |
expire_in: 1 week |
| 130 |
|
| 131 |
.wheel-trigger: |
| 132 |
extends: .trigger |
| 133 |
stage: build |
| 134 |
rules: |
| 135 |
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG) |
| 136 |
when: never |
| 137 |
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC |
| 138 |
when: manual |
| 139 |
allow_failure: true |
| 140 |
|
| 141 |
|
| 142 |
trigger-wheel-linux: |
| 143 |
extends: .wheel-trigger |
| 144 |
|
| 145 |
.extra-wheel: |
| 146 |
extends: .build-wheel |
| 147 |
rules: |
| 148 |
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG) |
| 149 |
needs: |
| 150 |
- trigger-nightly-build |
| 151 |
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC |
| 152 |
needs: |
| 153 |
- "trigger-wheel-linux" |
| 154 |
|
| 155 |
# build linux wheel for amd64 |
| 156 |
build-c-wheel-libc: |
| 157 |
extends: .build-wheel |
| 158 |
variables: |
| 159 |
ARCH: "x86_64" |
| 160 |
WHEEL_TYPE: "c" |
| 161 |
|
| 162 |
build-rust-wheel-libc: |
| 163 |
extends: .build-wheel |
| 164 |
variables: |
| 165 |
ARCH: "x86_64" |
| 166 |
WHEEL_TYPE: "rust" |
| 167 |
CI_CLEVER_CLOUD_FLAVOR: "M" |
| 168 |
|
| 169 |
build-c-wheel-musl: |
| 170 |
extends: .extra-wheel |
| 171 |
variables: |
| 172 |
ARCH: "x86_64-musl" |
| 173 |
WHEEL_TYPE: "c" |
| 174 |
|
| 175 |
build-rust-wheel-musl: |
| 176 |
extends: .extra-wheel |
| 177 |
variables: |
| 178 |
ARCH: "x86_64-musl" |
| 179 |
WHEEL_TYPE: "rust" |
| 180 |
|
| 181 |
build-c-wheel-i686-libc: |
| 182 |
extends: .extra-wheel |
| 183 |
variables: |
| 184 |
ARCH: "i686" |
| 185 |
WHEEL_TYPE: "c" |
| 186 |
|
| 187 |
build-c-wheel-i686-musl: |
| 188 |
extends: .extra-wheel |
| 189 |
variables: |
| 190 |
ARCH: "i686-musl" |
| 191 |
WHEEL_TYPE: "c" |
| 192 |
|
| 193 |
build-c-wheel-arm64-libc: |
| 194 |
extends: .extra-wheel |
| 195 |
variables: |
| 196 |
ARCH: "arm64" |
| 197 |
WHEEL_TYPE: "c" |
| 198 |
tags: |
| 199 |
- arm64 |
| 200 |
|
| 201 |
build-c-wheel-arm64-musl: |
| 202 |
extends: .extra-wheel |
| 203 |
variables: |
| 204 |
ARCH: "arm64-musl" |
| 205 |
WHEEL_TYPE: "c" |
| 206 |
tags: |
| 207 |
- arm64 |
| 208 |
|
| 209 |
.runtests: |
| 210 |
extends: .all |
| 211 |
stage: tests |
| 212 |
variables: |
| 213 |
SHOW_VERSION_OF: "$PYTHON" |
| 214 |
TEST_HGTESTS_ALLOW_NETIO: "0" |
| 215 |
FILTER: "" |
| 216 |
FLAVOR: "" |
| 217 |
RUNTEST_ARGS: "" |
| 218 |
FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR: true |
| 219 |
# The runner made a clone as root. |
| 220 |
# We make a new clone owned by user used to run the step. |
| 221 |
before_script: |
| 222 |
- echo "python used, $PYTHON" |
| 223 |
- for tool in $SHOW_VERSION_OF ; do echo '#' version of $tool; $tool --version; done |
| 224 |
- ls -1 tests/test-check-*.* tests/test-contrib-check-*.t > "${TMP_WORK_DIR}"/check-tests.txt |
| 225 |
script: |
| 226 |
- echo "$TEST_HGTESTS_ALLOW_NETIO" |
| 227 |
- echo "$RUNTEST_ARGS" |
| 228 |
- echo "$FILTER" |
| 229 |
- echo "$FLAVOR" |
| 230 |
- echo "$WHEEL_TYPE" |
| 231 |
- PORT_START=`expr 19051 + 1009 '*' $CI_CONCURRENT_ID` |
| 232 |
- PORT_ARG="--port $PORT_START" |
| 233 |
- echo $PORT_ARG |
| 234 |
- PLATFORM=`$PYTHON -c 'import sys; print(sys.platform)'` |
| 235 |
- echo $PLATFORM |
| 236 |
- WHEEL_ARG="" |
| 237 |
- SHARDING_ARGS="" |
| 238 |
- if test -n "$WHEEL_TYPE"; then |
| 239 |
PY_TAG=`$PYTHON -c 'import sys; v=sys.version_info; t=f"cp{v.major}{v.minor}"; print(f"{t}-{t}")'`; |
| 240 |
echo "$PY_TAG"; |
| 241 |
test -n "PY_TAG"; |
| 242 |
WHEEL="`ls -1 $CI_PROJECT_DIR/wheels/$PLATFORM/$WHEEL_TYPE/$PY_TAG/*.whl`"; |
| 243 |
test -n "$WHEEL"; |
| 244 |
echo installing from $WHEEL; |
| 245 |
WHEEL_ARG="--hg-wheel $WHEEL"; |
| 246 |
if [[ -n "$FLAVOR" ]] && [[ "$FLAVOR" != "--rust" ]]; then |
| 247 |
echo disabling flavor '"'$FLAVOR'"' as this is currently incompatible with '"--hg-wheel"'; |
| 248 |
FLAVOR=""; |
| 249 |
fi |
| 250 |
else |
| 251 |
echo installing from source; |
| 252 |
fi; |
| 253 |
- if [ -n "$CI_NODE_INDEX" ]; then |
| 254 |
echo "Running the test in multiple shard - [$CI_NODE_INDEX/$CI_NODE_TOTAL]"; |
| 255 |
SHARDING_ARGS="--shard-index $CI_NODE_INDEX --shard-total $CI_NODE_TOTAL"; |
| 256 |
echo "sharding... $SHARDING_ARGS"; |
| 257 |
fi |
| 258 |
- echo HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO" "$PYTHON" tests/run-tests.py |
| 259 |
--color=always --tail-report $PORT_ARG $WHEEL_ARG $FLAVOR $SHARDING_ARGS $FILTER $RUNTEST_ARGS; |
| 260 |
- HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO" |
| 261 |
"$PYTHON" tests/run-tests.py |
| 262 |
--color=always |
| 263 |
--tail-report |
| 264 |
$PORT_ARG |
| 265 |
$WHEEL_ARG |
| 266 |
$FLAVOR |
| 267 |
$SHARDING_ARGS |
| 268 |
$FILTER |
| 269 |
$RUNTEST_ARGS; |
| 270 |
|
| 271 |
checks: |
| 272 |
extends: .runtests |
| 273 |
image: "$HG_CI_REG/hg-core-checks:$HG_CI_IMAGE_TAG" |
| 274 |
stage: checks |
| 275 |
variables: |
| 276 |
SHOW_VERSION_OF: "$PYTHON black clang-format" |
| 277 |
RUNTEST_ARGS: "--time --pure --forbid-skip" |
| 278 |
FILTER: "--test-list ${TMP_WORK_DIR}/check-tests.txt" |
| 279 |
CI_CLEVER_CLOUD_FLAVOR: S |
| 280 |
|
| 281 |
rust-cargo-test: |
| 282 |
extends: .all |
| 283 |
image: "$HG_CI_REG/hg-core-rust-test:$HG_CI_IMAGE_TAG" |
| 284 |
stage: checks |
| 285 |
script: |
| 286 |
- make rust-tests |
| 287 |
- make cargo-clippy |
| 288 |
variables: |
| 289 |
CI_CLEVER_CLOUD_FLAVOR: S |
| 290 |
CARGO_TERM_COLOR: "always" |
| 291 |
|
| 292 |
.runtests-no-check: |
| 293 |
extends: .runtests |
| 294 |
parallel: 10 |
| 295 |
variables: |
| 296 |
FILTER: "--blacklist ${TMP_WORK_DIR}/check-tests.txt" |
| 297 |
TEST_HGTESTS_ALLOW_NETIO: "1" |
| 298 |
CI_CLEVER_CLOUD_FLAVOR: "M" |
| 299 |
|
| 300 |
.test-c: |
| 301 |
extends: .runtests-no-check |
| 302 |
variables: |
| 303 |
FLAVOR: "--no-rust" |
| 304 |
|
| 305 |
test-c: |
| 306 |
extends: .test-c |
| 307 |
image: "$HG_CI_REG/hg-core-test:$HG_CI_IMAGE_TAG" |
| 308 |
needs: |
| 309 |
- job: build-c-wheel-libc |
| 310 |
parallel: |
| 311 |
matrix: |
| 312 |
- BUILD_PY_ID: "cp311-cp311" |
| 313 |
variables: |
| 314 |
WHEEL_TYPE: "c" |
| 315 |
|
| 316 |
test-pure: |
| 317 |
extends: .runtests-no-check |
| 318 |
image: "$HG_CI_REG/hg-core-test:$HG_CI_IMAGE_TAG" |
| 319 |
variables: |
| 320 |
FLAVOR: "--pure" |
| 321 |
|
| 322 |
test-pure-zstd: |
| 323 |
extends: test-pure |
| 324 |
image: "$HG_CI_REG/hg-core-test-zstd:$HG_CI_IMAGE_TAG" |
| 325 |
rules: |
| 326 |
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG) |
| 327 |
when: on_success |
| 328 |
needs: |
| 329 |
- trigger-nightly-build |
| 330 |
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC |
| 331 |
when: manual |
| 332 |
allow_failure: true |
| 333 |
|
| 334 |
.test-rust: |
| 335 |
extends: .runtests-no-check |
| 336 |
variables: |
| 337 |
FLAVOR: "--rust" |
| 338 |
WHEEL_TYPE: "rust" |
| 339 |
|
| 340 |
test-rust: |
| 341 |
extends: .test-rust |
| 342 |
image: "$HG_CI_REG/hg-core-test:$HG_CI_IMAGE_TAG" |
| 343 |
variables: |
| 344 |
FLAVOR: "--rust" |
| 345 |
needs: |
| 346 |
- job: build-rust-wheel-libc |
| 347 |
parallel: |
| 348 |
matrix: |
| 349 |
- BUILD_PY_ID: "cp311-cp311" |
| 350 |
variables: |
| 351 |
WHEEL_TYPE: "rust" |
| 352 |
|
| 353 |
test-rhg: |
| 354 |
extends: .runtests-no-check |
| 355 |
image: "$HG_CI_REG/hg-core-test-py-dev-rust-dev:$HG_CI_IMAGE_TAG" |
| 356 |
variables: |
| 357 |
FLAVOR: "--rust --rhg" |
| 358 |
|
| 359 |
test-chg: |
| 360 |
extends: .runtests-no-check |
| 361 |
image: "$HG_CI_REG/hg-core-test-py-dev:$HG_CI_IMAGE_TAG" |
| 362 |
variables: |
| 363 |
FLAVOR: "--chg" |
| 364 |
|
| 365 |
|
| 366 |
trigger-pycompat: |
| 367 |
extends: .trigger |
| 368 |
stage: py-version-compat |
| 369 |
rules: |
| 370 |
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG) |
| 371 |
when: on_success |
| 372 |
needs: |
| 373 |
- trigger-nightly-build |
| 374 |
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC |
| 375 |
when: manual |
| 376 |
allow_failure: true |
| 377 |
|
| 378 |
.test-c-pycompat: |
| 379 |
extends: .test-c |
| 380 |
stage: py-version-compat |
| 381 |
variables: |
| 382 |
WHEEL_TYPE: "c" |
| 383 |
|
| 384 |
.test-rust-pycompat: |
| 385 |
extends: .test-rust |
| 386 |
stage: py-version-compat |
| 387 |
|
| 388 |
test-3.9-c: |
| 389 |
extends: .test-c-pycompat |
| 390 |
image: "$HG_CI_REG/hg-core-test-py39:$HG_CI_IMAGE_TAG" |
| 391 |
variables: |
| 392 |
PYTHON: python3.9 |
| 393 |
needs: |
| 394 |
- job: trigger-pycompat |
| 395 |
- job: build-c-wheel-libc |
| 396 |
parallel: |
| 397 |
matrix: |
| 398 |
- BUILD_PY_ID: "cp39-cp39" |
| 399 |
|
| 400 |
test-3.9-rust: |
| 401 |
extends: .test-rust-pycompat |
| 402 |
image: "$HG_CI_REG/hg-core-test-py39:$HG_CI_IMAGE_TAG" |
| 403 |
needs: |
| 404 |
- trigger-pycompat |
| 405 |
- job: build-rust-wheel-libc |
| 406 |
parallel: |
| 407 |
matrix: |
| 408 |
- BUILD_PY_ID: "cp39-cp39" |
| 409 |
variables: |
| 410 |
PYTHON: python3.9 |
| 411 |
|
| 412 |
test-3.10-c: |
| 413 |
extends: .test-c-pycompat |
| 414 |
image: "$HG_CI_REG/hg-core-test-py310:$HG_CI_IMAGE_TAG" |
| 415 |
variables: |
| 416 |
PYTHON: python3.10 |
| 417 |
needs: |
| 418 |
- job: trigger-pycompat |
| 419 |
- job: build-c-wheel-libc |
| 420 |
parallel: |
| 421 |
matrix: |
| 422 |
- BUILD_PY_ID: "cp310-cp310" |
| 423 |
|
| 424 |
test-3.10-rust: |
| 425 |
extends: .test-rust-pycompat |
| 426 |
image: "$HG_CI_REG/hg-core-test-py310:$HG_CI_IMAGE_TAG" |
| 427 |
needs: |
| 428 |
- trigger-pycompat |
| 429 |
- job: build-rust-wheel-libc |
| 430 |
parallel: |
| 431 |
matrix: |
| 432 |
- BUILD_PY_ID: "cp310-cp310" |
| 433 |
variables: |
| 434 |
PYTHON: python3.10 |
| 435 |
|
| 436 |
test-3.11-c: |
| 437 |
extends: .test-c-pycompat |
| 438 |
image: "$HG_CI_REG/hg-core-test-py311:$HG_CI_IMAGE_TAG" |
| 439 |
variables: |
| 440 |
PYTHON: python3.11 |
| 441 |
needs: |
| 442 |
- job: trigger-pycompat |
| 443 |
- job: build-c-wheel-libc |
| 444 |
parallel: |
| 445 |
matrix: |
| 446 |
- BUILD_PY_ID: "cp311-cp311" |
| 447 |
|
| 448 |
test-3.11-rust: |
| 449 |
extends: .test-rust-pycompat |
| 450 |
image: "$HG_CI_REG/hg-core-test-py311:$HG_CI_IMAGE_TAG" |
| 451 |
needs: |
| 452 |
- trigger-pycompat |
| 453 |
- job: build-rust-wheel-libc |
| 454 |
parallel: |
| 455 |
matrix: |
| 456 |
- BUILD_PY_ID: "cp311-cp311" |
| 457 |
variables: |
| 458 |
PYTHON: python3.11 |
| 459 |
|
| 460 |
test-3.12-c: |
| 461 |
extends: .test-c-pycompat |
| 462 |
image: "$HG_CI_REG/hg-core-test-py312:$HG_CI_IMAGE_TAG" |
| 463 |
variables: |
| 464 |
PYTHON: python3.12 |
| 465 |
needs: |
| 466 |
- job: trigger-pycompat |
| 467 |
- job: build-c-wheel-libc |
| 468 |
parallel: |
| 469 |
matrix: |
| 470 |
- BUILD_PY_ID: "cp312-cp312" |
| 471 |
|
| 472 |
test-3.12-rust: |
| 473 |
extends: .test-rust-pycompat |
| 474 |
image: "$HG_CI_REG/hg-core-test-py312:$HG_CI_IMAGE_TAG" |
| 475 |
needs: |
| 476 |
- trigger-pycompat |
| 477 |
- job: build-rust-wheel-libc |
| 478 |
parallel: |
| 479 |
matrix: |
| 480 |
- BUILD_PY_ID: "cp312-cp312" |
| 481 |
variables: |
| 482 |
PYTHON: python3.12 |
| 483 |
|
| 484 |
test-3.13-c: |
| 485 |
extends: .test-c-pycompat |
| 486 |
image: "$HG_CI_REG/hg-core-test-py313:$HG_CI_IMAGE_TAG" |
| 487 |
variables: |
| 488 |
PYTHON: python3.13 |
| 489 |
needs: |
| 490 |
- job: trigger-pycompat |
| 491 |
- job: build-c-wheel-libc |
| 492 |
parallel: |
| 493 |
matrix: |
| 494 |
- BUILD_PY_ID: "cp313-cp313" |
| 495 |
|
| 496 |
test-3.14-c: |
| 497 |
extends: .test-c-pycompat |
| 498 |
image: "$HG_CI_REG/hg-core-test-py314:$HG_CI_IMAGE_TAG" |
| 499 |
variables: |
| 500 |
PYTHON: python3.14 |
| 501 |
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MERCURIAL: "9.9.9" |
| 502 |
needs: |
| 503 |
- job: trigger-pycompat |
| 504 |
- job: build-c-wheel-libc |
| 505 |
parallel: |
| 506 |
matrix: |
| 507 |
- BUILD_PY_ID: "cp314-cp314" |
| 508 |
|
| 509 |
test-3.13-rust: |
| 510 |
extends: .test-rust-pycompat |
| 511 |
image: "$HG_CI_REG/hg-core-test-py313:$HG_CI_IMAGE_TAG" |
| 512 |
needs: |
| 513 |
- trigger-pycompat |
| 514 |
- job: build-rust-wheel-libc |
| 515 |
parallel: |
| 516 |
matrix: |
| 517 |
- BUILD_PY_ID: "cp313-cp313" |
| 518 |
variables: |
| 519 |
PYTHON: python3.13 |
| 520 |
|
| 521 |
test-3.14-rust: |
| 522 |
extends: .test-rust-pycompat |
| 523 |
image: "$HG_CI_REG/hg-core-test-py314:$HG_CI_IMAGE_TAG" |
| 524 |
needs: |
| 525 |
- trigger-pycompat |
| 526 |
- job: build-rust-wheel-libc |
| 527 |
parallel: |
| 528 |
matrix: |
| 529 |
- BUILD_PY_ID: "cp314-cp314" |
| 530 |
variables: |
| 531 |
PYTHON: python3.14 |
| 532 |
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MERCURIAL: "9.9.9" |
| 533 |
|
| 534 |
check-pytype: |
| 535 |
extends: .all |
| 536 |
stage: checks |
| 537 |
image: "$HG_CI_REG/hg-core-pytype:$HG_CI_IMAGE_TAG" |
| 538 |
cache: |
| 539 |
key: pytype-cache |
| 540 |
# the runner is too old to support VARIABLE policy |
| 541 |
policy: pull-push |
| 542 |
paths: |
| 543 |
- pytype-cache |
| 544 |
before_script: |
| 545 |
- rm -rf .pytype |
| 546 |
# make sure the directory exist, its easier |
| 547 |
- mkdir -p pytype-cache |
| 548 |
- cp -r pytype-cache/ .pytype |
| 549 |
script: |
| 550 |
- bash contrib/adjust-pytype-cache.sh |
| 551 |
- bash contrib/check-pytype.sh --import-graph |
| 552 |
- bash contrib/check-pytype.sh |
| 553 |
- hg log -r . -T "{node}" > .pytype/CACHE_COMMIT |
| 554 |
# to work around the lack of VARIABLE support in cache policy |
| 555 |
- if [ "$CI_COMMIT_BRANCH" = "$CI_DEFAULT_BRANCH" ]; then rm -rf pytype-cache; mv .pytype pytype-cache; fi |
| 556 |
|
| 557 |
# `sh.exe --login` sets a couple of extra environment variables that are defined |
| 558 |
# in the MinGW shell, but switches CWD to /home/$username. The previous value |
| 559 |
# is stored in OLDPWD. Of the added variables, MSYSTEM is crucial to running |
| 560 |
# run-tests.py- it is needed to make run-tests.py generate a `python3` script |
| 561 |
# that satisfies the various shebang lines and delegates to `py -3`. |
| 562 |
|
| 563 |
.windows: |
| 564 |
extends: .all |
| 565 |
when: manual # we don't have any Windows runners anymore at the moment |
| 566 |
tags: |
| 567 |
- windows |
| 568 |
variables: |
| 569 |
PYTHON: C:/hgdev/python39-x64/python.exe |
| 570 |
|
| 571 |
# a dummy job that only serve to trigger the wider windows build |
| 572 |
trigger-wheel-windows: |
| 573 |
extends: .trigger |
| 574 |
tags: |
| 575 |
- windows |
| 576 |
stage: build |
| 577 |
rules: |
| 578 |
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG) |
| 579 |
when: never |
| 580 |
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC |
| 581 |
when: manual |
| 582 |
allow_failure: true |
| 583 |
|
| 584 |
build-c-wheel-windows: |
| 585 |
extends: .windows |
| 586 |
tags: |
| 587 |
- $WHEEL_WINDOWS_TAG |
| 588 |
stage: build |
| 589 |
# wait for someone to click on "trigger-wheel-windows" |
| 590 |
when: on_success |
| 591 |
needs: |
| 592 |
rules: |
| 593 |
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG) |
| 594 |
needs: |
| 595 |
- trigger-nightly-build |
| 596 |
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC |
| 597 |
needs: |
| 598 |
- "trigger-wheel-windows" |
| 599 |
script: |
| 600 |
- echo "Entering script section" |
| 601 |
- echo "python used, $Env:PYTHON" |
| 602 |
- Invoke-Expression "$Env:PYTHON -V" |
| 603 |
- echo "$Env:RUNTEST_ARGS" |
| 604 |
- echo "$Env:TMP" |
| 605 |
- echo "$Env:TEMP" |
| 606 |
- if ( $CI_COMMIT_REF_PROTECTED -eq 'true' ) { hg pull -r stable } |
| 607 |
- "cibuildwheel.exe --output-dir wheels/win32" |
| 608 |
artifacts: |
| 609 |
paths: |
| 610 |
- wheels |
| 611 |
expire_in: 1 week |
| 612 |
parallel: |
| 613 |
matrix: |
| 614 |
# "cp39" is first as it unlock the tests |
| 615 |
- CIBW_BUILD: |
| 616 |
- "cp39-*" |
| 617 |
- "cp310-*" |
| 618 |
- "cp311-*" |
| 619 |
- "cp312-*" |
| 620 |
- "cp313-*" |
| 621 |
- "cp314-*" |
| 622 |
CIBW_ARCHS: |
| 623 |
- "AMD64" |
| 624 |
- "x86" |
| 625 |
- CIBW_BUILD: |
| 626 |
- "cp311-*" |
| 627 |
- "cp312-*" |
| 628 |
- "cp313-*" |
| 629 |
- "cp314-*" |
| 630 |
CIBW_ARCHS: |
| 631 |
- "ARM64" |
| 632 |
|
| 633 |
|
| 634 |
.windows-runtests: |
| 635 |
extends: .windows |
| 636 |
stage: platform-compat |
| 637 |
# the UX for manual parallel jobs is quite awful, and the job que depends |
| 638 |
# upon are manual anyway, so we can make this start automatically once the |
| 639 |
# associated wheel is ready. |
| 640 |
when: on_success |
| 641 |
parallel: 10 |
| 642 |
script: |
| 643 |
- echo "Entering script section" |
| 644 |
- echo "python used, $Env:PYTHON" |
| 645 |
- Invoke-Expression "$Env:PYTHON -V" |
| 646 |
- echo "$Env:HGTESTS_ALLOW_NETIO" |
| 647 |
- echo "$Env:WHEEL_ARG" |
| 648 |
- echo "$Env:FLAVOR" |
| 649 |
- echo "$Env:FILTER" |
| 650 |
- echo "$Env:RUNTEST_ARGS" |
| 651 |
- echo "$Env:TMP" |
| 652 |
- echo "$Env:TEMP" |
| 653 |
- C:/hgdev/MinGW/msys/1.0/bin/sh.exe |
| 654 |
--login -c 'sleep 5 |
| 655 |
&& cd "$OLDPWD" |
| 656 |
&& ls -1 tests/test-check-*.* > "${TMP_WORK_DIR}"/check-tests.txt' |
| 657 |
# This test is hanging the worker and not that important, so lets skip |
| 658 |
# it for now |
| 659 |
- C:/hgdev/MinGW/msys/1.0/bin/sh.exe -c 'cd "$OLDPWD" |
| 660 |
&& echo tests/test-clonebundles-autogen.t > $TMP_WORK_DIR/windows-skip.txt' |
| 661 |
# we immediately run with --retest in case of error as the windows test |
| 662 |
# are so flaky. |
| 663 |
- C:/hgdev/MinGW/msys/1.0/bin/sh.exe |
| 664 |
--login -c 'cd "$OLDPWD" |
| 665 |
&& HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO" |
| 666 |
$PYTHON tests/run-tests.py |
| 667 |
--color=always |
| 668 |
--tail-report |
| 669 |
$WHEEL_ARG |
| 670 |
$FLAVOR |
| 671 |
--port `expr 19051 + 1009 "*" $CI_CONCURRENT_ID` |
| 672 |
--shard-index $CI_NODE_INDEX --shard-total $CI_NODE_TOTAL |
| 673 |
$FILTER |
| 674 |
$RUNTEST_ARGS |
| 675 |
|| HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO" |
| 676 |
$PYTHON tests/run-tests.py |
| 677 |
--retest |
| 678 |
--color=always |
| 679 |
--tail-report |
| 680 |
$WHEEL_ARG |
| 681 |
$FLAVOR |
| 682 |
--port `expr 19051 + 1009 "*" $CI_CONCURRENT_ID` |
| 683 |
$FILTER |
| 684 |
$RUNTEST_ARGS; |
| 685 |
' |
| 686 |
# TODO: find/install cvs, bzr, perforce, gpg, sqlite3 |
| 687 |
variables: |
| 688 |
WHEEL_ARG: "" |
| 689 |
RUNTEST_ARGS: "" |
| 690 |
FLAVOR: "" |
| 691 |
FILTER: "--blacklist ${TMP_WORK_DIR}/check-tests.txt --blacklist ${TMP_WORK_DIR}/windows-skip.txt" |
| 692 |
|
| 693 |
windows: |
| 694 |
extends: .windows-runtests |
| 695 |
variables: |
| 696 |
RUNTEST_ARGS: "" |
| 697 |
WHEEL_ARG: "--hg-wheel wheels/win32/mercurial-*-cp39-cp39-win_amd64.whl" |
| 698 |
needs: |
| 699 |
- job: build-c-wheel-windows |
| 700 |
parallel: |
| 701 |
matrix: |
| 702 |
- CIBW_BUILD: "cp39-*" |
| 703 |
CIBW_ARCHS: "AMD64" |
| 704 |
|
| 705 |
windows-pyox: |
| 706 |
extends: .windows-runtests |
| 707 |
when: manual |
| 708 |
variables: |
| 709 |
RUNTEST_ARGS: "" |
| 710 |
WHEEL_ARG: "" |
| 711 |
FLAVOR: "--pyoxidized" |
| 712 |
|
| 713 |
macos: |
| 714 |
extends: .test-c |
| 715 |
stage: platform-compat |
| 716 |
# run the test in multiple shard to help spread the load between concurrent |
| 717 |
# MR as the macos runner is a shell runner there is not startup overhead |
| 718 |
# for tests. |
| 719 |
parallel: 10 |
| 720 |
tags: |
| 721 |
- macos |
| 722 |
variables: |
| 723 |
WHEEL_TYPE: "c" |
| 724 |
needs: |
| 725 |
- build-c-wheel-macos |
| 726 |
|
| 727 |
# We could use CIBW_BUILD="cp39-*" to only build the Python 3.9 wheel for now as |
| 728 |
# this is the only one we need to test. However testing that build works on all |
| 729 |
# versions is useful and matches what we do with Linux. |
| 730 |
# |
| 731 |
# The weird directory structure match the one we use for Linux to deal with the |
| 732 |
# multiple jobs. (all this might be unnecessary) |
| 733 |
build-c-wheel-macos: |
| 734 |
extends: .all |
| 735 |
rules: |
| 736 |
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG) |
| 737 |
needs: |
| 738 |
- trigger-nightly-build |
| 739 |
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC |
| 740 |
stage: build |
| 741 |
variables: |
| 742 |
tags: |
| 743 |
- $WHEEL_MACOS_TAG |
| 744 |
script: |
| 745 |
- sh -c 'which "$PYTHON"' |
| 746 |
- sh -c '"$PYTHON" -V' |
| 747 |
- sh -c 'which cibuildwheel' |
| 748 |
- if [ "$CI_COMMIT_REF_PROTECTED" == "true" ]; then hg pull -r stable; fi |
| 749 |
- PLATFORM=`$PYTHON -c 'import sys; print(sys.platform)'` |
| 750 |
- rm -rf tmp-wheels |
| 751 |
- cibuildwheel --output-dir tmp-wheels/ |
| 752 |
- for py_version in $(cibuildwheel --print-build-identifiers | egrep -o 'cp[0-9]+' | sort | uniq); do |
| 753 |
py_version="${py_version}-${py_version}"; |
| 754 |
mkdir -p wheels/$PLATFORM/c/$py_version/; |
| 755 |
mv tmp-wheels/*$py_version*.whl wheels/$PLATFORM/c/$py_version/; |
| 756 |
done |
| 757 |
- rm -rf tmp-wheels |
| 758 |
artifacts: |
| 759 |
paths: |
| 760 |
- wheels |
| 761 |
expire_in: 1 week |
| 762 |
|
| 763 |
|
| 764 |
.nightly_build_step: |
| 765 |
extends: .all |
| 766 |
stage: upload |
| 767 |
rules: |
| 768 |
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG) |
| 769 |
# note that at the time of writing this, this job depends on multiple |
| 770 |
# manual one. So it will not run by default, but will automatically run |
| 771 |
# if the manual jobs are triggered. |
| 772 |
# |
| 773 |
# Also beware that "on_success" will ignore failure of manual test we |
| 774 |
# directly depends on. This currently relevant for the "test-3.x-c" |
| 775 |
# tests. |
| 776 |
when: on_success |
| 777 |
- if: '$CI_COMMIT_BRANCH =~ $RE_TOPIC' |
| 778 |
when: never |
| 779 |
|
| 780 |
# a dummy job that gather greatly parallel object into one. |
| 781 |
# |
| 782 |
# It exists because gitlab-ci has a "50 jobs" limit on "needs" entries. |
| 783 |
# (yes, this is sad) |
| 784 |
# |
| 785 |
.sink: |
| 786 |
extends: |
| 787 |
- .nightly_build_step |
| 788 |
- .dummy |
| 789 |
|
| 790 |
test-result-linux-main: |
| 791 |
extends: .sink |
| 792 |
needs: |
| 793 |
- test-c |
| 794 |
- test-chg |
| 795 |
- test-pure |
| 796 |
- test-rhg |
| 797 |
- test-rust |
| 798 |
|
| 799 |
test-result-linux-py-a: |
| 800 |
extends: .sink |
| 801 |
needs: |
| 802 |
- test-pure-zstd |
| 803 |
- test-3.9-c |
| 804 |
- test-3.9-rust |
| 805 |
- test-3.10-c |
| 806 |
- test-3.10-rust |
| 807 |
|
| 808 |
test-result-linux-py-b: |
| 809 |
extends: .sink |
| 810 |
needs: |
| 811 |
- test-3.11-c |
| 812 |
- test-3.11-rust |
| 813 |
- test-3.12-c |
| 814 |
- test-3.12-rust |
| 815 |
|
| 816 |
test-result-linux-py-c: |
| 817 |
extends: .sink |
| 818 |
needs: |
| 819 |
- test-3.13-c |
| 820 |
- test-3.13-rust |
| 821 |
- test-3.14-c |
| 822 |
- test-3.14-rust |
| 823 |
|
| 824 |
test-result-macos: |
| 825 |
extends: .sink |
| 826 |
needs: |
| 827 |
- macos |
| 828 |
|
| 829 |
test-result-windows: |
| 830 |
extends: .sink |
| 831 |
needs: |
| 832 |
- windows |
| 833 |
|
| 834 |
wheel-result-linux: |
| 835 |
extends: .sink |
| 836 |
needs: |
| 837 |
- build-c-wheel-libc |
| 838 |
- build-c-wheel-musl |
| 839 |
- build-c-wheel-i686-libc |
| 840 |
- build-c-wheel-i686-musl |
| 841 |
- build-c-wheel-arm64-libc |
| 842 |
- build-c-wheel-arm64-musl |
| 843 |
artifacts: |
| 844 |
paths: |
| 845 |
- wheels |
| 846 |
expire_in: 1 week |
| 847 |
|
| 848 |
wheel-result-windows: |
| 849 |
extends: .sink |
| 850 |
tags: |
| 851 |
- $WHEEL_WINDOWS_TAG |
| 852 |
needs: |
| 853 |
- build-c-wheel-windows |
| 854 |
artifacts: |
| 855 |
paths: |
| 856 |
- wheels |
| 857 |
expire_in: 1 week |
| 858 |
|
| 859 |
# Upload nightly build wheel on the heptapod registry on test success |
| 860 |
# |
| 861 |
# At the time this task is added, since the mac wheels are built on shell |
| 862 |
# runner, those nightly are not be considered fully secured. |
| 863 |
# |
| 864 |
# In addition, since any job can upload package, pretty much anyone with CI |
| 865 |
# access can upload anything pretending to be any version. To fix it we would |
| 866 |
# have to prevent the CI token to upload to the registry and have dedicated |
| 867 |
# credential accessible only from protected branches. |
| 868 |
upload-wheel-nightly: |
| 869 |
extends: .nightly_build_step |
| 870 |
image: "$HG_CI_REG/twine:$HG_CI_IMAGE_TAG" |
| 871 |
# because we don't want to upload only half of a wheel |
| 872 |
interruptible: false |
| 873 |
needs: |
| 874 |
- wheel-result-linux |
| 875 |
- wheel-result-windows |
| 876 |
- build-c-wheel-macos |
| 877 |
- test-result-linux-main |
| 878 |
- test-result-linux-py-a |
| 879 |
- test-result-linux-py-b |
| 880 |
- test-result-linux-py-c |
| 881 |
- test-result-macos |
| 882 |
- test-result-windows |
| 883 |
# It would be nice to be able to restrict that a bit to protected branch only |
| 884 |
variables: |
| 885 |
TWINE_USERNAME: gitlab-ci-token |
| 886 |
TWINE_PASSWORD: $CI_JOB_TOKEN |
| 887 |
script: |
| 888 |
- twine |
| 889 |
upload |
| 890 |
--verbose |
| 891 |
--repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi |
| 892 |
--skip-existing |
| 893 |
wheels/*/*/*/*.whl |
| 894 |
wheels/*/*.whl |
| 895 |
# make all wheels available in one place |
| 896 |
artifacts: |
| 897 |
paths: |
| 898 |
- wheels |
| 899 |
expire_in: 1 week |