Skip to content

Commit 5e3e4ce

Browse files
Rebase to current master
1 parent e8edae7 commit 5e3e4ce

10 files changed

Lines changed: 80 additions & 268 deletions

File tree

.github/workflows/actions_build/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ runs:
4545
fi
4646
- name: Cache modules
4747
id: cache_opengate_core_dependencies
48-
uses: actions/cache@v4
48+
uses: actions/cache@v5
4949
with:
5050
path: ~/software
5151
key: ${{ runner.os }}-${{ steps.get-os-version.outputs.release }}_geant4_${{ env.GEANT4_VERSION }}_itk_${{ env.ITK_VERSION }}_build
@@ -66,6 +66,7 @@ runs:
6666
env:
6767
MATRIX_OS: ${{ inputs.os }}
6868
MATRIX_PYTHON_VERSION: ${{ inputs.python-version }}
69+
MATRIX_CACHE: ${{ steps.cache_opengate_core_dependencies.outputs.cache-hit }}
6970
shell: bash -l {0}
7071
run: |
7172
export > $GITHUB_WORKSPACE/env_dump.txt
@@ -85,6 +86,7 @@ runs:
8586
env:
8687
MATRIX_CACHE: ${{ steps.cache_opengate_core_dependencies.outputs.cache-hit }}
8788
MATRIX_PYTHON_VERSION: ${{ inputs.python-version }}
89+
MATRIX_OS: ${{ inputs.os }}
8890
shell: bash -l {0}
8991
run: |
9092
export > $GITHUB_WORKSPACE\\env_dump.txt

.github/workflows/actions_build/ci_build_wheel_macos.sh

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,21 @@
22
set -e
33

44
source $GITHUB_WORKSPACE/env_dump.txt
5-
brew install python@${MATRIX_PYTHON_VERSION} || true
6-
brew link --overwrite python@${MATRIX_PYTHON_VERSION}
7-
#brew update
8-
#rm -rf /usr/local/bin/python3.1*-config /usr/local/bin/2to3-3.1* /usr/local/bin/idle3.1* /usr/local/bin/pydoc3.1* /usr/local/bin/python3.1*
9-
#rm -rf /usr/local/bin/python3-config /usr/local/bin/2to3 /usr/local/bin/idle3 /usr/local/bin/pydoc3 /usr/local/bin/python3
105
brew install --force --verbose --overwrite \
116
ccache \
127
fftw \
138
libomp \
149
xquartz \
15-
xerces-c \
16-
wget || true
10+
xerces-c || true
1711
brew uninstall --ignore-dependencies libxext
1812
brew uninstall --ignore-dependencies libx11
1913
export LDFLAGS="-L/usr/local/opt/llvm/lib"
2014
export CPPFLAGS="-I/usr/local/opt/llvm/include -fopenmp"
2115
conda info
2216
conda list
23-
which python
24-
python --version
2517
export PATH="/usr/local/miniconda/envs/opengate_core/bin/:$PATH"
2618
pip install wget colored
27-
pip install wheel delocate
19+
pip install cibuildwheel[uv]==3.4.0
2820
if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then
2921
conda install conda-forge::qt6-main conda-forge::qt6-3d
3022
else
@@ -75,20 +67,22 @@ else
7567
cp -r /opt/homebrew/share/qt/plugins/platforms/* opengate_core/plugins/
7668
cp -r /opt/homebrew/share/qt/plugins/imageformats/* opengate_core/plugins/
7769
fi
78-
python3 setup.py sdist bdist_wheel
79-
ls dist
70+
export CIBW_BUILD_FRONTEND="build[uv]"
71+
export CIBW_PLATFORM="macos"
72+
export CIBW_SKIP="*t*"
73+
export MACOSX_DEPLOYMENT_TARGET=15.0
74+
export CIBW_BEFORE_BUILD="uv pip install colored"
75+
8076
if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then
8177
export DYLD_LIBRARY_PATH=$HOME/software/geant4/bin/BuildProducts/lib:/Users/runner/miniconda3/envs/opengate_core/lib/qt6/plugins/platforms:/opt/X11/lib/:$DYLD_LIBRARY_PATH:/Users/runner/miniconda3/envs/opengate_core/lib
78+
export CIBW_ARCHS_MACOS="x86_64"
8279
else
8380
export DYLD_LIBRARY_PATH=$HOME/software/geant4/bin/BuildProducts/lib:/opt/homebrew/share/qt/plugins/platforms/:/opt/X11/lib/:$DYLD_LIBRARY_PATH:/opt/homebrew/lib
81+
export CIBW_ARCHS_MACOS="arm64"
8482
python -c "import os,delocate; print(os.path.join(os.path.dirname(delocate.__file__), 'tools.py'));quit()" | xargs -I{} sed -i."" "s/first, /input.pop('i386',None); first, /g" {}
8583
fi
86-
delocate-listdeps --all dist/*.whl
87-
delocate-wheel -w fixed_wheels -v dist/*.whl
88-
rm -rf dist
89-
ls fixed_wheels
90-
delocate-listdeps --all fixed_wheels/*.whl
91-
mv fixed_wheels dist
84+
85+
python -m cibuildwheel --output-dir dist
9286
cd dist
9387
if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then
9488
find . -name '*whl' -exec bash -c ' mv $0 ${0/macosx_15_0/macosx_10_9}' {} \;

.github/workflows/actions_build/ci_build_wheel_ubuntu.sh

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,43 @@
22
set -e
33

44
source $GITHUB_WORKSPACE/env_dump.txt
5-
if [ ${MATRIX_PYTHON_VERSION} == "3.10" ]; then
6-
export PYTHONFOLDER="cp310-cp310"
7-
elif [ ${MATRIX_PYTHON_VERSION} == "3.11" ]; then
8-
export PYTHONFOLDER="cp311-cp311"
9-
elif [ ${MATRIX_PYTHON_VERSION} == "3.12" ]; then
10-
export PYTHONFOLDER="cp312-cp312"
11-
elif [ ${MATRIX_PYTHON_VERSION} == "3.13" ]; then
12-
export PYTHONFOLDER="cp313-cp313"
13-
elif [ ${MATRIX_PYTHON_VERSION} == "3.14" ]; then
14-
export PYTHONFOLDER="cp314-cp314"
15-
fi
16-
mkdir -p $HOME/software
5+
6+
# install cibuildwheel
7+
pip install cibuildwheel[uv]==3.4.0
8+
pip install wget colored setuptools
9+
10+
# Setup the environment for the build
1711
if [ ${MATRIX_OS} == "ubuntu-24.04-arm" ]; then
1812
export ARMDOCKER="_arm64"
13+
export CIBW_ARCHS="aarch64"
14+
export CIBW_MANYLINUX_AARCH64_IMAGE=tbaudier/opengate_core:${GEANT4_VERSION}$ARMDOCKER
15+
else
16+
export CIBW_ARCHS="x86_64"
17+
export CIBW_MANYLINUX_X86_64_IMAGE=tbaudier/opengate_core:${GEANT4_VERSION}
1918
fi
20-
docker run --rm -e "PYTHONFOLDER=${PYTHONFOLDER}" -v $GITHUB_WORKSPACE:/home tbaudier/opengate_core:${GEANT4_VERSION}$ARMDOCKER /home/.github/workflows/createWheelLinux.sh
21-
ls wheelhouse
22-
rm -rf dist
23-
mv wheelhouse dist
24-
sudo chown -R runner:docker dist
19+
export CIBW_PLATFORM="linux"
20+
export CIBW_BUILD_FRONTEND="build[uv]"
21+
export CIBW_SKIP="*-musllinux_* *t*"
22+
export CIBW_BEFORE_BUILD='
23+
pip install colored &&
24+
mkdir -p opengate_core/plugins &&
25+
export QT_PLUGIN_DIR=$(qtpaths6 --plugin-dir) &&
26+
cp -r -n $QT_PLUGIN_DIR/platforms/* opengate_core/plugins/ &&
27+
cp -r -n $QT_PLUGIN_DIR/imageformats opengate_core/plugins/ &&
28+
source /software/geant4/bin/geant4make.sh &&
29+
. /opt/rh/gcc-toolset-14/enable
30+
'
31+
32+
# expose external libraries to build environment
33+
export CIBW_ENVIRONMENT='
34+
CMAKE_PREFIX_PATH=/software/geant4/bin:/software/itk/bin/
35+
Geant4_DIR=/software/geant4/lib/cmake/Geant4
36+
ITK_DIR=/software/itk/lib/cmake/ITK
37+
LD_LIBRARY_PATH=/software/geant4/lib:/software/itk/lib
38+
'
39+
40+
# Run the build in custom docker
41+
cd core
42+
python -m cibuildwheel --output-dir dist
43+
mkdir -p $GITHUB_WORKSPACE/dist
44+
mv dist/*.whl $GITHUB_WORKSPACE/dist/

.github/workflows/actions_build/ci_build_wheel_windows.sh

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ conda list
1111
which python
1212
python --version
1313
export PATH="/usr/local/miniconda/envs/opengate_core/bin/:$PATH"
14-
pip install wheel wget colored
14+
pip install wget colored delvewheel
1515

16-
pip install cibuildwheel==3.4.0
16+
pip install cibuildwheel[uv]==3.4.0
1717

1818
# For windows 2025, Need to add the certifi CA bundle to avoid SSL errors when downloading dependencies during the build. This is a workaround for cibuildwheel which does not handle this properly on Windows.
1919
python - << 'EOF'
@@ -54,25 +54,27 @@ cd $GITHUB_WORKSPACE
5454
source $HOME/software/geant4/bin/geant4make.sh
5555
export CMAKE_PREFIX_PATH=$HOME/software/geant4/bin:$HOME/software/itk/bin/:${CMAKE_PREFIX_PATH}
5656
cd core
57-
if [[ ${MATRIX_PYTHON_VERSION} == "3.10" ]]; then
58-
export CIBW_BUILD="cp310-win_amd64"
59-
elif [[ ${MATRIX_PYTHON_VERSION} == "3.11" ]]; then
60-
export CIBW_BUILD="cp311-win_amd64"
61-
elif [[ ${MATRIX_PYTHON_VERSION} == "3.12" ]]; then
62-
export CIBW_BUILD="cp312-win_amd64"
63-
elif [[ ${MATRIX_PYTHON_VERSION} == "3.13" ]]; then
64-
export CIBW_BUILD="cp313-win_amd64"
65-
elif [[ ${MATRIX_PYTHON_VERSION} == "3.14" ]]; then
66-
export CIBW_BUILD="cp314-win_amd64"
57+
echo ${MATRIX_OS}
58+
if [[ ${MATRIX_OS} == "windows-11-arm" ]]; then
59+
export CIBW_ARCHS="ARM64"
60+
else
61+
export CIBW_ARCHS="AMD64"
6762
fi
63+
export CIBW_BUILD_FRONTEND="build[uv]"
64+
export CIBW_SKIP="*t*"
65+
export CIBW_PLATFORM="windows"
6866
find $HOME/software/geant4/bin/ -iname "*.dll"
6967
ls $HOME/software/geant4/bin/BuildProducts/Release/bin
7068
ls $HOME/software/geant4/bin/BuildProducts/Release/lib/
71-
export CIBW_BEFORE_BUILD="python -m pip install colored"
69+
70+
# use delvewheel on windows
71+
export CIBW_BEFORE_BUILD_WINDOWS="uv pip install colored"
72+
export CIBW_REPAIR_WHEEL_COMMAND_WINDOWS=''
7273
python -m cibuildwheel --output-dir dist
74+
7375
cd ..
7476
mkdir core/dist2
75-
pip install pefile machomachomangler
76-
ls core/dist
77-
python $GITHUB_WORKSPACE\\.github\\workflows\\delocateWindows.py core\\dist -w core\\dist2 -d C:\\Users\\runneradmin\\software\\geant4\\bin\\BuildProducts\\Release\\bin
77+
delvewheel repair -w core/dist2 core/dist/*.whl --add-path $HOME/software/geant4/bin/BuildProducts/Release/bin -vv
78+
79+
ls core/dist2
7880
mv core/dist2 dist

.github/workflows/createWheelLinux.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)