Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(ci): Enable pyvelox macos #12543

Closed
Closed
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
81 changes: 49 additions & 32 deletions .github/workflows/build_pyvelox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ on:
# - cron: '15 0 * * *'
pull_request:
paths:
- 'velox/**'
- '!velox/docs/**'
- 'third_party/**'
- 'pyvelox/**'
- '.github/workflows/build_pyvelox.yml'

permissions:
Expand All @@ -52,15 +48,16 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [8-core-ubuntu]
os: [8-core-ubuntu, macos-13, macos-14]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ inputs.ref || github.ref }}
fetch-depth: 0
submodules: recursive
persist-credentials: false

- uses: actions/setup-python@v4
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: '3.10'

Expand Down Expand Up @@ -88,23 +85,40 @@ jobs:
# NEXT_VERSION=$(echo $VERSION | awk -F. -v OFS=. '{$NF++ ; print}')
echo "build_version=${VERSION}a${COMMITS_SINCE_TAG}" >> $GITHUB_OUTPUT

- run: mkdir -p ccache
- name: "Restore ccache"
if: false
uses: actions/cache/restore@v3
# CCache doesn't hit in cibuildwheel
if: startsWith(matrix.os, 'macos')
uses: apache/infrastructure-actions/stash/restore@3354c1565d4b0e335b78a76aedd82153a9e144d4
id: restore-cache
with:
path: "ccache"
key: ccache-wheels-${{ matrix.os }}-${{ github.sha }}
restore-keys: |
ccache-wheels-${{ matrix.os }}-
key: ccache-wheels-${{ matrix.os }}

- name: Install macOS dependencies
- name: "Restore macOS Dependencies"
if: startsWith(matrix.os, 'macos')
uses: apache/infrastructure-actions/stash/restore@3354c1565d4b0e335b78a76aedd82153a9e144d4
id: restore-deps
with:
path: "dependencies"
key: dependencies-pyvelox-${{ matrix.os }}-${{ hashFiles('scripts/setup-macos.sh') }}

- name: Install macOS dependencies
if: ${{ startsWith(matrix.os, 'macos') && steps.restore-deps.outputs.stash-hit != 'true' }}
env:
MACOSX_DEPLOYMENT_TARGET: "13.0"
run: |
export INSTALL_PREFIX="$GITHUB_WORKSPACE/dependencies"
echo "CMAKE_PREFIX_PATH=$INSTALL_PREFIX" >> $GITHUB_ENV
bash scripts/setup-macos.sh
echo "DYLD_LIBRARY_PATH=$INSTALL_PREFIX/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
bash scripts/setup-macos.sh

- name: "Save macOS Dependencies"
if: ${{ startsWith(matrix.os, 'macos') && steps.restore-deps.outputs.stash-hit != 'true' }}
uses: apache/infrastructure-actions/stash/save@3354c1565d4b0e335b78a76aedd82153a9e144d4
with:
path: "dependencies"
key: dependencies-pyvelox-${{ matrix.os }}-${{ hashFiles('scripts/setup-macos.sh') }}
retention-days: 90

- name: "Create sdist"
if: matrix.os == '8-core-ubuntu'
Expand All @@ -114,42 +128,44 @@ jobs:
python setup.py sdist --dist-dir wheelhouse

- name: Build wheels
uses: pypa/cibuildwheel@v2.23.0
uses: pypa/cibuildwheel@6cccd09a31908ffd175b012fb8bf4e1dbda3bc6c # v2
env:
# required for preadv/pwritev
MACOSX_DEPLOYMENT_TARGET: "11.0"
CIBW_ARCHS: "x86_64"
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.os == 'macos-14' && '14' || '13' }}
CIBW_ARCHS: "native"
# Only build for 3.12 for now
CIBW_BUILD: ${{ github.event_name == 'pull_request' && 'cp312-*' || 'cp312-*' }}
CIBW_SKIP: "*musllinux* cp36-*"
CIBW_MANYLINUX_X86_64_IMAGE: "ghcr.io/facebookincubator/velox-dev:pyvelox"
CIBW_ENVIRONMENT_PASS_LINUX: "CCACHE_DIR BUILD_VERSION CMAKE_PREFIX_PATH"
CIBW_ENVIRONMENT_PASS_LINUX: "BUILD_VERSION"
# Don't waste time writing out to cache
CIBW_ENVIRONMENT_LINUX: "CCACHE_DISABLE=true"
CIBW_TEST_EXTRAS: "tests"
CIBW_TEST_COMMAND: "cd {project}/pyvelox && python -m unittest -v"
CIBW_TEST_SKIP: "*"
# CCACHE_DIR: "${{ matrix.os != 'macos-11' && '/output' || github.workspace }}/ccache"
CCACHE_DIR: "${{ github.workspace }}/ccache"
BUILD_VERSION: "${{ inputs.version || steps.version.outputs.build_version }}"
with:
output-dir: wheelhouse

- name: "Save ccache"
if: false
uses: actions/cache/save@v3
id: cache
# CCache doesn't hit in cibuildwheel
if: startsWith(matrix.os, 'macos')
uses: apache/infrastructure-actions/stash/save@3354c1565d4b0e335b78a76aedd82153a9e144d4
with:
path: "ccache"
key: ccache-wheels-${{ matrix.os }}-${{ github.sha }}
key: ccache-wheels-${{ matrix.os }}

- name: "Rename wheel compatibility tag"
if: startsWith(matrix.os, 'macos')
if: false #startsWith(matrix.os, 'macos')
run: |
brew install rename
cd wheelhouse
rename 's/11_0/10_15/g' *.whl

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
with:
name: wheels
name: wheels-${{ matrix.os }}
retention-days: 5
path: |
./wheelhouse/*.whl
./wheelhouse/*.tar.gz
Expand All @@ -160,19 +176,20 @@ jobs:
needs: build_wheels
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
with:
name: wheels
pattern: wheels-*
merge-multiple: true
path: ./wheelhouse

- run: ls wheelhouse

- uses: actions/setup-python@v3
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: "3.10"

- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@v1.12.3
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: wheelhouse
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ def build_extension(self, ext):
extdir += os.path.sep

if "DEBUG" in os.environ:
cfg = "Debug" if os.environ["DEBUG"] == "1" else "Release"
cfg = "Debug" if os.environ["DEBUG"] == "1" else "MinSizeRel"
else:
cfg = "Debug" if self.debug else "Release"
cfg = "Debug" if self.debug else "MinSizeRel"

exec_path = sys.executable

Expand Down
Loading