From f98403b0a00c63ac63cdb8359e98d95ba3dd6a44 Mon Sep 17 00:00:00 2001 From: Yixuan Qiu Date: Wed, 30 Oct 2024 16:30:48 +0800 Subject: [PATCH] test Mac building --- .github/workflows/wheels.yml | 49 +++++++++++++++++++++++++++++++++--- pyproject.toml | 15 ++++++----- setup.py | 2 +- 3 files changed, 53 insertions(+), 13 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index dfdd549..34baa07 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -1,6 +1,5 @@ -name: Build +name: Build and upload to PyPI -# on: [push, pull_request] on: push: paths-ignore: @@ -8,21 +7,63 @@ on: - README.md - LICENSE - doc/ + release: + types: + - published jobs: build_wheels: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: + # macos-13 is an intel runner, macos-14 is apple silicon matrix: - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest, windows-latest, macos-13, macos-latest] steps: - uses: actions/checkout@v4 - - uses: pypa/cibuildwheel@v2.16 + - name: Build wheels + uses: pypa/cibuildwheel@v2.21.3 + env: + CIBW_BUILD_VERBOSITY: 1 - uses: actions/upload-artifact@v4 with: name: rehline-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: ./wheelhouse/*.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: rehline-sdist + path: dist/*.tar.gz + + upload_pypi: + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write + if: github.event_name == 'release' && github.event.action == 'published' + # or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this) + # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + steps: + - uses: actions/download-artifact@v4 + with: + # unpacks all regot artifacts into dist/ + pattern: rehline-* + path: dist + merge-multiple: true + + - uses: pypa/gh-action-pypi-publish@release/v1 + # with: + # To test: repository-url: https://test.pypi.org/legacy/ diff --git a/pyproject.toml b/pyproject.toml index 7318eb1..eccf2b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,14 +11,13 @@ maintainers = [ ] license = {file = "LICENSE"} readme = "README.md" -requires-python = ">=3.10" +requires-python = ">= 3.10" dependencies = [ - "requests>=2.27.0", - "pybind11>=2.11.1", - "numpy>=1.23.5", - "scipy>=1.11.4", - "scikit-learn>=1.2.2" + "numpy >= 1.23.5", + "scipy >= 1.11.4", + "scikit-learn >= 1.2.2" ] + [pyproject.urls] homepage = "https://rehline.github.io/" repository = "https://github.com/softmin/ReHLine-python" @@ -28,9 +27,9 @@ documentation = "https://rehline-python.readthedocs.io/en/latest/index.html" py-modules = ["build"] [tool.cibuildwheel] -# Only build on CPython 3.6 +# Only build on CPython build = "cp*" [build-system] -requires = ["requests ~= 2.27.0", "pybind11 ~= 2.11.1", "setuptools >= 69.0.3", "wheel >= 0.42.0"] +requires = ["requests ~= 2.31.0", "pybind11 ~= 2.13.0", "setuptools >= 69.0.0", "wheel >= 0.42.0"] build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index aafb3a2..6c88d53 100644 --- a/setup.py +++ b/setup.py @@ -76,5 +76,5 @@ def __str__(self) -> str: # level" feature, but in the future it may provide more features. cmdclass={"build_ext": build_ext}, zip_safe=False, - python_requires=">=3.10", + python_requires=">= 3.10", )