make wheel workflow triggerable manually #7
This file contains hidden or 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: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| linux-wheels: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target: [x86_64, i686, aarch64] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| maturin-version: latest | |
| command: build | |
| manylinux: auto | |
| args: --release --sdist -i 3.7 3.8 3.9 3.10 3.11 3.12 3.13 | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-wheels-${{ matrix.target }} | |
| path: target/wheels/ | |
| osx-wheels: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: macos-13 | |
| python-version: 3.7 | |
| - os: macos-latest | |
| python-version: 3.8 | |
| - os: macos-latest | |
| python-version: 3.9 | |
| - os: macos-latest | |
| python-version: "3.10" | |
| - os: macos-latest | |
| python-version: "3.11" | |
| - os: macos-latest | |
| python-version: "3.12" | |
| - os: macos-latest | |
| python-version: "3.13" | |
| steps: | |
| - uses: actions/checkout@v1 | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: nightly | |
| default: true | |
| - uses: actions/setup-python@v2 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Build wheels for Python 3.7 | |
| if: matrix.python-version == '3.7' | |
| run: | | |
| rustup target add aarch64-apple-darwin | |
| python3 -m pip install maturin | |
| maturin build --release --target universal2-apple-darwin | |
| - name: Build wheels for other Python versions | |
| if: matrix.python-version != '3.7' | |
| run: | | |
| python3 -m pip install maturin | |
| maturin build --release | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: osx-${{ matrix.python-version }}-wheel | |
| path: target/wheels | |
| windows-wheels: | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v1 | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: nightly | |
| default: true | |
| - uses: actions/setup-python@v2 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Build wheels | |
| run: | | |
| python -m pip install maturin | |
| maturin build --release | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-${{ matrix.python-version }}-wheel | |
| path: target/wheels | |
| collect-wheels: | |
| needs: [osx-wheels, windows-wheels, linux-wheels] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: actions/download-artifact@v4 | |
| - name: Display structure of downloaded files | |
| run: ls -R | |
| - run: mkdir wheels | |
| - run: mv ./linux-wheels-x86_64/* wheels | |
| - run: mv ./linux-wheels-i686/* wheels | |
| - run: mv ./linux-wheels-aarch64/* wheels | |
| - run: mv ./osx-3.13-wheel/* wheels | |
| - run: mv ./osx-3.12-wheel/* wheels | |
| - run: mv ./osx-3.11-wheel/* wheels | |
| - run: mv ./osx-3.10-wheel/* wheels | |
| - run: mv ./osx-3.9-wheel/* wheels | |
| - run: mv ./osx-3.8-wheel/* wheels | |
| - run: mv ./osx-3.7-wheel/* wheels | |
| - run: mv ./windows-3.13-wheel/* wheels | |
| - run: mv ./windows-3.12-wheel/* wheels | |
| - run: mv ./windows-3.11-wheel/* wheels | |
| - run: mv ./windows-3.10-wheel/* wheels | |
| - run: mv ./windows-3.9-wheel/* wheels | |
| - run: mv ./windows-3.8-wheel/* wheels | |
| - run: mv ./windows-3.7-wheel/* wheels | |
| - name: Upload wheels as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: all-wheels | |
| path: wheels/ | |
| retention-days: 7 | |
| publish-pypi: | |
| needs: [collect-wheels] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: all-wheels | |
| path: wheels/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI }} | |
| packages_dir: wheels/ | |
| verify_metadata: false |