forked from polkascan/py-sr25519-bindings
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
174 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,195 @@ | ||
name: Build and upload to PyPI | ||
name: Deploy to PyPI | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
release: | ||
types: | ||
- published | ||
types: [ created ] | ||
|
||
jobs: | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
macos: | ||
runs-on: macos-latest | ||
strategy: | ||
matrix: | ||
# macos-13 is an intel runner, macos-14 is apple silicon | ||
os: [ubuntu-latest, windows-latest, macos-13, macos-14] | ||
|
||
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
target: aarch64-apple-darwin | ||
profile: minimal | ||
default: true | ||
- name: Build | ||
run: cargo build --release | ||
- name: Build wheels - x86_64 | ||
uses: messense/maturin-action@v1 | ||
with: | ||
target: x86_64 | ||
rust-toolchain: nightly | ||
args: -i python --release --out dist --no-sdist | ||
- name: Install built wheel - x86_64 | ||
run: | | ||
pip install py-sr25519-bindings --no-index --find-links dist --force-reinstall | ||
- name: Build wheels - universal2 | ||
if: ${{ matrix.python-version != '3.7' }} | ||
uses: messense/maturin-action@v1 | ||
with: | ||
args: -i python --release --universal2 --out dist --no-sdist | ||
rust-toolchain: nightly | ||
- name: Install built wheel - universal2 | ||
if: ${{ matrix.python-version != '3.7' }} | ||
run: | | ||
pip install py-sr25519-bindings --no-index --find-links dist --force-reinstall | ||
- name: Python UnitTest | ||
run: | | ||
pip install -r requirements.txt | ||
pip install pytest | ||
pytest tests.py | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wheels | ||
path: dist | ||
|
||
windows: | ||
runs-on: windows-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] | ||
target: [x64, x86] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
architecture: ${{ matrix.target }} | ||
- name: Update rustup | ||
run: rustup self update | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
profile: minimal | ||
default: true | ||
- name: Build | ||
if: matrix.target == 'x64' | ||
run: cargo build --release | ||
- name: Build wheels | ||
uses: pypa/cibuildwheel@v2.17.0 | ||
|
||
- uses: actions/upload-artifact@v4 | ||
uses: messense/maturin-action@v1 | ||
with: | ||
target: ${{ matrix.target }} | ||
args: -i python --release --out dist --no-sdist | ||
rust-toolchain: nightly | ||
- name: Install built wheel | ||
run: | | ||
pip install py-sr25519-bindings --no-index --find-links dist --force-reinstall | ||
- name: Python UnitTest | ||
run: | | ||
pip install -r requirements.txt | ||
pip install pytest | ||
pytest tests.py | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | ||
path: ./wheelhouse/*.whl | ||
name: wheels | ||
path: dist | ||
|
||
build_sdist: | ||
name: Build source distribution | ||
linux: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] | ||
target: [x86_64, i686] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build sdist | ||
run: pipx run build --sdist | ||
|
||
- uses: actions/upload-artifact@v4 | ||
- uses: actions/checkout@v2 | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
profile: minimal | ||
default: true | ||
- name: Build | ||
run: cargo build --release | ||
- uses: actions/setup-python@v2 | ||
with: | ||
name: cibw-sdist | ||
path: dist/*.tar.gz | ||
python-version: ${{ matrix.python-version }} | ||
- name: Build Wheels | ||
uses: messense/maturin-action@v1 | ||
with: | ||
target: ${{ matrix.target }} | ||
rust-toolchain: nightly | ||
manylinux: auto | ||
args: -i python${{ matrix.python-version }} --release --out dist --no-sdist | ||
- name: Python UnitTest | ||
if: matrix.target == 'x86_64' | ||
run: | | ||
pip install py-sr25519-bindings --no-index --find-links dist --force-reinstall | ||
pip install -r requirements.txt | ||
pip install pytest | ||
pytest tests.py | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wheels | ||
path: dist | ||
|
||
upload_pypi: | ||
needs: [build_wheels, build_sdist] | ||
muslwheels_x86: | ||
name: Build musllinux wheels for x86 | ||
runs-on: ubuntu-latest | ||
environment: pypi | ||
permissions: | ||
id-token: write | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this) | ||
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
|
||
env: | ||
CIBW_BUILD_VERBOSITY: 1 | ||
CIBW_BEFORE_ALL_LINUX: "curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y" | ||
CIBW_ARCHS_LINUX: "auto64" | ||
CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"' | ||
CIBW_BUILD: "*-musllinux_x86_64" | ||
CIBW_SKIP: "cp27-* cp34-* cp35-* " | ||
|
||
steps: | ||
- uses: actions/download-artifact@v4 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Build wheels | ||
uses: pypa/cibuildwheel@v2.11.2 | ||
with: | ||
# unpacks all CIBW artifacts into dist/ | ||
pattern: cibw-* | ||
path: dist | ||
merge-multiple: true | ||
output-dir: dist | ||
|
||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
# To test: repository-url: https://test.pypi.org/legacy/ | ||
name: wheels | ||
path: dist | ||
|
||
# aarch64_wheels: | ||
# name: Build wheels for aarch64 linux | ||
# runs-on: ubuntu-latest | ||
# | ||
# env: | ||
# CIBW_BUILD_VERBOSITY: 1 | ||
# CIBW_BEFORE_ALL_LINUX: "curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y" | ||
# CIBW_ARCHS_LINUX: "aarch64" | ||
# CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"' | ||
# CIBW_BUILD: "*-musllinux_aarch64 *-manylinux_aarch64" | ||
# CIBW_SKIP: "cp27-* cp34-* cp35-* " | ||
# | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# | ||
# - name: Set up QEMU | ||
# uses: docker/setup-qemu-action@v2 | ||
# with: | ||
# platforms: arm64 | ||
# | ||
# - name: Build wheels | ||
# uses: pypa/cibuildwheel@v2.11.2 | ||
# with: | ||
# output-dir: dist | ||
# | ||
# | ||
# - uses: actions/upload-artifact@v3 | ||
# with: | ||
# name: wheels | ||
# path: dist | ||
|