Skip to content

Commit

Permalink
Build wheels which are compatible with multiple Python versions, use …
Browse files Browse the repository at this point in the history
…"abi3-py38" pyo3 feature
  • Loading branch information
deedy5 committed Apr 25, 2024
1 parent dfcdcb5 commit 8fb94b9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 47 deletions.
75 changes: 30 additions & 45 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,74 +19,59 @@ permissions:
contents: read

jobs:
linux_x86_64:
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --zig -i python${{ matrix.python-version }}
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}-python${{ matrix.python-version }}
path: dist
- name: pytest
shell: bash
run: |
set -e
pip install pyreqwest_impersonate --find-links dist --no-index --force-reinstall
pip install pytest
pytest
linux_aarch64:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: aarch64
python-version: ['3.10']
- runner: ubuntu-latest
target: armv7
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: '3.10'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --zig --find-interpreter
args: --release --out dist --zig
sccache: 'true'
manylinux: auto
env:
CFLAGS_aarch64_unknown_linux_gnu: "-D__ARM_ARCH=8"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}-python${{ matrix.python-version }}
name: wheels-linux-${{ matrix.platform.target }}
path: dist
- name: pytest
if: ${{ !startsWith(matrix.platform.target, 'aarch64') }}
if: ${{ startsWith(matrix.platform.target, 'x86_64') }}
shell: bash
run: |
set -e
pip install pyreqwest_impersonate --find-links dist --no-index --force-reinstall
pip install pyreqwest_impersonate --find-links dist --force-reinstall
pip install pytest
pytest
- name: pytest
if: ${{ !startsWith(matrix.platform.target, 'x86') && matrix.platform.target != 'ppc64' }}
uses: uraimo/[email protected]
with:
arch: ${{ matrix.platform.target }}
distro: ubuntu22.04
githubToken: ${{ github.token }}
install: |
apt-get update
apt-get install -y --no-install-recommends python3 python3-pip
pip3 install -U pip pytest
run: |
set -e
pip3 install pyreqwest_impersonate --find-links dist --force-reinstall
pytest
windows:
runs-on: ${{ matrix.platform.runner }}
Expand All @@ -107,19 +92,19 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
args: --release --out dist
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}-python${{ matrix.python-version }}
name: wheels-windows-${{ matrix.platform.target }}
path: dist
- name: pytest
if: ${{ !startsWith(matrix.platform.target, 'aarch64') }}
shell: bash
run: |
set -e
pip install pyreqwest_impersonate --find-links dist --no-index --force-reinstall
pip install pyreqwest_impersonate --find-links dist --force-reinstall
pip install pytest
pytest
Expand All @@ -141,19 +126,19 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
args: --release --out dist
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}-python${{ matrix.python-version }}
name: wheels-macos-${{ matrix.platform.target }}
path: dist
- name: pytest
if: ${{ !startsWith(matrix.platform.target, 'aarch64') }}
shell: bash
run: |
set -e
pip install pyreqwest_impersonate --find-links dist --no-index --force-reinstall
pip install pyreqwest_impersonate --find-links dist --force-reinstall
pip install pytest
pytest
Expand All @@ -176,7 +161,7 @@ jobs:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [linux_x86_64, linux_aarch64, windows, macos, sdist]
needs: [linux, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v4
- name: Publish to PyPI
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ name = "pyreqwest_impersonate"
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.21", features = ["extension-module", "auto-initialize"] }
pyo3 = { version = "0.21", features = ["extension-module", "abi3-py38"] }
reqwest-impersonate = { version = "0.11", default-features = false, features = [
"cookies",
"blocking",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Binding to the Rust `reqwest_impersonate` library.</br>


Provides precompiled wheels:
- [x] Linux: `amd64`, `aarch64`.
- [x] Linux: `amd64`, `aarch64`, `armv7`.
- [x] Windows: `amd64`.
- [x] MacOS: `amd64`, `aarch64`.

Expand Down

0 comments on commit 8fb94b9

Please sign in to comment.