Skip to content

Commit

Permalink
Refactor python wheel building (#481)
Browse files Browse the repository at this point in the history
* ci: refactor python wheel building

* ci(python): limit windows interpreters, libssl-dev on linux

* fix(ci,python): update before install libssl-dev

* fix(ci): yes linux i do want to install when i say "install" smh

* ci(fix): install pkg-config

* ci: try configuring cross? this isn't very much fun 😢

* fix(ci): vendor openssl?

* ci: try another way

* fix(python): need to use openssl

* ci: building on linux is hard

* fix(ci): remove ones that break

* fix: use exclude

* fix(ci): cli is in the crates folder meow

* fix(ci): install build essential for glibc

* fix(ci): only do pypy

* fix(cli): bundle openssl

* fix(ci): just exclude manylinux x86_64
  • Loading branch information
gadomski authored Oct 21, 2024
1 parent 69edab2 commit 7e35ac4
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 257 deletions.
140 changes: 11 additions & 129 deletions .github/workflows/python-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,129 +14,10 @@ concurrency:
cancel-in-progress: true

jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
# - runner: ubuntu-latest
# target: x86
# - runner: ubuntu-latest
# target: aarch64
# - runner: ubuntu-latest
# target: armv7
# - runner: ubuntu-latest
# target: s390x
# - runner: ubuntu-latest
# target: ppc64le
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --manifest-path cli/Cargo.toml
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist

# musllinux:
# runs-on: ${{ matrix.platform.runner }}
# strategy:
# matrix:
# platform:
# - runner: ubuntu-latest
# target: x86_64
# - runner: ubuntu-latest
# target: x86
# - runner: ubuntu-latest
# target: aarch64
# - runner: ubuntu-latest
# target: armv7
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: 3.x
# - name: Build wheels
# uses: PyO3/maturin-action@v1
# with:
# target: ${{ matrix.platform.target }}
# args: --release --out dist --find-interpreter --manifest-path cli/Cargo.toml -F openssl-vendored
# sccache: 'true'
# manylinux: musllinux_1_2
# - name: Upload wheels
# uses: actions/upload-artifact@v4
# with:
# name: wheels-musllinux-${{ matrix.platform.target }}
# path: dist

windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
steps:
- uses: actions/checkout@v4
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v5
with:
python-version: 3.x
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --manifest-path cli/Cargo.toml
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}
path: dist

macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-12
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --manifest-path cli/Cargo.toml
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist
build-wheels:
uses: ./.github/workflows/wheels.yml
with:
manifest-path: crates/cli/Cargo.toml

sdist:
runs-on: ubuntu-latest
Expand All @@ -148,21 +29,19 @@ jobs:
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist --manifest-path cli/Cargo.toml
args: --out dist --manifest-path crates/cli/Cargo.toml
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
name: pypi_files_sdist
path: dist

release:
name: Release
runs-on: ubuntu-latest
if: success() && startsWith(github.ref, 'refs/tags/')
needs:
- linux
# - musllinux
- windows
- macos
- build-wheels
- sdist
environment:
name: pypi
Expand All @@ -171,6 +50,9 @@ jobs:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: pypi_files_*
merge-multiple: true
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
with:
Expand Down
138 changes: 10 additions & 128 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,129 +14,10 @@ concurrency:
cancel-in-progress: true

jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
# - runner: ubuntu-latest
# target: x86
# - runner: ubuntu-latest
# target: aarch64
# - runner: ubuntu-latest
# target: armv7
# - runner: ubuntu-latest
# target: s390x
# - runner: ubuntu-latest
# target: ppc64le
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --manifest-path python/Cargo.toml
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist

# musllinux:
# runs-on: ${{ matrix.platform.runner }}
# strategy:
# matrix:
# platform:
# - runner: ubuntu-latest
# target: x86_64
# - runner: ubuntu-latest
# target: x86
# - runner: ubuntu-latest
# target: aarch64
# - runner: ubuntu-latest
# target: armv7
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: 3.x
# - name: Build wheels
# uses: PyO3/maturin-action@v1
# with:
# target: ${{ matrix.platform.target }}
# args: --release --out dist --find-interpreter --manifest-path python/Cargo.toml -F openssl-vendored
# sccache: 'true'
# manylinux: musllinux_1_2
# - name: Upload wheels
# uses: actions/upload-artifact@v4
# with:
# name: wheels-musllinux-${{ matrix.platform.target }}
# path: dist

windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
steps:
- uses: actions/checkout@v4
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v5
with:
python-version: 3.x
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --manifest-path python/Cargo.toml
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}
path: dist

macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-12
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --manifest-path python/Cargo.toml
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist
build-wheels:
uses: ./.github/workflows/wheels.yml
with:
manifest-path: python/Cargo.toml

sdist:
runs-on: ubuntu-latest
Expand All @@ -152,17 +33,15 @@ jobs:
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
name: pypi_files_sdist
path: dist

release:
name: Release
runs-on: ubuntu-latest
if: success() && startsWith(github.ref, 'refs/tags/')
needs:
- linux
# - musllinux
- windows
- macos
- build-wheels
- sdist
environment:
name: pypi
Expand All @@ -171,6 +50,9 @@ jobs:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: pypi_files_*
merge-multiple: true
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
with:
Expand Down
Loading

0 comments on commit 7e35ac4

Please sign in to comment.