diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..1d6823e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,181 @@ +name: Build wheels + +on: + push: + branches: + - master + +jobs: + macos: + runs-on: macos-latest + strategy: + matrix: + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2024-02-04 + target: aarch64-apple-darwin + profile: minimal + default: true + - name: Build wheels - universal2 + if: ${{ matrix.python-version != '3.7' }} + uses: messense/maturin-action@v1 + with: + args: -i python --release --universal2 --out dist + rust-toolchain: nightly-2024-02-04 + - name: Install built wheel - universal2 + if: ${{ matrix.python-version != '3.7' }} + run: | + pip install py-sr25519-bindings --no-index --find-links dist --force-reinstall + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: dist-wheels-mac-${{ matrix.python-version }} + path: dist/*.whl + windows: + runs-on: windows-latest + strategy: + matrix: + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] + target: [x64, x86] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.target }} + - name: Update rustup + run: rustup self update + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2024-02-04 + profile: minimal + default: true + - name: Build + if: matrix.target == 'x64' + run: cargo build --release + - name: Build wheels + uses: messense/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: -i python --release --out dist + rust-toolchain: nightly-2024-02-04 + - name: Install built wheel + run: | + pip install py-sr25519-bindings --no-index --find-links dist --force-reinstall + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: dist-wheels-win-${{ matrix.target }}-${{ matrix.python-version }} + path: dist/*.whl + + linux: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] + target: [x86_64, i686] + steps: + - uses: actions/checkout@v4 + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2024-02-04 + profile: minimal + default: true + - name: Build + run: cargo build --release + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Build Wheels + uses: messense/maturin-action@v1 + with: + target: ${{ matrix.target }} + rust-toolchain: nightly-2024-02-04 + manylinux: auto + args: -i python${{ matrix.python-version }} --release --out dist + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: dist-wheels-linux-${{ matrix.target }}-${{ matrix.python-version }} + path: dist/*.whl + + muslwheels_x86: + name: Build musllinux wheels for x86 + runs-on: ubuntu-latest + + env: + CIBW_BUILD_VERBOSITY: 1 + CIBW_BEFORE_ALL_LINUX: "curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2024-02-04 -y" + CIBW_ARCHS_LINUX: "auto64" + CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"' + CIBW_BUILD: "*-musllinux_x86_64" + CIBW_SKIP: "cp27-* cp34-* cp35-* cp36-*" + + steps: + - uses: actions/checkout@v4 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.9.0 + with: + output-dir: dist + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: dist-wheels-musl + path: dist/*.whl + + aarch64_wheels: + name: Build wheels for aarch64 linux + runs-on: ubuntu-latest + + env: + CIBW_BUILD_VERBOSITY: 1 + CIBW_BEFORE_ALL_LINUX: "curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2024-02-04 -y" + CIBW_ARCHS_LINUX: "aarch64" + CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"' + CIBW_BUILD: "*-musllinux_aarch64 *-manylinux_aarch64" + CIBW_SKIP: "cp27-* cp34-* cp35-* cp36-*" + + steps: + - uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.9.0 + with: + output-dir: dist + + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: dist-wheels-aarch64 + path: dist/*.whl + + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Build sdist + run: pipx run build --sdist + + - uses: actions/upload-artifact@v4 + with: + name: dist-src + path: dist/*.tar.gz diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 232a0a9..5b3c4b7 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -9,60 +9,43 @@ jobs: runs-on: macos-latest strategy: matrix: - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: - toolchain: nightly + toolchain: nightly-2024-02-04 target: aarch64-apple-darwin profile: minimal default: true - - name: Build - run: cargo build --release - - name: Build wheels - x86_64 - uses: messense/maturin-action@v1 - with: - target: x86_64 - rust-toolchain: nightly - args: -i python --release --out dist --no-sdist - - name: Install built wheel - x86_64 - run: | - pip install py-sr25519-bindings --no-index --find-links dist --force-reinstall - name: Build wheels - universal2 if: ${{ matrix.python-version != '3.7' }} uses: messense/maturin-action@v1 with: - args: -i python --release --universal2 --out dist --no-sdist - rust-toolchain: nightly + args: -i python --release --universal2 --out dist + rust-toolchain: nightly-2024-02-04 - name: Install built wheel - universal2 if: ${{ matrix.python-version != '3.7' }} run: | pip install py-sr25519-bindings --no-index --find-links dist --force-reinstall - - name: Python UnitTest - run: | - pip install -r requirements.txt - pip install pytest - pytest tests.py - name: Upload wheels - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: wheels - path: dist - + name: dist-wheels-mac-${{ matrix.python-version }} + path: dist/*.whl windows: runs-on: windows-latest strategy: matrix: - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] target: [x64, x86] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.target }} @@ -71,7 +54,7 @@ jobs: - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: - toolchain: nightly + toolchain: nightly-2024-02-04 profile: minimal default: true - name: Build @@ -81,60 +64,48 @@ jobs: uses: messense/maturin-action@v1 with: target: ${{ matrix.target }} - args: -i python --release --out dist --no-sdist - rust-toolchain: nightly + args: -i python --release --out dist + rust-toolchain: nightly-2024-02-04 - name: Install built wheel run: | pip install py-sr25519-bindings --no-index --find-links dist --force-reinstall - - name: Python UnitTest - run: | - pip install -r requirements.txt - pip install pytest - pytest tests.py - name: Upload wheels - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: wheels - path: dist + name: dist-wheels-win-${{ matrix.target }}-${{ matrix.python-version }} + path: dist/*.whl linux: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] target: [x86_64, i686] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: - toolchain: nightly + toolchain: nightly-2024-02-04 profile: minimal default: true - name: Build run: cargo build --release - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Build Wheels uses: messense/maturin-action@v1 with: target: ${{ matrix.target }} - rust-toolchain: nightly + rust-toolchain: nightly-2024-02-04 manylinux: auto - args: -i python${{ matrix.python-version }} --release --out dist --no-sdist - - name: Python UnitTest - if: matrix.target == 'x86_64' - run: | - pip install py-sr25519-bindings --no-index --find-links dist --force-reinstall - pip install -r requirements.txt - pip install pytest - pytest tests.py + args: -i python${{ matrix.python-version }} --release --out dist - name: Upload wheels - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: wheels - path: dist + name: dist-wheels-linux-${{ matrix.target }}-${{ matrix.python-version }} + path: dist/*.whl muslwheels_x86: name: Build musllinux wheels for x86 @@ -142,66 +113,83 @@ jobs: env: CIBW_BUILD_VERBOSITY: 1 - CIBW_BEFORE_ALL_LINUX: "curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y" + CIBW_BEFORE_ALL_LINUX: "curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2024-02-04 -y" CIBW_ARCHS_LINUX: "auto64" CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"' CIBW_BUILD: "*-musllinux_x86_64" - CIBW_SKIP: "cp27-* cp34-* cp35-* " + CIBW_SKIP: "cp27-* cp34-* cp35-* cp36-*" + + steps: + - uses: actions/checkout@v4 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.9.0 + with: + output-dir: dist + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: dist-wheels-musl + path: dist/*.whl + + aarch64_wheels: + name: Build wheels for aarch64 linux + runs-on: ubuntu-latest + + env: + CIBW_BUILD_VERBOSITY: 1 + CIBW_BEFORE_ALL_LINUX: "curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2024-02-04 -y" + CIBW_ARCHS_LINUX: "aarch64" + CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"' + CIBW_BUILD: "*-musllinux_aarch64 *-manylinux_aarch64" + CIBW_SKIP: "cp27-* cp34-* cp35-* cp36-*" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 - name: Build wheels - uses: pypa/cibuildwheel@v2.11.2 + uses: pypa/cibuildwheel@v2.9.0 with: output-dir: dist - - uses: actions/upload-artifact@v3 + - name: Upload wheels + uses: actions/upload-artifact@v4 with: - name: wheels - path: dist + name: dist-wheels-aarch64 + path: dist/*.whl + + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 -# aarch64_wheels: -# name: Build wheels for aarch64 linux -# runs-on: ubuntu-latest -# -# env: -# CIBW_BUILD_VERBOSITY: 1 -# CIBW_BEFORE_ALL_LINUX: "curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y" -# CIBW_ARCHS_LINUX: "aarch64" -# CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"' -# CIBW_BUILD: "*-musllinux_aarch64 *-manylinux_aarch64" -# CIBW_SKIP: "cp27-* cp34-* cp35-* " -# -# steps: -# - uses: actions/checkout@v3 -# -# - name: Set up QEMU -# uses: docker/setup-qemu-action@v2 -# with: -# platforms: arm64 -# -# - name: Build wheels -# uses: pypa/cibuildwheel@v2.11.2 -# with: -# output-dir: dist -# -# -# - uses: actions/upload-artifact@v3 -# with: -# name: wheels -# path: dist + - name: Build sdist + run: pipx run build --sdist + + - uses: actions/upload-artifact@v4 + with: + name: dist-src + path: dist/*.tar.gz release: name: Release runs-on: ubuntu-latest if: "startsWith(github.ref, 'refs/tags/')" - needs: [ macos, windows, linux, muslwheels_x86] + needs: [macos, windows, linux, muslwheels_x86, build_sdist] steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4 with: - name: wheels + pattern: dist-* + path: dist + merge-multiple: true - uses: actions/setup-python@v2 with: python-version: 3.9 @@ -211,4 +199,4 @@ jobs: TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | pip install --upgrade twine - twine upload --skip-existing * + twine upload --skip-existing dist/* diff --git a/pyproject.toml b/pyproject.toml index d761ad4..b742f92 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,8 @@ classifiers = [ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11" + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12" ] [project.urls]