Skip to content

Commit

Permalink
Merge pull request PolusAI#199 from sameeul/apple_arm64_wheels
Browse files Browse the repository at this point in the history
Add apple arm64 wheel support
  • Loading branch information
sameeul authored Jan 31, 2024
2 parents 13a04cc + 761a6cc commit d9ed42c
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 1 deletion.
50 changes: 50 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,53 @@ jobs:
name: nyxus-wheels
path: dist/*.whl
retention-days: 1


build_wheels_apple_arm64:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
MACOSX_DEPLOYMENT_TARGET: "11.0"
strategy:
matrix:
os: [macos-13-xlarge]
cibw_archs: ["arm64"]
cibw_build: ["cp39-*", "cp310-*", "cp311-*"]

steps:
- uses: actions/checkout@v3
name: Check out

- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.11'

- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==2.16.2 delvewheel wheel
- name: Building wheels
run: |
python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_BUILD_VERBOSITY: 3
CIBW_ARCHS_MACOS: arm64
CIBW_BEFORE_ALL_MACOS: brew install llvm@16 &&
bash ci-utils/install_prereq_linux.sh --build_arrow yes &&
mkdir -p /tmp/nyxus_bld &&
cp -r local_install /tmp/nyxus_bld

CIBW_ENVIRONMENT_MACOS: REPAIR_LIBRARY_PATH="/tmp/nyxus_bld/local_install/lib:/tmp/nyxus_bld/local_install/lib64" ON_GITHUB="TRUE" PATH="/opt/homebrew/opt/llvm@16/bin:$PATH" COMPILER="/opt/homebrew/opt/llvm@16/bin/clang++" CFLAGS="-I /opt/homebrew/include -I/opt/homebrew/opt/llvm@16/include" CPPFLAGS="-I/opt/homebrew/opt/llvm@16/include" LDFLAGS="-L/opt/homebrew/opt/llvm@16/lib -L/opt/homebrew/opt/llvm@16/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm@16/lib/c++" CXX="/opt/homebrew/opt/llvm@16/bin/clang++" CC="/opt/homebrew/opt/llvm@16/bin/clang" NYXUS_DEP_DIR="/tmp/nyxus_bld/local_install"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-listdeps {wheel} && DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_TEST_REQUIRES: numpy pandas pyarrow pytest bfio
CIBW_TEST_COMMAND: pytest {project}/tests/python

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: nyxus-wheels-apple-arm64
path: dist/*.whl
retention-days: 1
50 changes: 50 additions & 0 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,56 @@ jobs:
- name: Install Dependencies
run: python -m pip install --upgrade twine requests

- name: Publish to PyPi
run: python -m twine upload dist/*.whl
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
TWINE_REPOSITORY: pypi


build_wheels_apple_arm64:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
MACOSX_DEPLOYMENT_TARGET: "11.0"
strategy:
matrix:
os: [macos-13-xlarge]
cibw_archs: ["arm64"]
cibw_build: ["cp39-*", "cp310-*", "cp311-*"]

steps:
- uses: actions/checkout@v3
name: Check out

- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.11'

- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==2.16.2 delvewheel wheel
- name: Building wheels
run: |
python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_BUILD_VERBOSITY: 3
CIBW_ARCHS_MACOS: arm64
CIBW_BEFORE_ALL_MACOS: brew install llvm@16 &&
bash ci-utils/install_prereq_linux.sh --build_arrow yes &&
mkdir -p /tmp/nyxus_bld &&
cp -r local_install /tmp/nyxus_bld

CIBW_ENVIRONMENT_MACOS: REPAIR_LIBRARY_PATH="/tmp/nyxus_bld/local_install/lib:/tmp/nyxus_bld/local_install/lib64" ON_GITHUB="TRUE" PATH="/opt/homebrew/opt/llvm@16/bin:$PATH" COMPILER="/opt/homebrew/opt/llvm@16/bin/clang++" CFLAGS="-I /opt/homebrew/include -I/opt/homebrew/opt/llvm@16/include" CPPFLAGS="-I/opt/homebrew/opt/llvm@16/include" LDFLAGS="-L/opt/homebrew/opt/llvm@16/lib -L/opt/homebrew/opt/llvm@16/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm@16/lib/c++" CXX="/opt/homebrew/opt/llvm@16/bin/clang++" CC="/opt/homebrew/opt/llvm@16/bin/clang" NYXUS_DEP_DIR="/tmp/nyxus_bld/local_install"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-listdeps {wheel} && DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_TEST_REQUIRES: numpy pandas pyarrow pytest bfio
CIBW_TEST_COMMAND: pytest {project}/tests/python

- name: Publish to PyPi
run: python -m twine upload dist/*.whl
env:
Expand Down
10 changes: 9 additions & 1 deletion ci-utils/install_prereq_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,15 @@ cd ../../
if [[ $BULD_DCMTK_DEP -eq 1 ]]; then
curl -L https://github.com/DCMTK/dcmtk/archive/refs/tags/DCMTK-3.6.7.zip -o DCMTK-3.6.7.zip
unzip DCMTK-3.6.7.zip
cd dcmtk-DCMTK-3.6.7
cd dcmtk-DCMTK-3.6.7/CMake
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' 's/TIFF_LIBRARY/TIFF_LIBRARIES/' 3rdparty.cmake
sed -i '' 's/JPEG_LIBRARY/JPEG_LIBRARIES/' 3rdparty.cmake
else
sed -i 's/TIFF_LIBRARY/TIFF_LIBRARIES/' 3rdparty.cmake
sed -i 's/JPEG_LIBRARY/JPEG_LIBRARIES/' 3rdparty.cmake
fi
cd ..
mkdir build_man
cd build_man
cmake -DCMAKE_INSTALL_PREFIX=../../"$LOCAL_INSTALL_DIR"/ -DCMAKE_PREFIX_PATH=../../"$LOCAL_INSTALL_DIR"/ -DDCMTK_WITH_ICONV=OFF -DBUILD_SHARED_LIBS=ON -DBUILD_APPS=OFF ..
Expand Down

0 comments on commit d9ed42c

Please sign in to comment.