Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions .github/workflows/actions_build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ inputs:
runs:
using: "composite"
steps:
- name: Set up Python ${{ inputs.python-version }}
- name: Set up Python 3.14
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}
python-version: '3.14'
- name: Get OS version
id: get-os-version
shell: bash -l {0}
Expand Down Expand Up @@ -45,22 +45,31 @@ runs:
fi
- name: Cache modules
id: cache_opengate_core_dependencies
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ~/software
key: ${{ runner.os }}-${{ steps.get-os-version.outputs.release }}_geant4_${{ env.GEANT4_VERSION }}_itk_${{ env.ITK_VERSION }}_build
restore-keys: ${{ runner.os }}-${{ steps.get-os-version.outputs.release }}_geant4_${{ env.GEANT4_VERSION }}_itk_${{ env.ITK_VERSION }}_build
- uses: conda-incubator/setup-miniconda@v3
if: (inputs.os == 'macos-15') || (inputs.os == 'macos-15-intel') || (inputs.os == 'windows-2025') || (inputs.os == 'windows-11-arm')
- name: Miniconda setup Macos and windows
if: (inputs.os == 'macos-15') || (inputs.os == 'windows-2025')
uses: conda-incubator/setup-miniconda@v4
with:
miniconda-version: "latest"
auto-update-conda: true
activate-environment: opengate_core
python-version: ${{ inputs.python-version }}
python-version: '3.14'
- name: Miniconda setup Macos intel and windows arm
if: (inputs.os == 'macos-15-intel')
uses: conda-incubator/setup-miniconda@v4
with:
miniconda-version: "latest"
auto-update-conda: true
activate-environment: opengate_core
python-version: '3.13'
- name: Set up Homebrew
if: (inputs.os == 'macos-15') || (inputs.os == 'macos-15-intel')
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
uses: Homebrew/actions/setup-homebrew@main
- name: Create opengate_core Wheel Linux
if: (inputs.os == 'ubuntu-24.04') || (inputs.os == 'ubuntu-24.04-arm')
env:
Expand All @@ -85,6 +94,7 @@ runs:
env:
MATRIX_CACHE: ${{ steps.cache_opengate_core_dependencies.outputs.cache-hit }}
MATRIX_PYTHON_VERSION: ${{ inputs.python-version }}
MATRIX_OS: ${{ inputs.os }}
shell: bash -l {0}
run: |
export > $GITHUB_WORKSPACE\\env_dump.txt
Expand Down
74 changes: 43 additions & 31 deletions .github/workflows/actions_build/ci_build_wheel_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,35 @@
set -e

source $GITHUB_WORKSPACE/env_dump.txt
brew install python@${MATRIX_PYTHON_VERSION} || true
brew link --overwrite python@${MATRIX_PYTHON_VERSION}
#brew update
#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*
#rm -rf /usr/local/bin/python3-config /usr/local/bin/2to3 /usr/local/bin/idle3 /usr/local/bin/pydoc3 /usr/local/bin/python3

brew install --force --verbose --overwrite \
ccache \
fftw \
libomp \
xquartz \
xerces-c \
wget || true
ccache \
fftw \
libomp \
xerces-c || true

brew uninstall --ignore-dependencies libxext
brew uninstall --ignore-dependencies libx11

export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include -fopenmp"
conda info
conda list
which python
python --version
export PATH="/usr/local/miniconda/envs/opengate_core/bin/:$PATH"
pip install wget colored setuptools
pip install wheel delocate
export PATH="/Users/runner/miniconda3/envs/opengate_core/bin/:$PATH"

if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then
conda install conda-forge::qt6-main conda-forge::qt6-3d
export QT_PLUGIN_DIR="/Users/runner/miniconda3/envs/opengate_core/lib/qt6/plugins"
else
brew install qt
export QT_PLUGIN_DIR=$(qtpaths6 --plugin-dir)
fi

echo "QT_PLUGIN_DIR is $QT_PLUGIN_DIR"
pip install wget colored setuptools
# install cibuildwheel
pip install cibuildwheel[uv]==3.4.0

mkdir -p $HOME/software
if [ "${MATRIX_CACHE}" != 'true' ]; then
cd $HOME/software
Expand Down Expand Up @@ -66,29 +67,40 @@ fi
cd $GITHUB_WORKSPACE
source $HOME/software/geant4/bin/geant4make.sh
export CMAKE_PREFIX_PATH=$HOME/software/geant4/bin:$HOME/software/itk/bin/:${CMAKE_PREFIX_PATH}
cp VERSION core/VERSION
cd core

mkdir opengate_core/plugins
if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then
cp -r /Users/runner/miniconda3/envs/opengate_core/lib/qt6/plugins/platforms/* opengate_core/plugins/
cp -r /Users/runner/miniconda3/envs/opengate_core/lib/qt6/plugins/imageformats opengate_core/plugins/
else
cp -r /opt/homebrew/share/qt/plugins/platforms/* opengate_core/plugins/
cp -r /opt/homebrew/share/qt/plugins/imageformats/* opengate_core/plugins/
fi
python3 setup.py sdist bdist_wheel
ls dist
cp -r $QT_PLUGIN_DIR/platforms/* opengate_core/plugins/
cp -r $QT_PLUGIN_DIR/imageformats/* opengate_core/plugins/

export CIBW_BUILD_FRONTEND="build[uv]"
export CIBW_PLATFORM="macos"
export CIBW_SKIP="*t*"
export MACOSX_DEPLOYMENT_TARGET=15.0
export CIBW_BEFORE_BUILD="uv pip install colored"

if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then
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
export CIBW_ARCHS_MACOS="x86_64"
else
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
export CIBW_ARCHS_MACOS="arm64"
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" {}
fi
delocate-listdeps --all dist/*.whl
delocate-wheel -w fixed_wheels -v dist/*.whl
rm -rf dist
ls fixed_wheels
delocate-listdeps --all fixed_wheels/*.whl
mv fixed_wheels dist
if [[ ${MATRIX_PYTHON_VERSION} == "3.10" ]]; then
export CIBW_BUILD="cp310-*"
elif [[ ${MATRIX_PYTHON_VERSION} == "3.11" ]]; then
export CIBW_BUILD="cp311-*"
elif [[ ${MATRIX_PYTHON_VERSION} == "3.12" ]]; then
export CIBW_BUILD="cp312-*"
elif [[ ${MATRIX_PYTHON_VERSION} == "3.13" ]]; then
export CIBW_BUILD="cp313-*"
elif [[ ${MATRIX_PYTHON_VERSION} == "3.14" ]]; then
export CIBW_BUILD="cp314-*"
fi

python -m cibuildwheel --output-dir dist
cd dist
if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then
find . -name '*whl' -exec bash -c ' mv $0 ${0/macosx_15_0/macosx_10_9}' {} \;
Expand Down
65 changes: 48 additions & 17 deletions .github/workflows/actions_build/ci_build_wheel_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,54 @@
set -e

source $GITHUB_WORKSPACE/env_dump.txt
if [ ${MATRIX_PYTHON_VERSION} == "3.10" ]; then
export PYTHONFOLDER="cp310-cp310"
elif [ ${MATRIX_PYTHON_VERSION} == "3.11" ]; then
export PYTHONFOLDER="cp311-cp311"
elif [ ${MATRIX_PYTHON_VERSION} == "3.12" ]; then
export PYTHONFOLDER="cp312-cp312"
elif [ ${MATRIX_PYTHON_VERSION} == "3.13" ]; then
export PYTHONFOLDER="cp313-cp313"
elif [ ${MATRIX_PYTHON_VERSION} == "3.14" ]; then
export PYTHONFOLDER="cp314-cp314"
fi
mkdir -p $HOME/software

pip install wget colored setuptools
pip install cibuildwheel[uv]==3.4.0

# Setup the environment for the build
if [ ${MATRIX_OS} == "ubuntu-24.04-arm" ]; then
export ARMDOCKER="_arm64"
export CIBW_ARCHS="aarch64"
export CIBW_MANYLINUX_AARCH64_IMAGE=tbaudier/opengate_core:${GEANT4_VERSION}$ARMDOCKER
else
export CIBW_ARCHS="x86_64"
export CIBW_MANYLINUX_X86_64_IMAGE=tbaudier/opengate_core:${GEANT4_VERSION}
fi
docker run --rm -e "PYTHONFOLDER=${PYTHONFOLDER}" -v $GITHUB_WORKSPACE:/home tbaudier/opengate_core:${GEANT4_VERSION}$ARMDOCKER /home/.github/workflows/createWheelLinux.sh
ls wheelhouse
rm -rf dist
mv wheelhouse dist
sudo chown -R runner:docker dist
if [[ ${MATRIX_PYTHON_VERSION} == "3.10" ]]; then
export CIBW_BUILD="cp310-*"
elif [[ ${MATRIX_PYTHON_VERSION} == "3.11" ]]; then
export CIBW_BUILD="cp311-*"
elif [[ ${MATRIX_PYTHON_VERSION} == "3.12" ]]; then
export CIBW_BUILD="cp312-*"
elif [[ ${MATRIX_PYTHON_VERSION} == "3.13" ]]; then
export CIBW_BUILD="cp313-*"
elif [[ ${MATRIX_PYTHON_VERSION} == "3.14" ]]; then
export CIBW_BUILD="cp314-*"
fi
export CIBW_PLATFORM="linux"
export CIBW_BUILD_FRONTEND="build[uv]"
export CIBW_SKIP="*-musllinux_* *t*"
export CIBW_BEFORE_BUILD='
pip install colored &&
mkdir -p opengate_core/plugins &&
export QT_PLUGIN_DIR=$(qtpaths6 --plugin-dir) &&
cp -r -n $QT_PLUGIN_DIR/platforms/* opengate_core/plugins/ &&
cp -r -n $QT_PLUGIN_DIR/imageformats opengate_core/plugins/ &&
source /software/geant4/bin/geant4make.sh &&
. /opt/rh/gcc-toolset-14/enable
'

# expose external libraries to build environment
export CIBW_ENVIRONMENT='
CMAKE_PREFIX_PATH=/software/geant4/bin:/software/itk/bin/
Geant4_DIR=/software/geant4/lib/cmake/Geant4
ITK_DIR=/software/itk/lib/cmake/ITK
LD_LIBRARY_PATH=/software/geant4/lib:/software/itk/lib
'

# Run the build in custom docker
cp VERSION core/VERSION
cd core
python -m cibuildwheel --output-dir dist
mkdir -p $GITHUB_WORKSPACE/dist
mv dist/*.whl $GITHUB_WORKSPACE/dist/
37 changes: 25 additions & 12 deletions .github/workflows/actions_build/ci_build_wheel_windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ source $CONDA/Scripts/activate opengate_core
conda info
conda install cmake==3.31.2
cmake --version
conda install openssl==3.0.19
conda list
which python
python --version
export PATH="/usr/local/miniconda/envs/opengate_core/bin/:$PATH"
pip install wheel wget colored
pip install wget colored delvewheel

pip install cibuildwheel==3.4.0
pip install cibuildwheel[uv]==3.4.0

# 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.
python - << 'EOF'
Expand Down Expand Up @@ -53,26 +52,40 @@ fi
cd $GITHUB_WORKSPACE
source $HOME/software/geant4/bin/geant4make.sh
export CMAKE_PREFIX_PATH=$HOME/software/geant4/bin:$HOME/software/itk/bin/:${CMAKE_PREFIX_PATH}
cp VERSION core/VERSION
cd core
if [[ ${MATRIX_PYTHON_VERSION} == "3.10" ]]; then
export CIBW_BUILD="cp310-win_amd64"
export CIBW_BUILD="cp310-*"
elif [[ ${MATRIX_PYTHON_VERSION} == "3.11" ]]; then
export CIBW_BUILD="cp311-win_amd64"
export CIBW_BUILD="cp311-*"
elif [[ ${MATRIX_PYTHON_VERSION} == "3.12" ]]; then
export CIBW_BUILD="cp312-win_amd64"
export CIBW_BUILD="cp312-*"
elif [[ ${MATRIX_PYTHON_VERSION} == "3.13" ]]; then
export CIBW_BUILD="cp313-win_amd64"
export CIBW_BUILD="cp313-*"
elif [[ ${MATRIX_PYTHON_VERSION} == "3.14" ]]; then
export CIBW_BUILD="cp314-win_amd64"
export CIBW_BUILD="cp314-*"
fi
echo ${MATRIX_OS}
if [[ ${MATRIX_OS} == "windows-11-arm" ]]; then
export CIBW_ARCHS="ARM64"
else
export CIBW_ARCHS="AMD64"
fi
export CIBW_BUILD_FRONTEND="build[uv]"
export CIBW_SKIP="*t*"
export CIBW_PLATFORM="windows"
find $HOME/software/geant4/bin/ -iname "*.dll"
ls $HOME/software/geant4/bin/BuildProducts/Release/bin
ls $HOME/software/geant4/bin/BuildProducts/Release/lib/
export CIBW_BEFORE_BUILD="python -m pip install colored"

# use delvewheel on windows
export CIBW_BEFORE_BUILD_WINDOWS="uv pip install colored"
export CIBW_REPAIR_WHEEL_COMMAND_WINDOWS=''
python -m cibuildwheel --output-dir dist

cd ..
mkdir core/dist2
pip install pefile machomachomangler
ls core/dist
python $GITHUB_WORKSPACE\\.github\\workflows\\delocateWindows.py core\\dist -w core\\dist2 -d C:\\Users\\runneradmin\\software\\geant4\\bin\\BuildProducts\\Release\\bin
delvewheel repair -w core/dist2 core/dist/*.whl --add-path $HOME/software/geant4/bin/BuildProducts/Release/bin -vv

ls core/dist2
mv core/dist2 dist
24 changes: 0 additions & 24 deletions .github/workflows/createWheelLinux.sh

This file was deleted.

Loading
Loading