Skip to content

Commit 5f62653

Browse files
Rebase
1 parent 2d3c2c5 commit 5f62653

10 files changed

Lines changed: 135 additions & 279 deletions

File tree

.github/workflows/actions_build/action.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ inputs:
88
runs:
99
using: "composite"
1010
steps:
11-
- name: Set up Python ${{ inputs.python-version }}
11+
- name: Set up Python 3.14
1212
uses: actions/setup-python@v6
1313
with:
14-
python-version: ${{ inputs.python-version }}
14+
python-version: '3.14'
1515
- name: Get OS version
1616
id: get-os-version
1717
shell: bash -l {0}
@@ -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
@@ -56,11 +56,19 @@ runs:
5656
miniconda-version: "latest"
5757
auto-update-conda: true
5858
activate-environment: opengate_core
59-
python-version: ${{ inputs.python-version }}
59+
python-version: '3.14'
6060
- name: Set up Homebrew
6161
if: (inputs.os == 'macos-15') || (inputs.os == 'macos-15-intel')
6262
id: set-up-homebrew
63-
uses: Homebrew/actions/setup-homebrew@master
63+
uses: Homebrew/actions/setup-homebrew@main
64+
# - name: Cache Homebrew prefix
65+
# if: (inputs.os == 'macos-15') || (inputs.os == 'macos-15-intel')
66+
# id: cache-homebrew
67+
# uses: Homebrew/actions/cache-homebrew-prefix@main
68+
# with:
69+
# install: wget ccache fftw libomp xquartz xerces-c
70+
# uninstall: true
71+
# workflow-key: ${{ runner.os }}-${{ steps.get-os-version.outputs.release }}_geant4_${{ env.GEANT4_VERSION }}_itk_${{ env.ITK_VERSION }}_homebrew
6472
- name: Create opengate_core Wheel Linux
6573
if: (inputs.os == 'ubuntu-24.04') || (inputs.os == 'ubuntu-24.04-arm')
6674
env:
@@ -76,6 +84,7 @@ runs:
7684
MATRIX_OS: ${{ inputs.os }}
7785
MATRIX_PYTHON_VERSION: ${{ inputs.python-version }}
7886
MATRIX_CACHE: ${{ steps.cache_opengate_core_dependencies.outputs.cache-hit }}
87+
# BREW_CACHE: ${{ steps.cache_homebrew.outputs.cache-hit }}
7988
shell: bash -l {0}
8089
run: |
8190
export > $GITHUB_WORKSPACE/env_dump.txt
@@ -85,6 +94,7 @@ runs:
8594
env:
8695
MATRIX_CACHE: ${{ steps.cache_opengate_core_dependencies.outputs.cache-hit }}
8796
MATRIX_PYTHON_VERSION: ${{ inputs.python-version }}
97+
MATRIX_OS: ${{ inputs.os }}
8898
shell: bash -l {0}
8999
run: |
90100
export > $GITHUB_WORKSPACE\\env_dump.txt

.github/workflows/actions_build/ci_build_wheel_macos.sh

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,32 @@
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
10-
brew install --force --verbose --overwrite \
11-
ccache \
12-
fftw \
13-
libomp \
14-
xquartz \
15-
xerces-c \
16-
wget || true
17-
brew uninstall --ignore-dependencies libxext
18-
brew uninstall --ignore-dependencies libx11
5+
6+
if [ "${BREW_CACHE}" != 'true' ]; then
7+
brew install --force --verbose --overwrite \
8+
ccache \
9+
fftw \
10+
libomp \
11+
xquartz \
12+
xerces-c || true
13+
if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then
14+
conda install conda-forge::qt6-main conda-forge::qt6-3d
15+
else
16+
brew install qt
17+
fi
18+
brew uninstall --ignore-dependencies libxext
19+
brew uninstall --ignore-dependencies libx11
20+
fi
21+
1922
export LDFLAGS="-L/usr/local/opt/llvm/lib"
2023
export CPPFLAGS="-I/usr/local/opt/llvm/include -fopenmp"
2124
conda info
2225
conda list
23-
which python
24-
python --version
2526
export PATH="/usr/local/miniconda/envs/opengate_core/bin/:$PATH"
2627
pip install wget colored
27-
pip install wheel delocate
28-
if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then
29-
conda install conda-forge::qt6-main conda-forge::qt6-3d
30-
else
31-
brew install qt
32-
fi
28+
# install cibuildwheel
29+
pip install cibuildwheel[uv]==3.4.0
30+
3331
mkdir -p $HOME/software
3432
if [ "${MATRIX_CACHE}" != 'true' ]; then
3533
cd $HOME/software
@@ -75,20 +73,33 @@ else
7573
cp -r /opt/homebrew/share/qt/plugins/platforms/* opengate_core/plugins/
7674
cp -r /opt/homebrew/share/qt/plugins/imageformats/* opengate_core/plugins/
7775
fi
78-
python3 setup.py sdist bdist_wheel
79-
ls dist
76+
export CIBW_BUILD_FRONTEND="build[uv]"
77+
export CIBW_PLATFORM="macos"
78+
export CIBW_SKIP="*t*"
79+
export MACOSX_DEPLOYMENT_TARGET=15.0
80+
export CIBW_BEFORE_BUILD="uv pip install colored"
81+
8082
if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then
8183
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
84+
export CIBW_ARCHS_MACOS="x86_64"
8285
else
8386
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
87+
export CIBW_ARCHS_MACOS="arm64"
8488
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" {}
8589
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
90+
if [[ ${MATRIX_PYTHON_VERSION} == "3.10" ]]; then
91+
export CIBW_BUILD="cp310-*"
92+
elif [[ ${MATRIX_PYTHON_VERSION} == "3.11" ]]; then
93+
export CIBW_BUILD="cp311-*"
94+
elif [[ ${MATRIX_PYTHON_VERSION} == "3.12" ]]; then
95+
export CIBW_BUILD="cp312-*"
96+
elif [[ ${MATRIX_PYTHON_VERSION} == "3.13" ]]; then
97+
export CIBW_BUILD="cp313-*"
98+
elif [[ ${MATRIX_PYTHON_VERSION} == "3.14" ]]; then
99+
export CIBW_BUILD="cp314-*"
100+
fi
101+
102+
python -m cibuildwheel --output-dir dist
92103
cd dist
93104
if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then
94105
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: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,53 @@
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+
pip install wget colored setuptools
7+
pip install cibuildwheel[uv]==3.4.0
8+
9+
# Setup the environment for the build
1710
if [ ${MATRIX_OS} == "ubuntu-24.04-arm" ]; then
1811
export ARMDOCKER="_arm64"
12+
export CIBW_ARCHS="aarch64"
13+
export CIBW_MANYLINUX_AARCH64_IMAGE=tbaudier/opengate_core:${GEANT4_VERSION}$ARMDOCKER
14+
else
15+
export CIBW_ARCHS="x86_64"
16+
export CIBW_MANYLINUX_X86_64_IMAGE=tbaudier/opengate_core:${GEANT4_VERSION}
1917
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
18+
if [[ ${MATRIX_PYTHON_VERSION} == "3.10" ]]; then
19+
export CIBW_BUILD="cp310-*"
20+
elif [[ ${MATRIX_PYTHON_VERSION} == "3.11" ]]; then
21+
export CIBW_BUILD="cp311-*"
22+
elif [[ ${MATRIX_PYTHON_VERSION} == "3.12" ]]; then
23+
export CIBW_BUILD="cp312-*"
24+
elif [[ ${MATRIX_PYTHON_VERSION} == "3.13" ]]; then
25+
export CIBW_BUILD="cp313-*"
26+
elif [[ ${MATRIX_PYTHON_VERSION} == "3.14" ]]; then
27+
export CIBW_BUILD="cp314-*"
28+
fi
29+
export CIBW_PLATFORM="linux"
30+
export CIBW_BUILD_FRONTEND="build[uv]"
31+
export CIBW_SKIP="*-musllinux_* *t*"
32+
export CIBW_BEFORE_BUILD='
33+
pip install colored &&
34+
mkdir -p opengate_core/plugins &&
35+
export QT_PLUGIN_DIR=$(qtpaths6 --plugin-dir) &&
36+
cp -r -n $QT_PLUGIN_DIR/platforms/* opengate_core/plugins/ &&
37+
cp -r -n $QT_PLUGIN_DIR/imageformats opengate_core/plugins/ &&
38+
source /software/geant4/bin/geant4make.sh &&
39+
. /opt/rh/gcc-toolset-14/enable
40+
'
41+
42+
# expose external libraries to build environment
43+
export CIBW_ENVIRONMENT='
44+
CMAKE_PREFIX_PATH=/software/geant4/bin:/software/itk/bin/
45+
Geant4_DIR=/software/geant4/lib/cmake/Geant4
46+
ITK_DIR=/software/itk/lib/cmake/ITK
47+
LD_LIBRARY_PATH=/software/geant4/lib:/software/itk/lib
48+
'
49+
50+
# Run the build in custom docker
51+
cd core
52+
python -m cibuildwheel --output-dir dist
53+
mkdir -p $GITHUB_WORKSPACE/dist
54+
mv dist/*.whl $GITHUB_WORKSPACE/dist/

.github/workflows/actions_build/ci_build_wheel_windows.sh

Lines changed: 24 additions & 11 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'
@@ -55,24 +55,37 @@ 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
5757
if [[ ${MATRIX_PYTHON_VERSION} == "3.10" ]]; then
58-
export CIBW_BUILD="cp310-win_amd64"
58+
export CIBW_BUILD="cp310-*"
5959
elif [[ ${MATRIX_PYTHON_VERSION} == "3.11" ]]; then
60-
export CIBW_BUILD="cp311-win_amd64"
60+
export CIBW_BUILD="cp311-*"
6161
elif [[ ${MATRIX_PYTHON_VERSION} == "3.12" ]]; then
62-
export CIBW_BUILD="cp312-win_amd64"
62+
export CIBW_BUILD="cp312-*"
6363
elif [[ ${MATRIX_PYTHON_VERSION} == "3.13" ]]; then
64-
export CIBW_BUILD="cp313-win_amd64"
64+
export CIBW_BUILD="cp313-*"
6565
elif [[ ${MATRIX_PYTHON_VERSION} == "3.14" ]]; then
66-
export CIBW_BUILD="cp314-win_amd64"
66+
export CIBW_BUILD="cp314-*"
6767
fi
68+
echo ${MATRIX_OS}
69+
if [[ ${MATRIX_OS} == "windows-11-arm" ]]; then
70+
export CIBW_ARCHS="ARM64"
71+
else
72+
export CIBW_ARCHS="AMD64"
73+
fi
74+
export CIBW_BUILD_FRONTEND="build[uv]"
75+
export CIBW_SKIP="*t*"
76+
export CIBW_PLATFORM="windows"
6877
find $HOME/software/geant4/bin/ -iname "*.dll"
6978
ls $HOME/software/geant4/bin/BuildProducts/Release/bin
7079
ls $HOME/software/geant4/bin/BuildProducts/Release/lib/
71-
export CIBW_BEFORE_BUILD="python -m pip install colored"
80+
81+
# use delvewheel on windows
82+
export CIBW_BEFORE_BUILD_WINDOWS="uv pip install colored"
83+
export CIBW_REPAIR_WHEEL_COMMAND_WINDOWS=''
7284
python -m cibuildwheel --output-dir dist
85+
7386
cd ..
7487
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
88+
delvewheel repair -w core/dist2 core/dist/*.whl --add-path $HOME/software/geant4/bin/BuildProducts/Release/bin -vv
89+
90+
ls core/dist2
7891
mv core/dist2 dist

.github/workflows/createWheelLinux.sh

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

0 commit comments

Comments
 (0)