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

Update Python workflow #14

Merged
merged 1 commit into from
Jan 14, 2024
Merged
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
284 changes: 77 additions & 207 deletions .github/workflows/Python.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
# This file is autogenerated by maturin v1.4.0
# To update, run
#
# maturin generate-ci -m python/Cargo.toml github
#
name: Python

on:
push:
branches:
- main
- master
tags:
- '*'
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
macos:
runs-on: macos-latest
linux:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
architecture: x64
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- name: Build wheels - x86_64
uses: messense/maturin-action@v1
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
target: x86_64-apple-darwin
args: --release --sdist --out dist -m python/Cargo.toml
- name: Install built wheel - x86_64
run: |
pip install fat-macho --no-index --find-links dist --force-reinstall
python -c "import fat_macho"
- name: Build wheels - universal2
uses: messense/maturin-action@v1
python-version: '3.10'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: universal2-apple-darwin
args: --release --out dist -m python/Cargo.toml
- name: Install built wheel - universal2
run: |
pip install fat-macho --no-index --find-links dist --force-reinstall
python -c "import fat_macho"
target: ${{ matrix.target }}
args: --release --out dist --manifest-path python/Cargo.toml
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
Expand All @@ -47,204 +46,75 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
platform: [
{ python-architecture: "x64", target: "x86_64-pc-windows-msvc" },
{ python-architecture: "x86", target: "i686-pc-windows-msvc" },
]
target: [x64, x86]
steps:
- 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
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
toolchain: stable
profile: minimal
default: true
python-version: '3.10'
architecture: ${{ matrix.target }}
- name: Build wheels
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -m python/Cargo.toml
- name: Install built wheel
run: |
pip install fat-macho --no-index --find-links dist --force-reinstall
python -c "import fat_macho"
target: ${{ matrix.target }}
args: --release --out dist --manifest-path python/Cargo.toml
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

linux:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- i686-unknown-linux-gnu
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
architecture: x64
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: auto
args: --release --out dist -m python/Cargo.toml
- name: Install built wheel
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: |
pip3 install fat-macho --no-index --find-links dist --force-reinstall
python3 -c "import fat_macho"
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist

linux-cross:
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- target: aarch64-unknown-linux-gnu
arch: aarch64
- target: armv7-unknown-linux-gnueabihf
arch: armv7
- target: s390x-unknown-linux-gnu
arch: s390x
- target: powerpc64le-unknown-linux-gnu
arch: ppc64le
- target: powerpc64-unknown-linux-gnu
arch: ppc64
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
manylinux: auto
args: --release --out dist -m python/Cargo.toml
- uses: uraimo/run-on-arch-action@v2.0.5
if: matrix.platform.arch != 'ppc64'
name: Install built wheel
with:
arch: ${{ matrix.platform.arch }}
distro: ubuntu20.04
githubToken: ${{ github.token }}
install: |
apt-get update
apt-get install -y --no-install-recommends python3 python3-pip
pip3 install -U pip
run: |
pip3 install fat-macho --no-index --find-links dist/ --force-reinstall
python3 -c "import fat_macho"
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist

musllinux:
runs-on: ubuntu-latest
macos:
runs-on: macos-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
- i686-unknown-linux-musl
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
architecture: x64
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: musllinux_1_2
args: --release --out dist -m python/Cargo.toml
- name: Install built wheel
if: matrix.target == 'x86_64-unknown-linux-musl'
uses: addnab/docker-run-action@v3
with:
image: alpine:latest
options: -v ${{ github.workspace }}:/io -w /io
run: |
apk add py3-pip
pip3 install -U pip
pip3 install fat-macho --no-index --find-links /io/dist/ --force-reinstall
python3 -c "import fat_macho"
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist

- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --manifest-path python/Cargo.toml
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

musllinux-cross:
sdist:
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- target: aarch64-unknown-linux-musl
arch: aarch64
- target: armv7-unknown-linux-musleabihf
arch: armv7
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
manylinux: musllinux_1_2
args: --release --out dist -m python/Cargo.toml
- uses: uraimo/run-on-arch-action@master
name: Install built wheel
with:
arch: ${{ matrix.platform.arch }}
distro: alpine_latest
githubToken: ${{ github.token }}
install: |
apk add py3-pip
pip3 install -U pip
run: |
pip3 install fat-macho --no-index --find-links dist/ --force-reinstall
python3 -c "import fat_macho"
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist
- uses: actions/checkout@v3
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist --manifest-path python/Cargo.toml
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [ macos, windows, linux, linux-cross, musllinux, musllinux-cross ]
needs: [linux, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: wheels
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Publish to PyPi
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip install --upgrade twine
twine upload --skip-existing *
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_PASSWORD }}
with:
command: upload
args: --non-interactive --skip-existing *
Loading