diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml deleted file mode 100644 index 491adb5..0000000 --- a/.github/workflows/build_wheels.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: Build wheels and sdist - -on: - pull_request: - types: [opened, synchronize] - push: - tags: - - '*' - workflow_dispatch: - -jobs: - - sdists_for_pypi: - name: Build sdist (and upload to PyPI on release tags) - runs-on: ubuntu-latest - env: - CAN_DEPLOY: ${{ secrets.SAGEMATH_PYPI_API_TOKEN != '' }} - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - - name: make sdist - run: | - pipx run build -s - - uses: actions/upload-artifact@v4 - with: - path: "dist/*.tar.gz" - name: dist - - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.SAGEMATH_PYPI_API_TOKEN }} - skip_existing: true - verbose: true - if: env.CAN_DEPLOY == 'true' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - - build_wheels: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macOS-latest] - - steps: - - uses: actions/checkout@v4 - - # Used to host cibuildwheel - - uses: actions/setup-python@v4 - - - name: Build wheels - uses: pypa/cibuildwheel@v3.3.0 - - - uses: actions/upload-artifact@v4 - with: - name: wheels - path: ./wheelhouse/*.whl - - pypi-publish: - # https://github.com/pypa/gh-action-pypi-publish - name: Upload wheels to PyPI - needs: build_wheels - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - runs-on: ubuntu-latest - env: - CAN_DEPLOY: ${{ secrets.SAGEMATH_PYPI_API_TOKEN != '' }} - steps: - - - uses: actions/download-artifact@v3 - with: - name: wheels - path: wheelhouse - - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.SAGEMATH_PYPI_API_TOKEN }} - packages_dir: wheelhouse/ - skip_existing: true - verbose: true - if: env.CAN_DEPLOY == 'true' diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml new file mode 100644 index 0000000..9b1e245 --- /dev/null +++ b/.github/workflows/dist.yml @@ -0,0 +1,80 @@ +name: Distributions + +on: + push: + pull_request: + workflow_dispatch: + +concurrency: + # Cancel previous runs of this workflow for the same branch + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + make_sdist: + name: Build sdist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: astral-sh/setup-uv@v7 + - name: Build sdist + run: uv build --sdist + - uses: actions/upload-artifact@v4 + with: + path: "dist/*.tar.*" + name: release-sdist + + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + - windows-latest + #- windows-11-arm https://github.com/sagemath/memory_allocator/issues/14 + - macos-15-intel + - macos-latest + steps: + - uses: actions/checkout@v6 + - uses: astral-sh/setup-uv@v7 + - name: Build wheels + uses: pypa/cibuildwheel@v3.3 + - uses: actions/upload-artifact@v5 + with: + name: release-wheels-${{ matrix.os }} + path: wheelhouse/*.whl + + pypi-publish: + # This needs to be a separate job because pypa/gh-action-pypi-publish cannot run on macOS + # https://github.com/pypa/gh-action-pypi-publish + name: Upload wheels to PyPI + needs: [build_wheels, make_sdist] + runs-on: ubuntu-latest + permissions: + id-token: write + attestations: write + contents: read + steps: + - uses: actions/download-artifact@v6 + with: + pattern: release-* + path: dist + merge-multiple: true + + - name: List files + run: ls -l -R dist + + - name: Generate artifact attestations + uses: actions/attest-build-provenance@v3 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + with: + subject-path: "dist/*" + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + verbose: true + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') diff --git a/README.md b/README.md index fa8be15..bae286d 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ its build backend. A typical editable install looks like: ## 0.1.5 - Migrate build system to Meson. +- Require Python >= 3.12. ## 0.1.4 diff --git a/pyproject.toml b/pyproject.toml index 6e5ed97..53c133c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ description = "An extension class to allocate memory easily with cython" authors = [ { name = "Jeroen Demeyer, Nathann Cohen, Jonathan Kliem", email = "sage-devel@googlegroups.com" }, ] -requires-python = ">=3.11" +requires-python = ">=3.12" readme = "README.md" license = "GPL-3.0-or-later" classifiers = [ @@ -20,5 +20,25 @@ classifiers = [ "Topic :: Scientific/Engineering :: Mathematics", ] +[dependency-groups] +dev = [ + "build>=1.3.0", + "cibuildwheel>=2.23.3", + "cython>=3.1.4", + "meson>=1.9.0", + "meson-python>=0.18.0", + "ninja>=1.13.0", + "pkgconf>=2.4.3.post2", +] + [project.urls] Homepage = "https://github.com/sagemath/memory_allocator" + + +[tool.cibuildwheel] +skip = ["*-win32"] +test-groups = ["dev"] +test-command = "python test.py" +test-sources = ["test.py", "cydoctest.py", "pyproject.toml"] +build-frontend = "build[uv]" +build-verbosity = 1 diff --git a/uv.lock b/uv.lock new file mode 100644 index 0000000..b74146a --- /dev/null +++ b/uv.lock @@ -0,0 +1,8 @@ +version = 1 +revision = 2 +requires-python = ">=3.12" + +[[package]] +name = "memory-allocator" +version = "0.1.4" +source = { editable = "." }