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

Improve platform support #12

Merged
merged 2 commits into from
Jun 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
90 changes: 75 additions & 15 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,81 @@ on:
workflow_dispatch:

jobs:
pypi:
build-wheels:
name: Build wheels for PyPI
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ "3.8", "3.9", "3.10" ]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

# install pip prerequisites
- name: Install cffi and virtualenv
run: pip install cffi virtualenv

# install rust toolchoin
- uses: actions-rs/toolchain@v1
id: rustup
with:
profile: minimal
toolchain: stable
override: true

# setup macOS as in the maturin tests, see:
# https://github.com/PyO3/maturin/blob/main/.github/workflows/test.yml
- name: Install aarch64-apple-darwin Rust target
if: matrix.os == 'macos-latest'
run: rustup target add aarch64-apple-darwin
- name: Setup Xcode env
if: matrix.os == 'macos-latest'
shell: bash
run: |
sudo xcode-select -s /Applications/Xcode.app
bindir="$(xcode-select --print-path)/Toolchains/XcodeDefault.xctoolchain/usr/bin"
echo "CC=${bindir}/clang" >> "${GITHUB_ENV}"
echo "CXX=${bindir}/clang++" >> "${GITHUB_ENV}"
echo "SDKROOT=$(xcrun --sdk macosx --show-sdk-path)" >> "${GITHUB_ENV}"

# setup linux
- name: Install musl tools
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y musl-tools

# build and publish
- name: Install Python dependencies
run: pip install maturin
- name: Build wheels
run: maturin build --release --strip
- uses: actions/upload-artifact@v3
with:
name: wheels
path: target/wheels/
if-no-files-found: error

upload-wheels:
name: Upload wheels to PyPI
needs: build-wheels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install Python dependencies
run: pip install maturin
- name: Build wheels
run: make wheels
- name: publish
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages_dir: target/wheels/
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/download-artifact@v3
with:
name: wheels
path: wheels/
- name: list contents
run: ls -R
working-directory: wheels/
- name: publish
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages_dir: wheels/