build linux wheels with manylinux_2_28 for wider glibc compat (#18)
* build linux wheels inside manylinux_2_28 for glibc 2.28 compat Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * add perl-IPC-Cmd for openssl build in manylinux Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
27
.github/workflows/release.yml
vendored
27
.github/workflows/release.yml
vendored
@@ -6,43 +6,48 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: build - ${{ matrix.runs-on }}
|
||||
name: build - ${{ matrix.platform }}
|
||||
runs-on: ${{ matrix.runs-on }}
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
runs-on: [ubuntu-latest, ubuntu-24.04-arm, macos-latest]
|
||||
include:
|
||||
- platform: linux-x86_64
|
||||
runs-on: ubuntu-latest
|
||||
- platform: linux-arm64
|
||||
runs-on: ubuntu-24.04-arm
|
||||
- platform: macos
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- uses: actions/setup-python@v6
|
||||
if: runner.os != 'Linux'
|
||||
with:
|
||||
python-version: "3.14"
|
||||
|
||||
- name: Install build dependencies
|
||||
run: ./setup.sh
|
||||
- name: Build wheels
|
||||
run: ./build_wheels.sh dist/
|
||||
|
||||
- name: build and release wheels
|
||||
- name: Upload releases
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
pip install build
|
||||
|
||||
for toml in */pyproject.toml; do
|
||||
[ -f "$toml" ] || continue
|
||||
pkg="$(dirname "$toml")"
|
||||
module="${pkg//-/_}"
|
||||
version=$(python3 -c "import tomllib; print(tomllib.load(open('$toml', 'rb'))['project']['version'])")
|
||||
tag="${pkg}/v${version}"
|
||||
|
||||
echo "========================================="
|
||||
echo "Building: $pkg v$version"
|
||||
echo "Uploading: $pkg v$version"
|
||||
echo "========================================="
|
||||
python -m build --wheel "$pkg"
|
||||
|
||||
whl=$(ls "$pkg"/dist/*.whl)
|
||||
echo "Uploading: $whl"
|
||||
whl=$(ls dist/${module}-${version}-*.whl 2>/dev/null) || continue
|
||||
echo "Wheel: $whl"
|
||||
if gh release view "$tag" --repo "$GITHUB_REPOSITORY" &>/dev/null; then
|
||||
gh release upload "$tag" "$whl" --repo "$GITHUB_REPOSITORY" --clobber
|
||||
else
|
||||
|
||||
12
.github/workflows/test.yml
vendored
12
.github/workflows/test.yml
vendored
@@ -22,16 +22,12 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6
|
||||
if: runner.os != 'Linux'
|
||||
with:
|
||||
python-version: "3.14"
|
||||
- name: Install build dependencies
|
||||
run: ./setup.sh
|
||||
- name: Build wheels
|
||||
run: |
|
||||
for pkg in */pyproject.toml; do
|
||||
pip wheel "./$(dirname "$pkg")" --no-deps --wheel-dir dist/
|
||||
done
|
||||
- name: Smoketest locally
|
||||
run: ./build_wheels.sh dist/
|
||||
- name: Smoketest
|
||||
run: bash smoketest.sh dist/
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -51,6 +47,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
- image: ubuntu:24.04
|
||||
runs-on: ubuntu-latest
|
||||
- image: ubuntu:20.04
|
||||
runs-on: ubuntu-latest
|
||||
- image: fedora:41
|
||||
runs-on: ubuntu-latest
|
||||
- image: archlinux:latest
|
||||
|
||||
33
build_wheels.sh
Executable file
33
build_wheels.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$DIR"
|
||||
|
||||
WHEEL_DIR="${1:-dist}"
|
||||
|
||||
# on Linux, build inside manylinux_2_28 container for glibc 2.28 compatibility.
|
||||
# for reference, Ubuntu 20.04 is glibc 2.31, so this gives us wide compatibility.
|
||||
if [ "$(uname)" = "Linux" ] && [ -z "${MANYLINUX:-}" ]; then
|
||||
ARCH="$(uname -m)"
|
||||
IMAGE="quay.io/pypa/manylinux_2_28_${ARCH}"
|
||||
exec docker run --rm \
|
||||
-e MANYLINUX=1 \
|
||||
-v "$DIR:/work" \
|
||||
-w /work \
|
||||
"$IMAGE" \
|
||||
bash build_wheels.sh "$WHEEL_DIR"
|
||||
fi
|
||||
|
||||
# Set up Python inside manylinux container
|
||||
if [ -n "${MANYLINUX:-}" ]; then
|
||||
export PATH="/opt/python/cp312-cp312/bin:$PATH"
|
||||
fi
|
||||
|
||||
./setup.sh
|
||||
pip install setuptools wheel
|
||||
|
||||
mkdir -p "$WHEEL_DIR"
|
||||
for pkg in */pyproject.toml; do
|
||||
pip wheel "./$(dirname "$pkg")" --no-deps --wheel-dir "$WHEEL_DIR"/
|
||||
done
|
||||
4
setup.sh
4
setup.sh
@@ -3,6 +3,8 @@ set -euo pipefail
|
||||
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
brew install nasm pkg-config
|
||||
else
|
||||
elif command -v dnf &>/dev/null; then
|
||||
dnf install -y nasm cmake gcc-c++ pkgconfig git perl-IPC-Cmd
|
||||
elif command -v apt-get &>/dev/null; then
|
||||
sudo apt-get update && sudo apt-get install -y nasm cmake g++ pkg-config
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user