Skip to content

Commit 58e7890

Browse files
committed
ci: test packages first offline then online
1 parent f627de1 commit 58e7890

1 file changed

Lines changed: 66 additions & 39 deletions

File tree

Jenkinsfile

Lines changed: 66 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,20 @@ def linux_wheels(pythonVersions, testPackages, params, wheelStashes){
266266
"--label \"absoluteUrl=${currentBuild.absoluteUrl}\" --label \"BUILD_NUMBER=${currentBuild.number}\" " +
267267
'--mount source=python-tmp-py3exiv2bind,target=/tmp --tmpfs /.local/share:exec --tmpfs /.local/bin:exec'
268268
){
269-
timeout(60){
270-
sh(
271-
label: 'Testing with tox',
272-
script: """uv python install ${pythonVersion.replace('+gil','')}
273-
uv run --only-group=tox-uv tox --installpkg ${findFiles(glob:'dist/*.whl')[0].path} -e py${pythonVersion.replace('.', '').replace('+gil','')}
274-
rm -rf .tox
275-
"""
276-
)
269+
def attempt = 0
270+
retry(2){
271+
attempt += 1
272+
withEnv([(attempt == 1) ? "UV_OFFLINE=1" : 'UV_OFFLINE=0']){
273+
timeout(60){
274+
sh(
275+
label: 'Testing with tox',
276+
script: """uv python install ${pythonVersion.replace('+gil','')}
277+
uv run --only-group=tox-uv tox --installpkg ${findFiles(glob:'dist/*.whl')[0].path} -e py${pythonVersion.replace('.', '').replace('+gil','')}
278+
rm -rf .tox
279+
"""
280+
)
281+
}
282+
}
277283
}
278284
}
279285
}
@@ -352,13 +358,21 @@ def mac_wheels(pythonVersions, testPackages, params, wheelStashes){
352358
}
353359
wheels.each{
354360
try{
355-
withEnv(["UV_CONFIG_FILE=${createUVConfig()}", "TOX_UV_PATH=${WORKSPACE}/venv/bin/uv"]){
356-
timeout(60){
357-
sh(label: 'Running Tox',
358-
script: """python3 -m venv venv
359-
./venv/bin/python -m pip install --disable-pip-version-check uv
360-
./venv/bin/uv run --only-group=tox-uv --frozen tox run --installpkg ${it.path} -e py${pythonVersion.replace('.', '').replace('+gil', '')}"""
361-
)
361+
def attempt = 0
362+
retry(2){
363+
attempt += 1
364+
withEnv([
365+
(attempt == 1) ? "UV_OFFLINE=1" : 'UV_OFFLINE=0',
366+
"UV_CONFIG_FILE=${createUVConfig()}",
367+
"TOX_UV_PATH=${WORKSPACE}/venv/bin/uv"
368+
]){
369+
timeout(60){
370+
sh(label: "Running Tox: ${(attempt == 1) ? 'Offline' : 'Online'}",
371+
script: """python3 -m venv venv
372+
./venv/bin/python -m pip install --disable-pip-version-check uv
373+
./venv/bin/uv run --only-group=tox-uv --frozen tox run --installpkg ${it.path} -e py${pythonVersion.replace('.', '').replace('+gil', '')}"""
374+
)
375+
}
362376
}
363377
}
364378
} finally {
@@ -428,17 +442,25 @@ def mac_wheels(pythonVersions, testPackages, params, wheelStashes){
428442
node("mac && python3 && ${arch}"){
429443
try{
430444
checkout scm
431-
withEnv(["UV_CONFIG_FILE=${createUVConfig()}", "TOX_UV_PATH=${WORKSPACE}/venv/bin/uv"]){
432-
unstash "python${pythonVersion} mac-universal2 wheel"
433-
findFiles(glob: 'dist/*.whl').each{
434-
sh(label: 'Running Tox',
435-
script: """python3 -m venv venv
436-
trap 'rm -rf venv' EXIT
437-
./venv/bin/python -m pip install --disable-pip-version-check uv
438-
trap "rm -rf venv && rm -rf .tox" EXIT
439-
./venv/bin/uv run --only-group=tox-uv --frozen --python=${pythonVersion} tox --installpkg ${it.path} -e py${pythonVersion.replace('.', '').replace('+gil', '')}
440-
"""
441-
)
445+
def attempt = 0
446+
retry(2){
447+
attempt += 1
448+
withEnv([
449+
(attempt == 1) ? "UV_OFFLINE=1" : 'UV_OFFLINE=0',
450+
"UV_CONFIG_FILE=${createUVConfig()}",
451+
"TOX_UV_PATH=${WORKSPACE}/venv/bin/uv"
452+
]){
453+
unstash "python${pythonVersion} mac-universal2 wheel"
454+
findFiles(glob: 'dist/*.whl').each{
455+
sh(label: "Running Tox: ${(attempt == 1) ? 'Offline' : 'Online'}",
456+
script: """python3 -m venv venv
457+
trap 'rm -rf venv' EXIT
458+
./venv/bin/python -m pip install --disable-pip-version-check uv
459+
trap "rm -rf venv && rm -rf .tox" EXIT
460+
./venv/bin/uv run --only-group=tox-uv --frozen --python=${pythonVersion} tox --installpkg ${it.path} -e py${pythonVersion.replace('.', '').replace('+gil', '')}
461+
"""
462+
)
463+
}
442464
}
443465
}
444466
archiveArtifacts artifacts: 'dist/*.whl'
@@ -643,19 +665,24 @@ def get_sdist_macos(params, pythonVersions){
643665
findFiles(glob: 'dist/*.tar.gz').each{
644666
retry(3){
645667
try{
646-
withEnv([
647-
"UV_CONFIG_FILE=${createUVConfig()}",
648-
"TOX_UV_PATH=${WORKSPACE}/venv/bin/uv"
649-
]){
650-
timeout(60){
651-
sh(label: 'Running Tox',
652-
script: """python3 -m venv venv
653-
trap 'rm -rf venv' EXIT
654-
./venv/bin/python -m pip install --disable-pip-version-check uv
655-
trap "rm -rf venv && rm -rf .tox" EXIT
656-
./venv/bin/uv run --only-group=tox-uv --frozen --python=${pythonVersion} tox --installpkg ${it.path} -e py${pythonVersion.replace('.', '').replace('+gil', '')}
657-
"""
658-
)
668+
def attempt = 0
669+
retry(2){
670+
attempt += 1
671+
withEnv([
672+
(attempt == 1) ? "UV_OFFLINE=1" : 'UV_OFFLINE=0',
673+
"UV_CONFIG_FILE=${createUVConfig()}",
674+
"TOX_UV_PATH=${WORKSPACE}/venv/bin/uv"
675+
]){
676+
timeout(60){
677+
sh(label: "Running Tox: ${(attempt == 1) ? 'Offline' : 'Online'}",
678+
script: """python3 -m venv venv
679+
trap 'rm -rf venv' EXIT
680+
./venv/bin/python -m pip install --disable-pip-version-check uv
681+
trap "rm -rf venv && rm -rf .tox" EXIT
682+
./venv/bin/uv run --only-group=tox-uv --frozen --python=${pythonVersion} tox --installpkg ${it.path} -e py${pythonVersion.replace('.', '').replace('+gil', '')}
683+
"""
684+
)
685+
}
659686
}
660687
}
661688
}finally{

0 commit comments

Comments
 (0)