Update Rust crate pyo3 to 0.23.0 #436
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
name: Build | |
# Build on every branch push, tag push, and pull request change: | |
on: [push, pull_request] | |
jobs: | |
macos: | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ '3.8', '3.9', '3.10' ] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install numpy pandas scipy | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: aarch64-apple-darwin | |
profile: minimal | |
default: true | |
- name: Build wheels - x86_64 | |
uses: messense/maturin-action@v1 | |
with: | |
target: x86_64-apple-darwin | |
args: -i python --release --out dist | |
- name: Install built wheel - x86_64 | |
run: | | |
pip install spatialtis_core --no-index --find-links dist | |
- name: Build wheels - universal2 | |
uses: messense/maturin-action@v1 | |
with: | |
args: -i python --release --out dist --universal2 | |
- name: Install built wheel - universal2 | |
run: | | |
pip uninstall -y spatialtis_core | |
pip install spatialtis_core --no-index --find-links dist | |
- name: Test python API | |
run: | | |
pip install pytest | |
pytest tests/ | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
windows: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
python-version: [ '3.8', '3.9', '3.10' ] | |
platform: [ | |
{ python-architecture: "x64", target: "x86_64-pc-windows-msvc" }, | |
] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: ${{ matrix.platform.python-architecture }} | |
- name: Install dependencies | |
run: | | |
pip install numpy pandas scipy | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.platform.target }} | |
profile: minimal | |
default: true | |
- name: Build wheels | |
uses: messense/maturin-action@v1 | |
with: | |
target: ${{ matrix.platform.target }} | |
args: -i python --release --out dist | |
- name: Install built wheel | |
run: | | |
pip install spatialtis_core --no-index --find-links dist | |
- name: Test python API | |
run: | | |
pip install pytest | |
pytest tests/ | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
linux: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ '3.8', '3.9', '3.10' ] | |
target: | |
- x86_64-unknown-linux-gnu | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install numpy pandas scipy | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
default: true | |
- name: Build Wheels | |
uses: messense/maturin-action@v1 | |
with: | |
rust-toolchain: stable | |
target: ${{ matrix.target }} | |
manylinux: auto | |
args: -i python${{ matrix.python-version }} --release --out dist | |
- name: Install built wheel | |
run: | | |
pip install spatialtis_core --no-index --find-links dist | |
- name: Test python API | |
run: | | |
pip install pytest | |
pytest tests/ | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
release: | |
runs-on: ubuntu-latest | |
needs: [macos, windows, linux] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
- name: List dists | |
run: | | |
ls -R | |
- name: Github Release | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ./dist/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: PyPi publish | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
env: | |
TWINE_USERNAME: milk-zheng | |
TWINE_PASSWORD: ${{ secrets.pypi_password }} | |
run: | | |
pip install --upgrade wheel pip setuptools twine | |
twine upload --skip-existing * | |
- name: Test PyPi publish | |
if: "contains(toJSON(github.event.commits.*.message), '[test pypi]')" | |
env: | |
TWINE_USERNAME: milk-zheng | |
TWINE_PASSWORD: ${{ secrets.pypi_test_password }} | |
run: | | |
pip install --upgrade wheel pip setuptools twine | |
twine upload --skip-existing * --repository-url https://test.pypi.org/legacy/ |