diff --git a/Jenkinsfile b/Jenkinsfile index ec86476..508f940 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -451,11 +451,11 @@ pipeline { } axis { name 'OS' - values 'linux','macos','windows' + values 'linux', 'macos', 'windows' } axis { name 'ARCHITECTURE' - values 'x86_64', 'arm64' + values 'arm64', 'x86_64' } axis { name 'PACKAGE_TYPE' @@ -464,118 +464,108 @@ pipeline { } excludes { exclude { - axis { - name 'OS' - notValues 'windows' - } axis { name 'ARCHITECTURE' values 'arm64' } + axis { + name 'OS' + values 'windows' + } + } + } + when{ + expression{ + params.containsKey("INCLUDE_${OS}-${ARCHITECTURE}".toUpperCase()) && params["INCLUDE_${OS}-${ARCHITECTURE}".toUpperCase()] } } -// when{ -// expression{ -// params.containsKey("INCLUDE_${OS}-${ARCHITECTURE}".toUpperCase()) && params["INCLUDE_${OS}-${ARCHITECTURE}".toUpperCase()] -// } -// } stages { - stage('delme'){ - steps{ + stage('Test Package in container') { + when{ + expression{['linux', 'windows'].contains(OS)} + beforeAgent true + } + agent { + docker { + image 'python' + label "${OS} && ${ARCHITECTURE} && docker" + args "--mount source=python-tmp-hathizip,target=${['linux'].contains(OS) ? '/tmp' : 'C:/Users/AppData/Local/Temp'}" + } + } + environment{ + PIP_CACHE_DIR="${isUnix() ? '/tmp/pipcache': 'C:/Users/AppData/Local/Temp/pipcache'}" + UV_INDEX_STRATEGY='unsafe-best-match' + UV_TOOL_DIR="${isUnix() ? '/tmp/uvtools': 'C:/Users/AppData/Local/Temp/uvtools'}" + UV_PYTHON_INSTALL_DIR="${isUnix() ? '/tmp/uvpython': 'C:/Users/AppData/Local/Temp/uvpython'}" + UV_CACHE_DIR="${isUnix() ? '/tmp/uvcache': 'C:/Users/AppData/Local/Temp/uvcache'}" + } + steps { + unstash 'PYTHON_PACKAGES' script{ - def dummy = params.containsKey("INCLUDE_${OS}-${ARCHITECTURE}".toUpperCase()) && params["INCLUDE_${OS}-${ARCHITECTURE}".toUpperCase()] - echo "dummy = ${dummy}" - echo "ARCHITECTURE = ${ARCHITECTURE}" - echo "OS = ${OS}" + if(isUnix()){ + sh( + label: 'Testing with tox', + script: """python3 -m venv venv + . ./venv/bin/activate + pip install uv + UV_INDEX_STRATEGY=unsafe-best-match uvx --with tox-uv tox --installpkg ${findFiles(glob: PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${PYTHON_VERSION.replace('.', '')} + """ + ) + } else { + bat( + label: 'Testing with tox', + script: """python -m venv venv + .\\venv\\scripts\\activate.bat + pip install uv + UV_INDEX_STRATEGY=unsafe-best-match uvx --with tox-uv tox --installpkg ${findFiles(glob: PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${PYTHON_VERSION.replace('.', '')} + """ + ) + } + } + } + post{ + cleanup{ + cleanWs( + patterns: [ + [pattern: 'dist/', type: 'INCLUDE'], + [pattern: 'venv/', type: 'INCLUDE'], + [pattern: '**/__pycache__/', type: 'INCLUDE'], + ] + ) + } + } + } + stage('Test Package directly on agent') { + when{ + expression{['macos'].contains(OS)} + beforeAgent true + } + agent { + label "${OS} && ${ARCHITECTURE}" + } + steps { + unstash 'PYTHON_PACKAGES' + sh( + label: 'Testing with tox', + script: """python3 -m venv venv + . ./venv/bin/activate + pip install uv + UV_INDEX_STRATEGY=unsafe-best-match uvx --with tox-uv tox --installpkg ${findFiles(glob: PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${PYTHON_VERSION.replace('.', '')} + """ + ) + } + post{ + cleanup{ + cleanWs( + patterns: [ + [pattern: 'dist/', type: 'INCLUDE'], + [pattern: 'venv/', type: 'INCLUDE'], + [pattern: '**/__pycache__/', type: 'INCLUDE'], + ] + ) } } } -// stage('Test Package in container') { -// when{ -// expression{['linux', 'windows'].contains(OS)} -// beforeAgent true -// } -// agent { -// docker { -// image 'python' -// label "${OS} && ${ARCHITECTURE} && docker" -// args "--mount source=python-tmp-hathizip,target=${['linux'].contains(OS) ? '/tmp' : 'C:/Users/AppData/Local/Temp'}" -// } -// } -// environment{ -// PIP_CACHE_DIR="${isUnix() ? '/tmp/pipcache': 'C:/Users/AppData/Local/Temp/pipcache'}" -// UV_INDEX_STRATEGY='unsafe-best-match' -// UV_TOOL_DIR="${isUnix() ? '/tmp/uvtools': 'C:/Users/AppData/Local/Temp/uvtools'}" -// UV_PYTHON_INSTALL_DIR="${isUnix() ? '/tmp/uvpython': 'C:/Users/AppData/Local/Temp/uvpython'}" -// UV_CACHE_DIR="${isUnix() ? '/tmp/uvcache': 'C:/Users/AppData/Local/Temp/uvcache'}" -// } -// steps { -// unstash 'PYTHON_PACKAGES' -// script{ -// if(isUnix()){ -// sh( -// label: 'Testing with tox', -// script: """python3 -m venv venv -// . ./venv/bin/activate -// pip install uv -// UV_INDEX_STRATEGY=unsafe-best-match uvx --with tox-uv tox --installpkg ${findFiles(glob: PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${PYTHON_VERSION.replace('.', '')} -// """ -// ) -// } else { -// bat( -// label: 'Testing with tox', -// script: """python -m venv venv -// .\\venv\\scripts\\activate.bat -// pip install uv -// UV_INDEX_STRATEGY=unsafe-best-match uvx --with tox-uv tox --installpkg ${findFiles(glob: PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${PYTHON_VERSION.replace('.', '')} -// """ -// ) -// } -// } -// } -// post{ -// cleanup{ -// cleanWs( -// patterns: [ -// [pattern: 'dist/', type: 'INCLUDE'], -// [pattern: 'venv/', type: 'INCLUDE'], -// [pattern: '**/__pycache__/', type: 'INCLUDE'], -// ] -// ) -// } -// } -// } -// stage('Test Package directly on agent') { -// when{ -// expression{['macos'].contains(OS)} -// beforeAgent true -// } -// agent { -// label "${OS} && ${ARCHITECTURE}" -// } -// steps { -// unstash 'PYTHON_PACKAGES' -// sh( -// label: 'Testing with tox', -// script: """python3 -m venv venv -// . ./venv/bin/activate -// pip install uv -// UV_INDEX_STRATEGY=unsafe-best-match uvx --with tox-uv tox --installpkg ${findFiles(glob: PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${PYTHON_VERSION.replace('.', '')} -// """ -// ) -// } -// post{ -// cleanup{ -// cleanWs( -// patterns: [ -// [pattern: 'dist/', type: 'INCLUDE'], -// [pattern: 'venv/', type: 'INCLUDE'], -// [pattern: '**/__pycache__/', type: 'INCLUDE'], -// ] -// ) -// } -// } -// } } } }