Automatically attach artifacts to release #546
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "CI/CD" | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| release: | |
| types: | |
| - published | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| MacOS: | |
| name: | |
| Build Native Executables and Python Wheels on ${{ matrix.platform }} (for ${{ matrix.python.std_version }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: [ macos-15-intel, macos-15 ] | |
| python: | |
| - std_version: "3.10" | |
| cibw_version: "cp310-" | |
| - std_version: "3.11" | |
| cibw_version: "cp311-" | |
| - std_version: "3.12" | |
| cibw_version: "cp312-" | |
| - std_version: "3.13" | |
| cibw_version: "cp313-" | |
| - std_version: "3.14" | |
| cibw_version: "cp314-" | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - name: checkout fv-solver repo | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Install MacOS Dependencies | |
| shell: bash | |
| run: | | |
| brew install boost | |
| brew install hdf5 | |
| brew uninstall llvm@18 | |
| brew install flang | |
| clang --version | |
| flang --version | |
| cmake --version | |
| brew info boost | |
| brew info hdf5 | |
| - name: Install Architecture-specific Dependencies <x86_64> | |
| if: matrix.platform == 'macos-15-intel' | |
| run: | | |
| python3 -m pip install h5py numpy --break-system-packages | |
| - name: Install Architecture-specific Dependencies <ARM64> | |
| if: matrix.platform == 'macos-15' | |
| run: | | |
| brew install libzip | |
| /opt/homebrew/bin/python3 -m pip install numpy h5py --break-system-packages | |
| - name: Build MacOS | |
| run: | | |
| platform=macos | |
| echo "working dir is $PWD" | |
| mkdir build | |
| cd build | |
| # General Build | |
| cmake -B . -S .. -G "Ninja" \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DLIBZIPPP_CMAKE_CONFIG_MODE=ON \ | |
| -DOPTION_TARGET_PYTHON_BINDING=OFF \ | |
| -DOPTION_TARGET_MESSAGING=OFF \ | |
| -DOPTION_TARGET_SMOLDYN_SOLVER=ON \ | |
| -DOPTION_TARGET_FV_SOLVER=ON \ | |
| -DOPTION_TARGET_DOCS=ON \ | |
| -DOPTION_TARGET_TESTS=ON | |
| cmake --build . --config Release | |
| - name: Test MacOS | |
| run: | | |
| platform=macos | |
| echo "working dir is $PWD" | |
| cd build | |
| ctest -VV | |
| echo "------ running FiniteVolume_x64 ------" | |
| ./bin/FiniteVolume_x64 || true | |
| echo | |
| echo "------ running smoldyn_x64 ------" | |
| ./bin/smoldyn_x64 || true | |
| - name: Fix MacOS shared object paths | |
| if: github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published') | |
| shell: bash | |
| run: | | |
| mkdir build/upload | |
| cd build/bin | |
| ls *_x64 | awk '{print $1}' | xargs -I '{}' otool -L '{}' | grep ")" | grep -v "build" | grep -v "System" | grep -v "/usr/lib/" | awk '{print $1}' | xargs -I '{}' cp -vn '{}' . || true | |
| ls *.dylib | awk '{print $1}' | xargs -I '{}' otool -L '{}' | grep ")" | grep -v "build" | grep -v "System" | grep -v "/usr/lib/" | awk '{print $1}' | xargs -I '{}' cp -vn '{}' . || true | |
| ls *.dylib | awk '{print $1}' | xargs -I '{}' otool -L '{}' | grep ")" | grep -v "build" | grep -v "System" | grep -v "/usr/lib/" | awk '{print $1}' | xargs -I '{}' cp -vn '{}' . || true | |
| chmod u+w,+x * | |
| tar czvf ../upload/mac64_bad_paths.tgz . | |
| ../../.github/scripts/install_name_tool_macos.sh | |
| tar czvf ../upload/fvsolver_mac64.tgz --dereference . | |
| - name: Upload MacOS Native Binaries <x86_64> | |
| if: matrix.platform == 'macos-15-intel' && matrix.python.std_version == '3.12' && (github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published')) | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: fvsolver_macos_x86_64.tgz | |
| path: build/upload/fvsolver_mac64.tgz | |
| - name: Upload MacOS Native Binaries <ARM64> | |
| if: matrix.platform == 'macos-15' && matrix.python.std_version == '3.12' && (github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published')) | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: fvsolver_macos_arm64.tgz | |
| path: build/upload/fvsolver_mac64.tgz | |
| - name: Build Wheels | |
| uses: pypa/cibuildwheel@v3.4.0 | |
| if: github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published') | |
| env: | |
| MACOSX_DEPLOYMENT_TARGET: 15.0 | |
| CIBW_BUILD: "${{ matrix.python.cibw_version }}*" | |
| CIBW_ARCHES: "native" | |
| CIBW_CONFIG_SETTINGS: >- | |
| cmake.args=-DOPTION_TARGET_PYTHON_BINDING=ON | |
| - name: Upload Python Wheel | |
| uses: actions/upload-artifact@v7 | |
| if: github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published') | |
| with: | |
| name: pyvcell-fv-${{ matrix.platform }}-${{ matrix.python.cibw_version }}-cibw-wheels | |
| path: ./wheelhouse/*.whl | |
| - name: Setup tmate session | |
| if: ${{ failure() }} | |
| uses: mxschmitt/action-tmate@v3 | |
| with: | |
| limit-access-to-actor: true | |
| WindowsOS: | |
| name: | |
| Build Native Executables and Python Wheels on ${{ matrix.platform }} (for ${{ matrix.python.std_version }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| #platform: [ windows-latest, windows-11-arm ] | |
| platform: [ windows-latest ] | |
| python: | |
| - std_version: "3.10" | |
| cibw_version: "cp310-" | |
| - std_version: "3.11" | |
| cibw_version: "cp311-" | |
| - std_version: "3.12" | |
| cibw_version: "cp312-" | |
| - std_version: "3.13" | |
| cibw_version: "cp313-" | |
| - std_version: "3.14" | |
| cibw_version: "cp314-" | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - name: Pre-install Configuration <x86_64> | |
| if: matrix.platform == 'windows-latest' | |
| shell: bash | |
| run: | | |
| echo "CONAN_PROFILE_NAME=Windows-AMD64_profile.txt" >> $GITHUB_ENV | |
| echo "CONAN_ENV_PATH=${{ github.workspace }}/build/conan_toolchain.cmake" | sed 's/\\/\//g' >> $GITHUB_ENV | |
| - name: Pre-install Configuration <ARM64> | |
| if: matrix.platform == 'windows-11-arm' | |
| shell: bash | |
| run: | | |
| echo "CONAN_PROFILE_NAME=Windows-ARM64_profile.txt" >> $GITHUB_ENV | |
| echo "CONAN_ENV_PATH=${{ github.workspace }}/build/conan_toolchain.cmake" | sed 's/\\/\//g' >> $GITHUB_ENV | |
| - name: Install Build Environment (Part 1 - MSVC toolset) | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Install Build Environment (Part 2 - Remaining Build Tools & Python Init) | |
| shell: powershell | |
| run: | | |
| choco install visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64" -y | |
| choco install zip -y | |
| choco upgrade llvm | |
| $llvmDir = "C:\Program Files\Conan\conan" | |
| $env:PATH = "$llvmDir;$env:PATH" | |
| $llvmDir | Set-Content -Path $env:GITHUB_PATH | |
| clang --version | |
| flang --version | |
| choco install conan -y | |
| $conanDir = "C:\Program Files\Conan\conan" | |
| $env:PATH = "$conanDir;$env:PATH" | |
| $conanDir | Set-Content -Path $env:GITHUB_PATH | |
| $env:CONAN_HOME = "C:\.conan" | |
| "CONAN_HOME=C:\.conan" | Out-File -FilePath $env:GITHUB_ENV -Append | |
| conan --version | |
| conan profile detect --force | |
| python3 -m pip install numpy h5py | |
| python3 -m pip freeze | |
| - name: Checkout VCell's FV-Solver Repo | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Install Windows Dependencies through Conan | |
| shell: powershell | |
| run: | | |
| Copy-Item (Join-Path "conan-profiles\CI-CD" "${{ env.CONAN_PROFILE_NAME }}") (Join-Path $env:CONAN_HOME "profiles\default") | |
| conan install . --output-folder build --build=missing -o include_messaging=False | |
| icacls (Join-Path $PWD "build") /grant Everyone:F /T | |
| - name: Build Windows | |
| shell: powershell | |
| run: | | |
| cd build | |
| . ./conanbuild.ps1 | |
| cmake -B . -S .. -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Release -DLIBZIPPP_CMAKE_CONFIG_MODE=ON -DOPTION_TARGET_PYTHON_BINDING=OFF -DOPTION_TARGET_MESSAGING=OFF -DOPTION_TARGET_SMOLDYN_SOLVER=ON -DOPTION_TARGET_FV_SOLVER=ON -DOPTION_TARGET_DOCS=OFF -DOPTION_TARGET_TESTS=ON | |
| cmake --build . --config Release | |
| - name: Test Windows | |
| shell: bash | |
| run: | | |
| echo "working dir is $PWD" | |
| cd build | |
| ctest -VV | |
| echo "------ running FiniteVolume_x64 ------" | |
| ./bin/FiniteVolume_x64 || true | |
| echo | |
| echo "------ running smoldyn_x64 ------" | |
| ./bin/smoldyn_x64 || true | |
| - name: Handle shared object paths for Windows native build | |
| if: github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published') | |
| shell: bash | |
| run: | | |
| mkdir build/upload | |
| cd build/bin | |
| ls *.exe | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true | |
| ls *.dll | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true | |
| ls *.dll | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true | |
| chmod u+w,+x * | |
| zip ../upload/fvsolver_win64.zip ./* | |
| cd ../.. | |
| # fi | |
| - name: Upload Windows Binaries <x86_64> | |
| if: matrix.platform == 'windows-latest' && matrix.python.std_version == '3.12' && (github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published')) | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: fvsolver_win64.zip | |
| path: build/upload/fvsolver_win64.zip | |
| - name: Upload Windows Binaries <ARM64> | |
| if: matrix.platform == 'windows-11-arm' && matrix.python.std_version == '3.12' && (github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published')) | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: fvsolver_win64.zip | |
| path: build/upload/fvsolver_win_arm64.zip | |
| - name: Modify Archive Name <x86_64> | |
| if: matrix.platform == 'windows-latest' && matrix.python.std_version == '3.12' && github.event_name == 'release' && github.event.action == 'published' | |
| run: | | |
| mv build/upload/fvsolver_win64.zip build/upload/win64.zip | |
| - name: Modify Archive Name <ARM64> | |
| if: matrix.platform == 'windows-11-arm' && matrix.python.std_version == '3.12' && github.event_name == 'release' && github.event.action == 'published' | |
| run: | | |
| mv build/upload/fvsolver_win_arm64.zip build/upload/win64arm.zip | |
| - name: Attach Windows Binaries to Release <x86_64> | |
| uses: softprops/action-gh-release@v3 | |
| if: matrix.platform == 'windows-latest' && matrix.python.std_version == '3.12' && github.event_name == 'release' && github.event.action == 'published' | |
| with: | |
| files: | | |
| build/upload/win64.zip | |
| - name: Attach Linux Binaries to Release <ARM64> | |
| uses: softprops/action-gh-release@v3 | |
| if: matrix.platform == 'windows-11-arm' && matrix.python.std_version == '3.12' && github.event_name == 'release' && github.event.action == 'published' | |
| with: | |
| files: | | |
| build/upload/win64arm.zip | |
| - name: Set up Python ${{ matrix.python.std_version }} | |
| if: github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published') | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python.std_version }} | |
| - name: Build Wheels (Windows) | |
| if: github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published') | |
| env: | |
| CC: clang-cl | |
| CXX: clang-cl | |
| FC: flang | |
| CMAKE_GENERATOR: Ninja | |
| CMAKE_TOOLCHAIN_FILE: ${{ env.CONAN_ENV_PATH }} | |
| run: | | |
| cd $env:GITHUB_WORKSPACE | |
| . $env:GITHUB_WORKSPACE/build/conanbuild.ps1 | |
| python3 -m pip install build h5py | |
| python3 -m build --wheel -o ./wheelhouse -C cmake.define.LIBZIPPP_CMAKE_CONFIG_MODE=ON -C cmake.define.OPTION_TARGET_PYTHON_BINDING=ON -C cmake.define.OPTION_TARGET_MESSAGING=OFF -C cmake.define.OPTION_TARGET_SMOLDYN_SOLVER=ON -C cmake.define.OPTION_TARGET_FV_SOLVER=ON -C cmake.define.OPTION_TARGET_DOCS=OFF -C cmake.define.OPTION_TARGET_TESTS=ON | |
| - name: Upload Python Wheel | |
| if: github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: pyvcell-fv-${{ matrix.platform }}-${{ matrix.python.cibw_version }}-cibw-wheels | |
| path: ./wheelhouse/*.whl | |
| - name: Setup tmate session | |
| if: ${{ failure() }} | |
| uses: mxschmitt/action-tmate@v3 | |
| with: | |
| limit-access-to-actor: true | |
| GNULinux: | |
| name: | |
| Build Native Executables and Python Wheels on ${{ matrix.platform }} (for ${{ matrix.python.std_version }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: [ubuntu-latest, ubuntu-24.04-arm] | |
| python: | |
| - std_version: "3.10" | |
| cibw_version: "cp310-" | |
| - std_version: "3.11" | |
| cibw_version: "cp311-" | |
| - std_version: "3.12" | |
| cibw_version: "cp312-" | |
| - std_version: "3.13" | |
| cibw_version: "cp313-" | |
| - std_version: "3.14" | |
| cibw_version: "cp314-" | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - name: Checkout VCell's FV-Solver Repo | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Pre-install Configuration <x86_64> | |
| if: matrix.platform == 'ubuntu-latest' | |
| run: | | |
| echo "CONAN_DEB_DOWNLOAD_LINK=https://github.com/conan-io/conan/releases/download/2.26.2/conan-2.26.2-amd64.deb" >> $GITHUB_ENV | |
| echo "CONAN_PROFILE_NAME=Linux-AMD64_profile.txt" >> $GITHUB_ENV | |
| - name: Pre-install Configuration <ARM64> | |
| if: matrix.platform == 'ubuntu-24.04-arm' | |
| run: | | |
| echo "CONAN_DEB_DOWNLOAD_LINK=https://github.com/conan-io/conan/releases/download/2.26.2/conan-2.26.2-arm64.deb" >> $GITHUB_ENV | |
| echo "CONAN_PROFILE_NAME=Linux-ARM64_profile.txt" >> $GITHUB_ENV | |
| - name: Install Linux Dependencies | |
| run: | | |
| sudo apt update | |
| sudo apt upgrade -y | |
| sudo apt install -y wget python3-pip | |
| python3 -m pip install h5py numpy | |
| wget --version | |
| wget ${{ env.CONAN_DEB_DOWNLOAD_LINK }} | |
| sudo apt install -y ./conan-*.deb | |
| conan --version | |
| mkdir -p ~/.conan2/profiles/ | |
| touch ~/.conan2/profiles/default # if we don't make a file first, cp thinks its a folder that doesn't exist | |
| cp conan-profiles/CI-CD/${{ env.CONAN_PROFILE_NAME }} ~/.conan2/profiles/default | |
| # LLVM Install (need version 21+ for flang) | |
| wget https://apt.llvm.org/llvm.sh | |
| python3 -c " | |
| content = open('llvm.sh').read() | |
| old = ' if test \$LLVM_VERSION -gt 14; then\n PKG=\"\$PKG libclang-rt-\$LLVM_VERSION-dev libpolly-\$LLVM_VERSION-dev\"\n fi\nfi' | |
| new = ' if test \$LLVM_VERSION -gt 14; then\n PKG=\"\$PKG libclang-rt-\$LLVM_VERSION-dev libpolly-\$LLVM_VERSION-dev\"\n fi\n if test \$LLVM_VERSION -ge 16; then\n PKG=\"\$PKG flang-\$LLVM_VERSION\"\n fi\nfi' | |
| open('llvm.sh', 'w').write(content.replace(old, new, 1))" | |
| chmod +x llvm.sh | |
| sudo ./llvm.sh 21 all | |
| export PATH="/usr/lib/llvm-21/bin:$PATH" | |
| echo "/usr/lib/llvm-21/bin" >> $GITHUB_PATH | |
| - name: Install Dependencies through Conan on Linux | |
| shell: bash | |
| run: | | |
| sudo apt --purge remove gcc | |
| sudo ln -s /usr/bin/clang /usr/bin/cc | |
| sudo apt install mold libc++-dev libc++abi-dev | |
| sudo rm /usr/bin/ld | |
| sudo ln -s $(which mold) /usr/bin/ld | |
| conan install . --output-folder build --build=missing | |
| - name: Build Linux | |
| run: | | |
| echo "working dir is $PWD" | |
| cd build | |
| source conanbuild.sh | |
| cmake -B . -S .. -G "Ninja" \ | |
| -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DLIBZIPPP_CMAKE_CONFIG_MODE=ON \ | |
| -DOPTION_TARGET_PYTHON_BINDING=OFF \ | |
| -DOPTION_TARGET_MESSAGING=OFF \ | |
| -DOPTION_TARGET_SMOLDYN_SOLVER=ON \ | |
| -DOPTION_TARGET_FV_SOLVER=ON \ | |
| -DOPTION_TARGET_DOCS=ON \ | |
| -DOPTION_TARGET_TESTS=ON | |
| cmake --build . --config Release | |
| - name: Test Linux | |
| run: | | |
| platform=linux | |
| echo "working dir is $PWD" | |
| cd build | |
| ctest -VV | |
| echo "------ running FiniteVolume_x64 ------" | |
| ./bin/FiniteVolume_x64 || true | |
| echo | |
| echo "------ running smoldyn_x64 ------" | |
| ./bin/smoldyn_x64 || true | |
| - name: Handle shared object paths for Linux native build | |
| if: github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published') | |
| shell: bash | |
| run: | | |
| mkdir build/upload | |
| cd build/bin | |
| ls *_x64 | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep "=> /" | grep -v "build" | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true | |
| ls *.so | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep "=> /" | grep -v "build" | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true | |
| ls *.so | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep "=> /" | grep -v "build" | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true | |
| chmod u+w,+x * | |
| tar czvf ../upload/fvsolver_linux64.tgz --dereference . | |
| cd ../.. | |
| - name: Upload Linux Binaries <x86_64> | |
| if: matrix.platform == 'ubuntu-latest' && matrix.python.std_version == '3.12' && (github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published')) | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: fvsolver_linux64.tgz | |
| path: build/upload/fvsolver_linux64.tgz | |
| - name: Upload Linux Binaries <ARM64> | |
| if: matrix.platform == 'ubuntu-24.04-arm' && matrix.python.std_version == '3.12' && (github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published')) | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: fvsolver_linux_arm64.tgz | |
| path: build/upload/fvsolver_linux64.tgz | |
| - name: Modify Archive Name <x86_64> | |
| if: matrix.platform == 'ubuntu-latest' && matrix.python.std_version == '3.12' && github.event_name == 'release' && github.event.action == 'published' | |
| run: | | |
| mv build/upload/fvsolver_linux64.tgz build/upload/linux64.tgz | |
| - name: Modify Archive Name <ARM64> | |
| if: matrix.platform == 'ubuntu-24.04-arm' && matrix.python.std_version == '3.12' && github.event_name == 'release' && github.event.action == 'published' | |
| run: | | |
| mv build/upload/fvsolver_linux64.tgz build/upload/linux64arm.tgz | |
| - name: Attach Linux Binaries to Release <x86_64> | |
| uses: softprops/action-gh-release@v3 | |
| if: matrix.platform == 'ubuntu-latest' && matrix.python.std_version == '3.12' && github.event_name == 'release' && github.event.action == 'published' | |
| with: | |
| files: | | |
| build/upload/linux64.tgz | |
| - name: Attach Linux Binaries to Release <ARM64> | |
| uses: softprops/action-gh-release@v3 | |
| if: matrix.platform == 'ubuntu-24.04-arm' && matrix.python.std_version == '3.12' && github.event_name == 'release' && github.event.action == 'published' | |
| with: | |
| files: | | |
| build/upload/linux64arm.tgz | |
| - name: Login to GitHub Container Registry | |
| if: github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published') | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build Wheels with CIBuildWheel (via Docker) <x86_64> | |
| uses: pypa/cibuildwheel@v3.4.0 | |
| if: matrix.platform == 'ubuntu-latest' && (github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published')) | |
| env: | |
| CIBW_BUILD: "${{ matrix.python.cibw_version }}*" | |
| CIBW_SKIP: "*musllinux*" | |
| CIBW_ARCHS_LINUX: "native" | |
| CIBW_MANYLINUX_X86_64_IMAGE: 'ghcr.io/virtualcell/fvsolver_manylinux_2_28_x86_64:0.1.2' | |
| CIBW_REPAIR_WHEEL_COMMAND: 'LD_LIBRARY_PATH=/usr/local/lib/x86_64-unknown-linux-gnu:$LD_LIBRARY_PATH auditwheel repair --disable-isa-ext-check {wheel} -w {dest_dir}' | |
| CIBW_CONFIG_SETTINGS_LINUX: >- | |
| cmake.args=-DCMAKE_TOOLCHAIN_FILE=/project/build/conan_toolchain.cmake | |
| cmake.args=-DLIBZIPPP_CMAKE_CONFIG_MODE=ON | |
| cmake.args=-DOPTION_TARGET_PYTHON_BINDING=ON | |
| cmake.args=-DOPTION_TARGET_MESSAGING=OFF | |
| cmake.args=-DOPTION_TARGET_SMOLDYN_SOLVER=ON | |
| cmake.args=-DOPTION_TARGET_FV_SOLVER=ON | |
| cmake.args=-DOPTION_TARGET_DOCS=OFF | |
| cmake.args=-DOPTION_TARGET_TESTS=OFF | |
| CIBW_ENVIRONMENT_LINUX: CC="clang" CXX="clang++" FC="flang" | |
| CIBW_BEFORE_BUILD: | | |
| echo $PWD | |
| python3 -m pip install conan | |
| mkdir -p /root/.conan2/profiles/ | |
| cp conan-profiles/CI-CD/${{ env.CONAN_PROFILE_NAME }} /root/.conan2/profiles/default | |
| conan install . --output-folder /project/build --build=missing | |
| echo "source /project/build/conanbuild.sh" >> ~/.profile | |
| echo "source /project/build/conanbuild.sh" >> ~/.bashrc | |
| source /project/build/conanbuild.sh | |
| - name: Build Wheels with CIBuildWheel (via Docker) <ARM64> | |
| uses: pypa/cibuildwheel@v3.4.0 | |
| if: matrix.platform == 'ubuntu-24.04-arm' && (github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published')) | |
| env: | |
| CIBW_BUILD: "${{ matrix.python.cibw_version }}*" | |
| CIBW_SKIP: "*musllinux*" | |
| CIBW_ARCHS_LINUX: "native" | |
| CIBW_MANYLINUX_AARCH64_IMAGE: 'ghcr.io/virtualcell/fvsolver_manylinux_2_28_aarch64:0.1.2' | |
| CIBW_REPAIR_WHEEL_COMMAND: 'LD_LIBRARY_PATH=/usr/local/lib/aarch64-unknown-linux-gnu:$LD_LIBRARY_PATH auditwheel repair --disable-isa-ext-check {wheel} -w {dest_dir}' | |
| CIBW_CONFIG_SETTINGS_LINUX: >- | |
| cmake.args=-DCMAKE_TOOLCHAIN_FILE=/project/build/conan_toolchain.cmake | |
| cmake.args=-DLIBZIPPP_CMAKE_CONFIG_MODE=ON | |
| cmake.args=-DOPTION_TARGET_PYTHON_BINDING=ON | |
| cmake.args=-DOPTION_TARGET_MESSAGING=OFF | |
| cmake.args=-DOPTION_TARGET_SMOLDYN_SOLVER=ON | |
| cmake.args=-DOPTION_TARGET_FV_SOLVER=ON | |
| cmake.args=-DOPTION_TARGET_DOCS=OFF | |
| cmake.args=-DOPTION_TARGET_TESTS=OFF | |
| CIBW_ENVIRONMENT_LINUX: CC="clang" CXX="clang++" FC="flang" | |
| CIBW_BEFORE_BUILD: | | |
| echo $PWD | |
| python3 -m pip install conan | |
| mkdir -p /root/.conan2/profiles/ | |
| cp conan-profiles/CI-CD/${{ env.CONAN_PROFILE_NAME }} /root/.conan2/profiles/default | |
| conan install . --output-folder /project/build --build=missing | |
| echo "source /project/build/conanbuild.sh" >> ~/.profile | |
| echo "source /project/build/conanbuild.sh" >> ~/.bashrc | |
| source /project/build/conanbuild.sh | |
| - name: Upload Python Wheel | |
| if: github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: pyvcell-fv-${{ matrix.platform }}-${{ matrix.python.cibw_version }}-cibw-wheels | |
| path: ./wheelhouse/*.whl | |
| - name: Setup tmate session | |
| if: ${{ failure() }} | |
| uses: mxschmitt/action-tmate@v3 | |
| with: | |
| limit-access-to-actor: true | |
| UniversalMacBindings: | |
| needs: MacOS | |
| runs-on: macos-latest | |
| if: github.event_name == 'pull_request' || (github.event_name == 'release' && github.event.action == 'published') | |
| steps: | |
| - name: Go to workspace | |
| run: cd ${{ github.workspace }} | |
| - name: Download Intel MacOS binaries | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: fvsolver_macos_x86_64.tgz | |
| path: fvsolver_amd64_artifact | |
| - name: Unpack x86 into subfolder | |
| run: | | |
| mkdir MAC_X86_64 | |
| mv fvsolver_amd64_artifact/fvsolver_mac64.tgz . | |
| tar xzvf fvsolver_mac64.tgz -C MAC_X86_64 | |
| rm fvsolver_mac64.tgz | |
| - name: Download ARM MacOS binaries | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: fvsolver_macos_arm64.tgz | |
| path: fvsolver_aarch64_artifact | |
| - name: Unpack arm into subfolder | |
| run: | | |
| mkdir MAC_AARCH64 | |
| mv fvsolver_aarch64_artifact/fvsolver_mac64.tgz . | |
| tar xzvf fvsolver_mac64.tgz -C MAC_AARCH64 | |
| rm fvsolver_mac64.tgz | |
| - name: Combine halves, and tar | |
| shell: bash | |
| run: | | |
| mkdir universal | |
| # Get list of files in each folder | |
| files1=($(ls -1 "MAC_X86_64" 2>/dev/null)) | |
| files2=($(ls -1 "MAC_AARCH64" 2>/dev/null)) | |
| # Process files from folder1 | |
| for file in "${files1[@]}"; do | |
| if [ -f "MAC_AARCH64/$file" ]; then | |
| # File exists in both folders - use lipo | |
| echo "Creating universal binary: $file" | |
| lipo -create "MAC_X86_64/$file" "MAC_AARCH64/$file" -output "universal/$file" | |
| else | |
| # File only in folder1 - move it | |
| echo "Moving architecture-specific file: $file" | |
| cp "MAC_X86_64/$file" "universal/$file" | |
| fi | |
| done | |
| # Process files only in folder2 | |
| for file in "${files2[@]}"; do | |
| if [ ! -f "MAC_X86_64/$file" ]; then | |
| echo "Moving architecture-specific file: $file" | |
| cp "MAC_AARCH64/$file" "universal/$file" | |
| fi | |
| done | |
| # change dir and tar up | |
| cd universal | |
| tar czfv fvsolver_mac64.tgz --dereference . | |
| - name: Upload universal binaries | |
| uses: actions/upload-artifact@v7 | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| with: | |
| name: fvsolver_macos_universal.tgz | |
| path: ${{ github.workspace }}/universal/fvsolver_mac64.tgz | |
| - name: Attach MacOS Native Binaries to Release | |
| run: | | |
| mv ${{ github.workspace }}/universal/fvsolver_mac64.tgz ${{ github.workspace }}/universal/mac64.tgz | |
| - name: Attach MacOS Native Binaries to Release | |
| uses: softprops/action-gh-release@v3 | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| with: | |
| files: | | |
| ${{ github.workspace }}/universal/mac64.tgz | |
| - name: Setup tmate session | |
| if: ${{ failure() }} | |
| uses: mxschmitt/action-tmate@v3 | |
| with: | |
| limit-access-to-actor: true | |
| publish-to-pypi: | |
| name: Publish to PyPI | |
| needs: [WindowsOS, UniversalMacBindings, GNULinux] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| environment: pypi | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download all artifacts (wheels and executables) | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: dist_temp/ | |
| - name: Install Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| - name: Publish wheels to PyPI | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
| run: | | |
| pip install twine | |
| mkdir dist | |
| echo "current directory is $(pwd)" | |
| ls -al dist* | |
| echo "absolute paths of wheels:" | |
| find dist_temp -type f -name '*.whl' -exec sh -c 'echo "$(realpath {})"/' \; | |
| echo "moving wheels to dist directory" | |
| find dist_temp -type f -name '*.whl' -exec sh -c 'mv "$(realpath {})" dist/' \; | |
| twine upload --repository pypi dist/*.whl | |
| - name: Setup tmate session for PyPI upload failure | |
| uses: mxschmitt/action-tmate@v3 | |
| if: ${{ failure() }} | |
| with: | |
| limit-access-to-actor: true |