Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
Revisit macos (#2) (#16)
Browse files Browse the repository at this point in the history
* Revisit macos (#2)

chore: add macos arm build

---------

Co-authored-by: William Barnhart <[email protected]>

* Update pyproject.toml to build for cp3* instead of cp38*

* Update dist.yml

---------

Co-authored-by: William Barnhart <[email protected]>
Co-authored-by: William Barnhart <[email protected]>
  • Loading branch information
3 people authored Jul 18, 2023
1 parent f1ca9cb commit 9b81bed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ name: 'Build and test wheels for release'
on:
release:
types: [created]
pull_request:
push:
branches:
- 'master'
- 'force_ci/all/**' # For development, forcing all workflows to run.
- 'force_ci/debian/**' # For debugging and/or only forcing this workflow.

jobs:
build_wheels:
name: 'Build and test wheels'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
os: [ubuntu-latest, macos-11]

steps:
- uses: actions/checkout@v3
Expand All @@ -31,6 +35,10 @@ jobs:
python3 -m pip install cibuildwheel
- name: 'Build and test wheels'
env:
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
# GH actions is unable to do aarch64 builds at this time
# CIBW_ARCHS_LINUX: auto aarch64
run: |
python3 -m cibuildwheel --output-dir dist
Expand Down
17 changes: 7 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
[tool.cibuildwheel]
build-frontend = "build"
build = "cp3*"
skip = ["*-win32", "*-manylinux_i686", "*-musllinux_*"]
skip = ["*-macosx_universal*", "*-win32", "*-manylinux_i686", "*-musllinux_*"]
archs = ["auto64"]
test-requires = ['.[test] pytest']
test-command = ['pytest --pyargs rocksdb']
Expand All @@ -16,22 +16,19 @@ environment = {ROCKSDB_VER="v6.14.6", LIBROCKSDB_PATH="/opt/rocksdb-$ROCKSDB_VER

[tool.cibuildwheel.linux]
# Avoid re-building the C library in every iteration by testing for the build directory.
before-build = "yum install -y bzip2-devel lz4-devel snappy-devel zlib-devel python3-Cython && (test -d $LIBROCKSDB_PATH || ( git clone https://github.com/facebook/rocksdb --depth 1 --branch $ROCKSDB_VER $LIBROCKSDB_PATH && cd $LIBROCKSDB_PATH && CXXFLAGS='-flto -Os -s' PORTABLE=1 make shared_lib -j 4 )) && pushd $LIBROCKSDB_PATH && make install-shared && ldconfig && popd"
before-build = "yum install -y bzip2-devel lz4-devel snappy-devel zlib-devel python3-Cython && (test -d $LIBROCKSDB_PATH || ( git clone https://github.com/facebook/rocksdb --depth 1 --branch $ROCKSDB_VER $LIBROCKSDB_PATH && cd $LIBROCKSDB_PATH && CXXFLAGS='-flto -Os -s' PORTABLE=1 make shared_lib -j $(nproc) )) && pushd $LIBROCKSDB_PATH && make install-shared && ldconfig && popd"

[tool.cibuildwheel.macos]
environment = {ROCKSDB_VER="v6.14.6", LIBROCKSDB_PATH="/usr/local/opt/rocksdb-$ROCKSDB_VER", REPAIR_LIBRARY_PATH="$LIBROCKS_DB_PATH"}
environment = {ROCKSDB_VER="v6.29.5", LIBROCKSDB_PATH="/usr/local/opt/rocksdb-$ROCKSDB_VER", LIBRARY_PATH="/usr/local/lib/"}
before-build = [
"brew install bzip2 lz4 snappy zlib cython git",
'export LDFLAGS="-L/usr/local/opt/bzip2/lib"',
'export CPPFLAGS="-I/usr/local/opt/bzip2/include"',
"(test -d $LIBROCKSDB_PATH || ( git clone https://github.com/facebook/rocksdb --depth 1 --branch $ROCKSDB_VER $LIBROCKSDB_PATH && cd $LIBROCKSDB_PATH && CXXFLAGS='-flto -Os' PORTABLE=1 make shared_lib -j 4 )) && pushd $LIBROCKSDB_PATH && make install-shared && update_dyld_shared_cache && popd",
"otool -L librocksdb.6.14.dylib",
'alias nproc="sysctl -n hw.logicalcpu"',
"(test -d $LIBROCKSDB_PATH || ( git clone https://github.com/facebook/rocksdb --depth 1 --branch $ROCKSDB_VER $LIBROCKSDB_PATH && cd $LIBROCKSDB_PATH && CXXFLAGS='-flto -Os' PORTABLE=1 make shared_lib -j $(nproc) )) && pushd $LIBROCKSDB_PATH && make install-shared && update_dyld_shared_cache && popd",
]
repair-wheel-command = """\
DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-listdeps {wheel} &&
DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-wheel \
--require-archs {delocate_archs} -w {dest_dir} -v {wheel}\
"""
repair-wheel-command='DYLD_LIBRARY_PATH=$LIBROCKSDB_PATH delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}'
test-command = ['DYLD_LIBRARY_PATH=$LIBROCKSDB_PATH pytest --pyargs rocksdb']

[tool.cibuildwheel.windows]
before-build = [
Expand Down

0 comments on commit 9b81bed

Please sign in to comment.