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

Upgrade pyo3 to 0.13.2 and build abi3 wheels #5

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
193 changes: 170 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,49 +77,196 @@ jobs:
command: test
args: --release test_f_compress_eip_152_vec_8 -- --ignored --nocapture

build:
runs-on: ${{ matrix.os }}
macos-wheels:
runs-on: macos-latest
needs:
- test
- bench
- test_rust_eip_152_vec_8
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: aarch64-apple-darwin
profile: minimal
default: true
- name: Install maturin
run: pip install maturin
- name: Build wheels - x86_64
run: |
maturin build --target x86_64-apple-darwin --release --out dist
pip install blake2b-py --no-index --find-links dist --force-reinstall
- name: Build wheels - universal2
env:
DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer
MACOSX_DEPLOYMENT_TARGET: '10.9'
PYO3_CROSS_LIB_DIR: /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib
run: |
# Build wheels
maturin build --release --universal2 --out dist
pip install blake2b-py --no-index --find-links dist --force-reinstall
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist

windows-wheels:
runs-on: windows-latest
needs:
- test
- bench
- test_rust_eip_152_vec_8
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9, '3.10', '3.11']
os: [ubuntu-latest, macos-latest, windows-latest]
platform: [
{ python-architecture: "x64", target: "x86_64-pc-windows-msvc" },
{ python-architecture: "x86", target: "i686-pc-windows-msvc" },
]
steps:
- name: checkout
uses: actions/checkout@v3

- name: install rust toolchain
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
architecture: ${{ matrix.platform.python-architecture }}
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: ${{ matrix.platform.target }}
profile: minimal
default: true

- name: set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- name: Install maturin
run: pip install maturin
- name: Build wheels
run: |
maturin build --release --out dist --target ${{ matrix.platform.target }}
pip install blake2b-py --no-index --find-links dist --force-reinstall
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
python-version: ${{ matrix.python-version }}
name: wheels
path: dist

- name: install Python requirements
run: pip install maturin
linux-wheels:
runs-on: ubuntu-latest
needs:
- test
- bench
- test_rust_eip_152_vec_8
strategy:
matrix:
platform: [
{ manylinux: '2010', target: "x86_64-unknown-linux-gnu", arch: "x86_64" },
{ manylinux: '2010', target: "i686-unknown-linux-gnu", arch: "i686" },
]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Build Wheels
run: |
echo 'curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
source ~/.cargo/env
export PATH=/opt/python/cp38-cp38/bin:$PATH
pip install maturin
maturin build --release --out dist --target ${{ matrix.platform.target }} --manylinux ${{ matrix.platform.manylinux }}
' > build-wheel.sh
chmod +x build-wheel.sh

docker run --rm -v "$PWD":/io -w /io quay.io/pypa/manylinux${{ matrix.platform.manylinux }}_${{ matrix.platform.arch }} bash build-wheel.sh
- name: Install built wheel
if: matrix.platform.arch == 'x86_64'
run: |
pip install blake2b-py --no-index --find-links dist --force-reinstall
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist

linux-cross-wheels:
runs-on: ubuntu-latest
needs:
- test
- bench
- test_rust_eip_152_vec_8
strategy:
matrix:
platform: [
{ manylinux: "2014", target: "aarch64-unknown-linux-gnu", arch: "aarch64" },
{ manylinux: "2014", target: "armv7-unknown-linux-gnueabihf", arch: "armv7" },
]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Build Wheels
run: |
echo 'curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
source ~/.cargo/env
rustup target add ${{ matrix.platform.target }}
maturin build --release --out dist --target ${{ matrix.platform.target }} --manylinux ${{ matrix.platform.manylinux }}
' > build-wheel.sh
chmod +x build-wheel.sh

- name: build Python package
run: maturin build --release --strip --interpreter python
docker run --rm -v "$PWD":/io -w /io messense/manylinux2014-cross:${{ matrix.platform.arch }} bash build-wheel.sh
- uses: uraimo/[email protected]
name: Install built wheel
with:
arch: ${{ matrix.platform.arch }}
distro: ubuntu18.04
githubToken: ${{ github.token }}
# Mount the dist directory as /artifacts in the container
dockerRunArgs: |
--volume "${PWD}/dist:/artifacts"
install: |
apt-get update
apt-get install -y --no-install-recommends python3 python3-pip
pip3 install -U pip
run: |
ls -lrth /artifacts
pip3 install blake2b-py --no-index --find-links /artifacts --force-reinstall
cd ~ && python3 -c "import blake2b"
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist

release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [ macos-wheels, windows-wheels, linux-wheels, linux-cross-wheels ]
steps:
- uses: actions/download-artifact@v2
with:
name: wheels
- uses: actions/setup-python@v2
with:
python-version: 3.9
# We run this job until here for every build so that we notice early if there's anything
# that would prevent to publish a release. But the actual publishing only happens when we
# create an actual Github release.
- name: Release
- name: GitHub Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: target/wheels/blake2b_py*.whl
files: blake2b_py*.whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: PyPi publish
if: startsWith(github.ref, 'refs/tags/')
- name: Publish to PyPI
env:
MATURIN_PASSWORD: ${{ secrets.PYPI }}
run: maturin publish --no-sdist --username __token__ --interpreter python
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip install twine
twine upload --skip-existing *
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
Cargo.lock
.tox
venv*
*.so
.hypothesis
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repository = "https://github.com/davesque/blake2b-py"
description = "Blake2b hashing in Rust with Python bindings."

[dependencies]
pyo3 = { version = "~0.15", features = ["extension-module"] }
pyo3 = { version = "~0.15", features = ["extension-module", "abi3-py36"] }

[dev-dependencies]
hex = "~0.4"
Expand Down