1.1.5, support numpy/py more versions #24
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-wheels | |
on: | |
# Do this when a new release is published | |
push: | |
branches: [ main ] | |
pull_request: | |
release: | |
types: [ published ] | |
jobs: | |
# Build for manylinux, which allows it to be run on many different Linux platforms | |
test-linux: | |
strategy: | |
matrix: | |
py-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout rustfrc | |
uses: actions/checkout@v4 | |
# Set up the repository with the Docker container action, which will allow us to build and run a manylinux Docker | |
# container that will ensure compatibility. See the action repository for more info. | |
- uses: actions/setup-python@v5 | |
id: setup-py | |
with: | |
python-version: ${{ matrix.py-version }} | |
# We install poetry as a dependency manager to read the pyproject.toml of our package. | |
- name: Poetry | |
run: pipx install poetry==1.8.2 | |
- name: Maturin | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: maturin | |
# poetry update will install all dependencies for our package | |
- name: Poetry install | |
run: | | |
poetry env use '${{ steps.setup-py.outputs.python-path }}' | |
poetry install --sync --no-root | |
working-directory: ${{ github.workspace }} | |
- name: Test lower version | |
if: ${{ matrix.py-version == '3.8' }} | |
run: | | |
. $(poetry env info --path)/bin/activate | |
pip install numpy==1.18.0 --only-binary true | |
working-directory: ${{ github.workspace }} | |
- name: maturin develop | |
run: | | |
. $(poetry env info --path)/bin/activate | |
maturin develop | |
working-directory: ${{ github.workspace }} | |
- name: cargo test | |
run: cargo test | |
working-directory: ${{ github.workspace }} | |
- name: poetry pytest | |
run: poetry run pytest | |
working-directory: ${{ github.workspace }} | |
build-macos: | |
if: ${{ github.event_name == 'release' && github.event.action == 'published' }} | |
needs: [ test-linux ] | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
py-version: [ '3.9', '3.10', '3.11', '3.12' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.py-version }} | |
# The x86_64 Rust toolchain is installed on GitHub runners, but since we compile also for Apple Silicon, we also | |
# need the correct Rust toolchain. | |
- name: Rustup install aarch64 target | |
run: rustup target add aarch64-apple-darwin | |
if: ${{ matrix.target == '--universal2' }} | |
- name: Build wheels - universal2 | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: universal2-apple-darwin | |
args: --release --out dist -i ${{ matrix.py-version }} | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: ${{ github.workspace }}/dist | |
build-windows: | |
if: ${{ github.event_name == 'release' && github.event.action == 'published' }} | |
needs: [ test-linux ] | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
py-version: ['3.9', '3.10', '3.11', '3.12'] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.py-version }} | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: x64 | |
args: --release --out dist -i ${{ matrix.py-version }} | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: ${{ github.workspace }}/dist | |
build-linux: | |
if: ${{ github.event_name == 'release' && github.event.action == 'published' }} | |
needs: [ test-linux ] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
py-version: [ '3.9', '3.10', '3.11', '3.12' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.py-version }} | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
rust-toolchain: stable | |
target: x86_64 | |
manylinux: auto | |
args: --release --out dist -i ${{ matrix.py-version }} | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: ${{ github.workspace }}/dist | |
wheel-publish: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: [ build-macos, build-windows, build-linux ] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
- name: Publish to PyPI | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_RUSTFRC_TOKEN }} | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: upload | |
args: --skip-existing * |