diff --git a/.github/deploy_manylinux.sh b/.github/deploy_manylinux.sh deleted file mode 100644 index df70c052..00000000 --- a/.github/deploy_manylinux.sh +++ /dev/null @@ -1,6 +0,0 @@ -cd wonnx-py -rustup override set nightly-2022-01-01 -export RUSTFLAGS='-C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+popcnt' -maturin publish \ - --skip-existing \ - --username __token__ \ No newline at end of file diff --git a/.github/workflows/create-py-mac.yaml b/.github/workflows/create-py-mac.yaml deleted file mode 100644 index 0b355dc1..00000000 --- a/.github/workflows/create-py-mac.yaml +++ /dev/null @@ -1,47 +0,0 @@ -name: Create macos universal2 python release - -on: - push: - # Sequence of patterns matched against refs/tags - tags: - - "v*" # Push events to matching wonnx-py-v* - -env: - RUST_BACKTRACE: 1 - RUST_VERSION: 1.66 - -jobs: - build: - name: Create Release - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: ["macos-latest"] - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] - steps: - - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ env.RUST_VERSION }} - profile: minimal - override: true - - name: Setup universal2 targets for Rust - run: | - rustup target add aarch64-apple-darwin - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Prepare maturin publish - shell: bash - run: | - cd wonnx-py - - name: maturin publish - uses: messense/maturin-action@v1 - env: - MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }} - with: - maturin-version: 0.12.1 - command: publish - args: -m wonnx-py/Cargo.toml --no-sdist --universal2 -o wheels -i python -u __token__ diff --git a/.github/workflows/create-py-manylinux.yaml b/.github/workflows/create-py-manylinux.yaml deleted file mode 100644 index 7aa4890d..00000000 --- a/.github/workflows/create-py-manylinux.yaml +++ /dev/null @@ -1,27 +0,0 @@ -name: Create Python release manylinux - -on: - push: - # Sequence of patterns matched against refs/tags - tags: - - "v*" # Push events to matching wonnx-py-v* -jobs: - build_manylinux: - name: Create Release manylinux - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Publish wheel - uses: docker://konstin2/maturin:latest - env: - MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }} - with: - entrypoint: /bin/bash - args: .github/deploy_manylinux.sh diff --git a/.github/workflows/create-py-windows.yaml b/.github/workflows/create-py-windows.yaml deleted file mode 100644 index 444acd51..00000000 --- a/.github/workflows/create-py-windows.yaml +++ /dev/null @@ -1,48 +0,0 @@ -name: Create Python release windows macos - -on: - push: - # Sequence of patterns matched against refs/tags - tags: - - "v*" # Push events to matching wonnx-py-v* - -env: - RUST_BACKTRACE: 1 - RUST_VERSION: 1.66 - -jobs: - build: - name: Create Release - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: ["macos-latest", "windows-latest"] - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] - steps: - - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ env.RUST_VERSION }} - profile: minimal - override: true - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install maturin==0.12.1 - - name: Publish wheel - shell: bash - env: - MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }} - run: | - cd wonnx-py - maturin publish \ - --no-sdist \ - --skip-existing \ - -o wheels \ - -i python \ - --username __token__ \ diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 00000000..f1948a26 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,223 @@ +name: Python package + +on: + push: + pull_request: + +jobs: + macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + architecture: x64 + - uses: dtolnay/rust-toolchain@stable + - name: Build wheels - x86_64 + uses: PyO3/maturin-action@v1 + with: + target: x86_64 + args: --release --out dist --sdist -m wonnx-py/Cargo.toml + - name: Install built wheel - x86_64 + run: | + pip install wonnx --no-index --find-links dist --force-reinstall + python -c "import wonnx" + - name: Build wheels - universal2 + uses: PyO3/maturin-action@v1 + with: + args: --release --universal2 --out dist -m wonnx-py/Cargo.toml + - name: Install built wheel - universal2 + run: | + pip install wonnx --no-index --find-links dist --force-reinstall + python -c "import wonnx" + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + windows: + runs-on: windows-latest + strategy: + matrix: + target: [x64, x86] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + architecture: ${{ matrix.target }} + - uses: dtolnay/rust-toolchain@stable + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist -m wonnx-py/Cargo.toml + - name: Install built wheel + run: | + pip install wonnx --no-index --find-links dist --force-reinstall + python -c "import wonnx" + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + linux: + runs-on: ubuntu-latest + strategy: + matrix: + target: [x86_64, i686] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + architecture: x64 + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + manylinux: auto + args: --release --out dist -m wonnx-py/Cargo.toml + - name: Install built wheel + if: matrix.target == 'x86_64' + run: | + pip install wonnx --no-index --find-links dist --force-reinstall + python -c "import wonnx" + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + linux-cross: + runs-on: ubuntu-latest + strategy: + matrix: + target: [aarch64, armv7, s390x, ppc64le, ppc64] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + manylinux: auto + args: --release --out dist -m wonnx-py/Cargo.toml + - uses: uraimo/run-on-arch-action@v2.5.0 + if: matrix.target != 'ppc64' + name: Install built wheel + with: + arch: ${{ matrix.target }} + distro: ubuntu20.04 + githubToken: ${{ github.token }} + install: | + apt-get update + apt-get install -y --no-install-recommends python3 python3-pip + pip3 install -U pip + run: | + pip3 install wonnx --no-index --find-links dist/ --force-reinstall + python3 -c "import wonnx" + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + musllinux: + runs-on: ubuntu-latest + strategy: + matrix: + target: + - x86_64-unknown-linux-musl + - i686-unknown-linux-musl + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + architecture: x64 + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + manylinux: musllinux_1_2 + args: --release --out dist -m wonnx-py/Cargo.toml + - name: Install built wheel + if: matrix.target == 'x86_64-unknown-linux-musl' + uses: addnab/docker-run-action@v3 + with: + image: alpine:latest + options: -v ${{ github.workspace }}:/io -w /io + run: | + apk add py3-pip + pip3 install -U pip + pip3 install wonnx --no-index --find-links /io/dist/ --force-reinstall + python3 -c "import wonnx" + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + musllinux-cross: + runs-on: ubuntu-latest + strategy: + matrix: + platform: + - target: aarch64-unknown-linux-musl + arch: aarch64 + - target: armv7-unknown-linux-musleabihf + arch: armv7 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + manylinux: musllinux_1_2 + args: --release --out dist -m wonnx-py/Cargo.toml + - uses: uraimo/run-on-arch-action@v2.5.0 + name: Install built wheel + with: + arch: ${{ matrix.platform.arch }} + distro: alpine_latest + githubToken: ${{ github.token }} + install: | + apk add py3-pip + pip3 install -U pip + run: | + pip3 install wonnx --no-index --find-links dist/ --force-reinstall + python3 -c "import wonnx" + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + release: + name: Release + runs-on: ubuntu-latest + if: "startsWith(github.ref, 'refs/tags/')" + needs: [macos, windows, linux, linux-cross, musllinux, musllinux-cross] + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + - name: Publish to PyPI + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_PASS }} + run: | + pip install --upgrade twine + twine upload --skip-existing * diff --git a/wonnx-py/pyproject.toml b/wonnx-py/pyproject.toml index b8c2d3ec..f21a8b61 100644 --- a/wonnx-py/pyproject.toml +++ b/wonnx-py/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["maturin>=0.12,<0.13"] +requires = ["maturin>=0.14,<0.15"] build-backend = "maturin" [project] diff --git a/wonnx-py/requirements.txt b/wonnx-py/requirements.txt index c962f6c0..e77d4ff6 100644 --- a/wonnx-py/requirements.txt +++ b/wonnx-py/requirements.txt @@ -3,7 +3,7 @@ certifi==2021.10.8 charset-normalizer==2.0.12 idna==3.3 iniconfig==1.1.1 -maturin==0.12.16 +maturin==0.14.17 numpy==1.22.3 onnx==1.13.1 packaging==21.3