Skip to content

Commit a218a3b

Browse files
Merge pull request #83 from UIUCLibrary/dev
ci: gathering linux tox stages will retry on failure
2 parents 6544f61 + 9329f70 commit a218a3b

File tree

4 files changed

+50
-31
lines changed

4 files changed

+50
-31
lines changed

docs/source/conf.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,17 @@
1919
#
2020
import os
2121
import sys
22-
import tomllib
22+
if sys.version_info < (3, 11):
23+
from tomli import load as load_toml
24+
else:
25+
from tomllib import load as load_toml
26+
2327

2428
sys.path.insert(0, os.path.abspath('../..'))
2529
def get_project_metadata():
2630
path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../pyproject.toml"))
2731
with open(path, "rb") as f:
28-
return tomllib.load(f)['project']
32+
return load_toml(f)['project']
2933

3034
metadata = get_project_metadata()
3135

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ classifiers = [
2323
]
2424

2525
[dependency-groups]
26-
docs = ["sphinx"]
26+
docs = ["sphinx", "tomli ; python_full_version < '3.11'"]
2727
type_checking = [
2828
"mypy",
2929
"lxml",

uv.lock

Lines changed: 10 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vars/runJenkinsPipeline.groovy

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,19 @@ def call(){
6565
./venv/bin/uv run --group docs --no-dev sphinx-build docs/source build/docs/html -d build/docs/.doctrees -v -w logs/build_sphinx.log
6666
'''
6767
)
68+
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'build/docs/html', reportFiles: 'index.html', reportName: 'Documentation', reportTitles: ''])
69+
script{
70+
def props = readTOML( file: 'pyproject.toml')['project']
71+
def DOC_ZIP_FILENAME = "${props.name}-${props.version}.doc.zip"
72+
zip archive: true, dir: 'build/docs/html', glob: '', zipFile: "dist/${DOC_ZIP_FILENAME}"
73+
}
74+
stash includes: 'build/docs/html/**,dist/*.doc.zip', name: 'DOCS_ARCHIVE'
6875
}
6976
post{
7077
always {
7178
recordIssues(tools: [sphinxBuild(name: 'Sphinx Documentation Build', pattern: 'logs/build_sphinx.log', id: 'sphinx_build')])
7279
archiveArtifacts artifacts: 'logs/build_sphinx.log'
7380
}
74-
success{
75-
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'build/docs/html', reportFiles: 'index.html', reportName: 'Documentation', reportTitles: ''])
76-
script{
77-
def props = readTOML( file: 'pyproject.toml')['project']
78-
def DOC_ZIP_FILENAME = "${props.name}-${props.version}.doc.zip"
79-
zip archive: true, dir: 'build/docs/html', glob: '', zipFile: "dist/${DOC_ZIP_FILENAME}"
80-
}
81-
stash includes: 'build/docs/html/**,dist/*.doc.zip', name: 'DOCS_ARCHIVE'
82-
}
8381
failure{
8482
echo 'Failed to build Python package'
8583
}
@@ -225,24 +223,33 @@ def call(){
225223
steps{
226224
script{
227225
def envs = []
228-
node('docker && linux'){
229-
docker.image('python').inside('--mount source=python-tmp-packageValidation,target=/tmp'){
226+
retry(2){
227+
node('docker && linux'){
228+
checkout scm
230229
try{
231-
checkout scm
232-
sh(script: 'python3 -m venv venv && venv/bin/pip install --disable-pip-version-check uv')
233-
envs = sh(
234-
label: 'Get tox environments',
235-
script: './venv/bin/uv run --only-group tox --with tox-uv --isolated --quiet tox list -d --no-desc',
236-
returnStdout: true,
237-
).trim().split('\n')
238-
} finally{
239-
cleanWs(
240-
patterns: [
241-
[pattern: 'venv/', type: 'INCLUDE'],
242-
[pattern: '.tox', type: 'INCLUDE'],
243-
[pattern: '**/__pycache__/', type: 'INCLUDE'],
244-
]
245-
)
230+
docker.image('python').inside('--mount source=python-tmp-packageValidation,target=/tmp'){
231+
retry(2){
232+
try{
233+
sh(script: 'python3 -m venv venv && venv/bin/pip install --disable-pip-version-check uv')
234+
envs = sh(
235+
label: 'Get tox environments',
236+
script: './venv/bin/uv run --only-group tox --with tox-uv --isolated --quiet tox list -d --no-desc',
237+
returnStdout: true,
238+
).trim().split('\n')
239+
} catch (e){
240+
cleanWs(
241+
patterns: [
242+
[pattern: 'venv/', type: 'INCLUDE'],
243+
[pattern: '.tox', type: 'INCLUDE'],
244+
[pattern: '**/__pycache__/', type: 'INCLUDE'],
245+
]
246+
)
247+
throw e
248+
}
249+
}
250+
}
251+
} finally {
252+
sh "${tool(name: 'Default', type: 'git')} clean -dfx"
246253
}
247254
}
248255
}

0 commit comments

Comments
 (0)