Skip to content
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
82 changes: 82 additions & 0 deletions .github/workflows/build-containerized-wheels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# 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 Containerized Wheels

on:
push:
branches: [main]
tags: ["v*"]
paths:
- 'python/**'
- 'cpp/**'
- 'bazel/**'
- 'BUILD'
- 'WORKSPACE'
- '.github/workflows/build-wheels*.yaml'
pull_request:
paths:
- 'python/**'
- 'cpp/**'
- 'bazel/**'
- 'BUILD'
- 'WORKSPACE'
- '.github/workflows/build-wheels*.yaml'

permissions:
contents: read
actions: write

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
arch: x86_64
- os: ubuntu-24.04-arm
arch: aarch64
steps:
- uses: actions/checkout@v5

- name: Build wheels with cibuildwheel
uses: pypa/cibuildwheel@v3.1.3
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BUILD: ${{ github.ref_type == 'tag' && 'cp38-* cp39-* cp310-* cp311-* cp312-*' || 'cp38-* cp312-*' }}
CIBW_ENVIRONMENT: PATH=$HOME/.local/bin:$PATH
CIBW_BEFORE_ALL: |
mkdir -p $HOME/.local/bin
./ci/run_ci.sh install_bazel
with:
package-dir: python/
output-dir: wheelhouse/

- name: Install and verify wheel
run: |
python -m pip install --upgrade pip
pip install dist/*.whl
python -c "import pyfory; print(pyfory.__version__)"
working-directory: python

- name: Upload wheels
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v4
with:
name: pyfory-wheels-linux-${{ matrix.arch }}
path: wheelhouse/*.whl
81 changes: 81 additions & 0 deletions .github/workflows/build-native-wheels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# 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 Wheels

on:
push:
branches: [main]
tags: ["v*"]
paths:
- 'python/**'
- 'cpp/**'
- 'bazel/**'
- 'BUILD'
- 'WORKSPACE'
- '.github/workflows/build-wheels*.yaml'
pull_request:
paths:
- 'python/**'
- 'cpp/**'
- 'bazel/**'
- 'BUILD'
- 'WORKSPACE'
- '.github/workflows/build-wheels*.yaml'

permissions:
contents: read
actions: write

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest]
steps:
- uses: actions/checkout@v5

- name: Install Bazel
if: ${{ !contains(matrix.os, 'windows') }}
run: ./ci/run_ci.sh install_bazel

- name: Install Bazel for Windows
if: ${{ contains(matrix.os, 'windows') }}
run: ./ci/run_ci.sh install_bazel_windows
shell: bash

- name: Build wheels with cibuildwheel
uses: pypa/cibuildwheel@v3.1.3
env:
CIBW_BUILD: ${{ github.ref_type == 'tag' && 'cp38-* cp39-* cp310-* cp311-* cp312-*' || 'cp38-* cp312-*' }}
with:
package-dir: python/
output-dir: wheelhouse/

- name: Install and verify wheel
run: |
python -m pip install --upgrade pip
pip install dist/*.whl
python -c "import pyfory; print(pyfory.__version__)"

- name: Upload wheels
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v4
with:
name: pyfory-wheels-${{ matrix.os }}
path: wheelhouse/*.whl
47 changes: 0 additions & 47 deletions .github/workflows/build-wheels-for-pr.yaml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/build-wheels-for-release.yaml

This file was deleted.

94 changes: 0 additions & 94 deletions .github/workflows/build-wheels.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ name: Publish Python

on:
workflow_run:
workflows: ["build wheels for release"]
workflows: ["Build Native Wheels", "Build Containerized, Wheels"]
types: [completed]

permissions:
Expand Down
8 changes: 4 additions & 4 deletions ci/run_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ install_bazel() {
esac

BAZEL_VERSION=$(get_bazel_version)
BAZEL_DIR="/usr/local/bin"
BAZEL_DIR="$HOME/.local/bin"

# Construct platform-specific URL
BINARY_URL="https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-${OS}-${ARCH}"

echo "Downloading bazel from: $BINARY_URL"
sudo wget -q -O "$BAZEL_DIR/bazel" "$BINARY_URL" || { echo "Failed to download bazel"; exit 1; }
curl -fsSL -o "$BAZEL_DIR/bazel" "$BINARY_URL" || { echo "Failed to download bazel"; exit 1; }

sudo chmod +x "$BAZEL_DIR/bazel"
chmod +x "$BAZEL_DIR/bazel"

# Add to current shell's PATH
export PATH="$BAZEL_DIR:$PATH"
Expand All @@ -108,7 +108,7 @@ install_bazel() {
bazel version || { echo "Bazel installation verification failed"; exit 1; }

# Configure number of jobs based on memory
if [[ "$MACHINE" == linux ]]; then
if [[ "$OS" == linux ]]; then
MEM=$(grep MemTotal < /proc/meminfo | awk '{print $2}')
JOBS=$(( MEM / 1024 / 1024 / 3 ))
echo "build --jobs=$JOBS" >> ~/.bazelrc
Expand Down
Loading
Loading