From 4e94215e894c36f2f440a0fbf3b3516480829edc Mon Sep 17 00:00:00 2001 From: lebarsfa Date: Thu, 20 Aug 2026 23:32:28 +0200 Subject: [PATCH 1/2] Attempt to solve some random package download failures --- .github/workflows/unixmatrix.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/unixmatrix.yml b/.github/workflows/unixmatrix.yml index 46a117211..d35535996 100644 --- a/.github/workflows/unixmatrix.yml +++ b/.github/workflows/unixmatrix.yml @@ -94,12 +94,14 @@ jobs: if: matrix.cfg.deb==true - run: | choco install -y -r --no-progress checksum wget zip - rem Workaround to try solve some random package download failures... - wget https://webperso.ensta.fr/packages/choco/winflexbison.2.4.9.20170215.nupkg --no-check-certificate -nv - wget https://webperso.ensta.fr/packages/choco/patch.2.5.9.nupkg --no-check-certificate -nv - choco install -y -r --no-progress -s . winflexbison patch ${{ matrix.cfg.choco_flags }} - del /f /q winflexbison.2.4.9.20170215.nupkg patch.2.5.9.nupkg - wget http://webperso.ensta.fr/lebars/Share/cmake_extra_tools.zip --no-check-certificate -nv + rem choco install -y -r --no-progress checksum wget zip make + rem rem Workaround to try to solve some random package download failures, try to go easy with the download server... + rem wget https://lebarsfa.github.io/cache/patch.2.5.9.nupkg --no-check-certificate -nv + rem choco install -y -r --no-progress -s . patch ${{ matrix.cfg.choco_flags }} + rem wget https://lebarsfa.github.io/cache/winflexbison.2.4.9.20170215.nupkg --no-check-certificate -nv + rem choco install -y -r --no-progress -s . winflexbison ${{ matrix.cfg.choco_flags }} + rem del /f /q patch.2.5.9.nupkg winflexbison.2.4.9.20170215.nupkg + wget https://lebarsfa.github.io/cache/cmake_extra_tools.zip --no-check-certificate -nv 7z x cmake_extra_tools.zip -o"%SystemDrive%" -y del /f /q cmake_extra_tools.zip wget https://gist.github.com/lebarsfa/237841f9e5dad55ef192713b3b1b2f16/raw/04d77ced3457346c55f183ca12a10dbcb850e6d5/refreshenv.bashrc --no-check-certificate -nv From 57813bc8b3447ed62265bdc6d4491d47fd8fa5db Mon Sep 17 00:00:00 2001 From: lebarsfa Date: Fri, 21 Aug 2026 23:07:39 +0200 Subject: [PATCH 2/2] Add optional MIN_PYTHON and MAX_PYTHON environment variables to build_pybinding.sh to be able to parallelize wheels generation for Linux --- .github/workflows/dockercentos.yml | 14 ++-- scripts/docker/build_pybinding.sh | 67 +++++++++++++++++++ .../docker/build_pybinding_codac4matlab.sh | 67 +++++++++++++++++++ 3 files changed, 144 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dockercentos.yml b/.github/workflows/dockercentos.yml index 037944595..2494213d5 100644 --- a/.github/workflows/dockercentos.yml +++ b/.github/workflows/dockercentos.yml @@ -18,8 +18,14 @@ jobs: fail-fast: false matrix: cfg: - - { img: 'lebarsfa/manylinux_2_28_x86_64-for-codac' , os: ubuntu-latest , shell: bash, arch: x86_64 , bitness: 64, runtime: manylinux_2_28, desc: 'CentOS manylinux_2_28 x86_64' } - - { img: 'lebarsfa/manylinux_2_28_aarch64-for-codac', os: ubuntu-24.04-arm , shell: bash, arch: aarch64, bitness: 64, runtime: manylinux_2_28, docker_flags: '--platform linux/arm64', desc: 'CentOS manylinux_2_28 aarch64' } + - { img: 'lebarsfa/manylinux_2_28_x86_64-for-codac' , os: ubuntu-latest , shell: bash, arch: x86_64 , bitness: 64, runtime: manylinux_2_28, min_python: '3.14', max_python: ' ', desc: 'CentOS manylinux_2_28 x86_64 Python >=3.14' } + - { img: 'lebarsfa/manylinux_2_28_x86_64-for-codac' , os: ubuntu-latest , shell: bash, arch: x86_64 , bitness: 64, runtime: manylinux_2_28, min_python: '3.13', max_python: '3.13', desc: 'CentOS manylinux_2_28 x86_64 Python 3.13' } + - { img: 'lebarsfa/manylinux_2_28_x86_64-for-codac' , os: ubuntu-latest , shell: bash, arch: x86_64 , bitness: 64, runtime: manylinux_2_28, min_python: '3.11', max_python: '3.12', desc: 'CentOS manylinux_2_28 x86_64 Python 3.11-3.12' } + - { img: 'lebarsfa/manylinux_2_28_x86_64-for-codac' , os: ubuntu-latest , shell: bash, arch: x86_64 , bitness: 64, runtime: manylinux_2_28, min_python: ' ', max_python: '3.10', desc: 'CentOS manylinux_2_28 x86_64 Python <=3.10' } + - { img: 'lebarsfa/manylinux_2_28_aarch64-for-codac', os: ubuntu-24.04-arm , shell: bash, arch: aarch64, bitness: 64, runtime: manylinux_2_28, min_python: '3.14', max_python: ' ', docker_flags: '--platform linux/arm64', desc: 'CentOS manylinux_2_28 aarch64 Python >=3.14' } + - { img: 'lebarsfa/manylinux_2_28_aarch64-for-codac', os: ubuntu-24.04-arm , shell: bash, arch: aarch64, bitness: 64, runtime: manylinux_2_28, min_python: '3.13', max_python: '3.13', docker_flags: '--platform linux/arm64', desc: 'CentOS manylinux_2_28 aarch64 Python 3.13' } + - { img: 'lebarsfa/manylinux_2_28_aarch64-for-codac', os: ubuntu-24.04-arm , shell: bash, arch: aarch64, bitness: 64, runtime: manylinux_2_28, min_python: '3.11', max_python: '3.12', docker_flags: '--platform linux/arm64', desc: 'CentOS manylinux_2_28 aarch64 Python 3.11-3.12' } + - { img: 'lebarsfa/manylinux_2_28_aarch64-for-codac', os: ubuntu-24.04-arm , shell: bash, arch: aarch64, bitness: 64, runtime: manylinux_2_28, min_python: ' ', max_python: '3.10', docker_flags: '--platform linux/arm64', desc: 'CentOS manylinux_2_28 aarch64 Python <=3.10' } name: ${{ matrix.cfg.desc }} steps: - uses: actions/checkout@v7 @@ -34,8 +40,8 @@ jobs: # if: (matrix.cfg.arch!='x86_64')&&(matrix.cfg.arch!='i386') - run: | chmod a+x scripts/docker/*.sh - if [ ${{ github.ref_name }} = 'codac2_codac4matlab' ] || [ ${{ github.event.pull_request.base.ref }} = 'codac2_codac4matlab' ]; then docker run ${{ matrix.cfg.docker_flags }} --rm -v `pwd`:/io ${{ matrix.cfg.img }} /io/scripts/docker/build_pybinding_codac4matlab.sh - else docker run ${{ matrix.cfg.docker_flags }} --rm -v `pwd`:/io ${{ matrix.cfg.img }} /io/scripts/docker/build_pybinding.sh + if [ ${{ github.ref_name }} = 'codac2_codac4matlab' ] || [ ${{ github.event.pull_request.base.ref }} = 'codac2_codac4matlab' ]; then docker run ${{ matrix.cfg.docker_flags }} --rm -v `pwd`:/io -e MIN_PYTHON=${{ matrix.cfg.min_python }} -e MAX_PYTHON=${{ matrix.cfg.max_python }} ${{ matrix.cfg.img }} /io/scripts/docker/build_pybinding_codac4matlab.sh + else docker run ${{ matrix.cfg.docker_flags }} --rm -v `pwd`:/io -e MIN_PYTHON=${{ matrix.cfg.min_python }} -e MAX_PYTHON=${{ matrix.cfg.max_python }} ${{ matrix.cfg.img }} /io/scripts/docker/build_pybinding.sh fi ls wheelhouse - uses: xresloader/upload-to-github-release@v1 diff --git a/scripts/docker/build_pybinding.sh b/scripts/docker/build_pybinding.sh index bde2ff80f..ab98904f3 100755 --- a/scripts/docker/build_pybinding.sh +++ b/scripts/docker/build_pybinding.sh @@ -9,12 +9,79 @@ sudo cp -Rf ibex/* /usr/local/ git config --global --add safe.directory /io cd /io + +# Read optional constraints from environment +# MIN_PYTHON and MAX_PYTHON expected as strings like "3.8" or "3.10" +MIN_PYTHON="${MIN_PYTHON:-}" +MAX_PYTHON="${MAX_PYTHON:-}" + +# helper function: returns 0 if version is within [min,max], 1 otherwise +# uses Python for robust parsing/comparison +is_version_allowed() { + local ver="$1" # e.g. "3.9" + local min="$2" # e.g. "3.8" or empty + local max="$3" # e.g. "3.12" or empty + + # If neither bound provided, allow + if [ -z "$min" ] && [ -z "$max" ]; then + return 0 + fi + + # Use Python to compare versions (handles multi-digit minors) + "${PYBIN}/python" - < maxv: + sys.exit(3) +sys.exit(0) +PYCODE + + rc=$? + if [ $rc -eq 0 ]; then + return 0 + else + return 1 + fi +} + for PYBIN in /opt/python/cp3*/bin; do if [ "${PYBIN}" = "/opt/python/cp36-cp36m/bin" ] || [ "${PYBIN}" = "/opt/python/cp37-cp37m/bin" ]; then continue fi + # get the interpreter's major.minor (e.g. "3.9") + if [ ! -x "${PYBIN}/python" ]; then + echo "Skipping ${PYBIN} (no python executable)" + continue + fi + + PY_VER=$("${PYBIN}/python" -c 'import sys; print("{}.{}".format(sys.version_info[0], sys.version_info[1]))') + + # If MIN_PYTHON or MAX_PYTHON set, check allowed range + if [ -n "${MIN_PYTHON}" ] || [ -n "${MAX_PYTHON}" ]; then + if ! is_version_allowed "${PY_VER}" "${MIN_PYTHON}" "${MAX_PYTHON}"; then + echo "Skipping ${PYBIN} (python ${PY_VER} outside allowed range ${MIN_PYTHON}-${MAX_PYTHON})" + continue + fi + fi + "${PYBIN}/python" -m pip install --upgrade pip "${PYBIN}/python" -m pip install --upgrade wheel setuptools mkdir -p build_dir && cd build_dir diff --git a/scripts/docker/build_pybinding_codac4matlab.sh b/scripts/docker/build_pybinding_codac4matlab.sh index 0410becd3..b25fd262d 100644 --- a/scripts/docker/build_pybinding_codac4matlab.sh +++ b/scripts/docker/build_pybinding_codac4matlab.sh @@ -9,12 +9,79 @@ sudo cp -Rf ibex/* /usr/local/ git config --global --add safe.directory /io cd /io + +# Read optional constraints from environment +# MIN_PYTHON and MAX_PYTHON expected as strings like "3.8" or "3.10" +MIN_PYTHON="${MIN_PYTHON:-}" +MAX_PYTHON="${MAX_PYTHON:-}" + +# helper function: returns 0 if version is within [min,max], 1 otherwise +# uses Python for robust parsing/comparison +is_version_allowed() { + local ver="$1" # e.g. "3.9" + local min="$2" # e.g. "3.8" or empty + local max="$3" # e.g. "3.12" or empty + + # If neither bound provided, allow + if [ -z "$min" ] && [ -z "$max" ]; then + return 0 + fi + + # Use Python to compare versions (handles multi-digit minors) + "${PYBIN}/python" - < maxv: + sys.exit(3) +sys.exit(0) +PYCODE + + rc=$? + if [ $rc -eq 0 ]; then + return 0 + else + return 1 + fi +} + for PYBIN in /opt/python/cp3*/bin; do if [ "${PYBIN}" = "/opt/python/cp36-cp36m/bin" ] || [ "${PYBIN}" = "/opt/python/cp37-cp37m/bin" ]; then continue fi + # get the interpreter's major.minor (e.g. "3.9") + if [ ! -x "${PYBIN}/python" ]; then + echo "Skipping ${PYBIN} (no python executable)" + continue + fi + + PY_VER=$("${PYBIN}/python" -c 'import sys; print("{}.{}".format(sys.version_info[0], sys.version_info[1]))') + + # If MIN_PYTHON or MAX_PYTHON set, check allowed range + if [ -n "${MIN_PYTHON}" ] || [ -n "${MAX_PYTHON}" ]; then + if ! is_version_allowed "${PY_VER}" "${MIN_PYTHON}" "${MAX_PYTHON}"; then + echo "Skipping ${PYBIN} (python ${PY_VER} outside allowed range ${MIN_PYTHON}-${MAX_PYTHON})" + continue + fi + fi + "${PYBIN}/python" -m pip install --upgrade pip "${PYBIN}/python" -m pip install --upgrade wheel setuptools mkdir -p build_dir && cd build_dir