Skip to content

feat(xlang): add decimal and align serializers for xlang #1633

feat(xlang): add decimal and align serializers for xlang

feat(xlang): add decimal and align serializers for xlang #1633

Workflow file for this run

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: Build Native PR Wheels
on:
pull_request:
paths: [ci/**, python/**, .github/workflows/**]
push:
branches: [main]
paths: [ci/**, python/**, .github/workflows/**]
jobs:
build-windows:
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.13']
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Set up Bazel
uses: bazel-contrib/setup-bazel@083175551ceeceebc757ebee2127fde78840ca77 # 0.18.0
with:
bazelisk-cache: true
bazelisk-version: '1.x'
- name: Build wheel
run: ./ci/deploy.sh build_pyfory
shell: bash
- name: Install and verify wheel
shell: bash
run: |
python -m pip install --upgrade pip
pip install dist/*.whl
python -c "import pyfory; print(pyfory.__version__)"
- name: Upload wheels as artifacts
uses: actions/upload-artifact@v4
with:
name: pyfory-wheels-native-windows-${{ matrix.python-version }}
path: dist/*.whl
build-macos-arm64:
runs-on: macos-15
strategy:
matrix:
python-version: ['3.13']
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Set up Bazel
uses: bazel-contrib/setup-bazel@083175551ceeceebc757ebee2127fde78840ca77 # 0.18.0
with:
bazelisk-cache: true
bazelisk-version: '1.x'
- name: Build wheel
run: ./ci/deploy.sh build_pyfory
shell: bash
env:
MACOSX_DEPLOYMENT_TARGET: "11.0"
PYFORY_WHEEL_PLAT: macosx_11_0_arm64
- name: Install and verify wheel
shell: bash
run: |
python -m pip install --upgrade pip
pip install dist/*.whl
python -c "import pyfory; print(pyfory.__version__)"
- name: Upload wheel artifact
uses: actions/upload-artifact@v4
with:
name: pyfory-macos-arm64-wheel-${{ matrix.python-version }}
path: dist/*.whl
build-macos-x86_64:
runs-on: macos-15-intel
strategy:
matrix:
python-version: ['3.13']
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Set up Bazel
uses: bazel-contrib/setup-bazel@083175551ceeceebc757ebee2127fde78840ca77 # 0.18.0
with:
bazelisk-cache: true
bazelisk-version: '1.x'
- name: Build wheel
run: ./ci/deploy.sh build_pyfory
shell: bash
env:
MACOSX_DEPLOYMENT_TARGET: "11.0"
PYFORY_WHEEL_PLAT: macosx_11_0_x86_64
- name: Install and verify wheel
shell: bash
run: |
python -m pip install --upgrade pip
pip install dist/*.whl
python -c "import pyfory; print(pyfory.__version__)"
- name: Upload wheel artifact
uses: actions/upload-artifact@v4
with:
name: pyfory-macos-x86_64-wheel-${{ matrix.python-version }}
path: dist/*.whl
merge-macos-universal2:
runs-on: macos-15
needs: [build-macos-arm64, build-macos-x86_64]
strategy:
matrix:
python-version: ['3.13']
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install wheel tooling
run: python -m pip install --upgrade pip wheel
- name: Download arch wheels
uses: actions/download-artifact@v5
with:
pattern: pyfory-macos-*-wheel-${{ matrix.python-version }}
path: artifacts
merge-multiple: true
- name: Build universal2 wheel
shell: bash
run: |
set -euo pipefail
mkdir -p unpacked dist
ARM_WHL=$(ls artifacts/*arm64*.whl | head -n1)
X86_WHL=$(ls artifacts/*x86_64*.whl | head -n1)
python -m wheel unpack "$ARM_WHL" -d unpacked/arm64
python -m wheel unpack "$X86_WHL" -d unpacked/x86_64
ARM_DIR=$(ls -d unpacked/arm64/pyfory-*)
X86_DIR=$(ls -d unpacked/x86_64/pyfory-*)
UNIVERSAL_DIR="unpacked/pyfory-universal2"
cp -R "$ARM_DIR" "$UNIVERSAL_DIR"
SO_FILES=$(cd "$ARM_DIR" && find pyfory -name '*.so' -type f | sort)
if [[ -z "$SO_FILES" ]]; then
echo "No shared libraries found in wheel payload"
exit 1
fi
for so in $SO_FILES; do
if [[ ! -f "$X86_DIR/$so" ]]; then
echo "Missing matching x86_64 library for $so"
exit 1
fi
lipo -create "$ARM_DIR/$so" "$X86_DIR/$so" -output "$UNIVERSAL_DIR/$so"
done
WHEEL_FILE=$(ls "$UNIVERSAL_DIR"/pyfory-*.dist-info/WHEEL)
sed -i '' -e 's/macosx_11_0_arm64/macosx_11_0_universal2/g' \
-e 's/macosx_11_0_x86_64/macosx_11_0_universal2/g' \
"$WHEEL_FILE"
python -m wheel pack "$UNIVERSAL_DIR" -d dist
- name: Verify universal2 binaries
shell: bash
run: |
set -euo pipefail
mkdir -p verify
for whl in dist/*.whl; do
python -m wheel unpack "$whl" -d verify
done
VERIFY_DIR=$(ls -d verify/pyfory-*)
WHEEL_FILE=$(ls "$VERIFY_DIR"/pyfory-*.dist-info/WHEEL)
grep -q "macosx_11_0_universal2" "$WHEEL_FILE"
SO_FILES=$(cd "$VERIFY_DIR" && find pyfory -name '*.so' -type f | sort)
if [[ -z "$SO_FILES" ]]; then
echo "No shared libraries found in packed universal2 wheel"
exit 1
fi
for so in $SO_FILES; do
ARCHS=$(lipo -archs "$VERIFY_DIR/$so")
echo "$so: $ARCHS"
if [[ "$ARCHS" != *arm64* || "$ARCHS" != *x86_64* ]]; then
echo "Missing expected architectures for $so"
exit 1
fi
done
- name: Upload universal2 wheel
uses: actions/upload-artifact@v4
with:
name: pyfory-wheels-native-macos-universal2-${{ matrix.python-version }}
path: dist/*.whl