mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-14 00:39:06 +08:00
fix release (#2759)
This commit is contained in:
6
.github/actions/build-docs/action.yml
vendored
6
.github/actions/build-docs/action.yml
vendored
@@ -7,6 +7,12 @@ runs:
|
|||||||
- name: Setup machine
|
- name: Setup machine
|
||||||
uses: ./.github/actions/setup-macos
|
uses: ./.github/actions/setup-macos
|
||||||
|
|
||||||
|
- name: Setup uv
|
||||||
|
uses: astral-sh/setup-uv@v6
|
||||||
|
with:
|
||||||
|
python-version: "3.10"
|
||||||
|
activate-environment: true
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
shell: sh
|
shell: sh
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
13
.github/actions/build-macos-release/action.yml
vendored
13
.github/actions/build-macos-release/action.yml
vendored
@@ -20,14 +20,17 @@ runs:
|
|||||||
env:
|
env:
|
||||||
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
|
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
|
||||||
run: |
|
run: |
|
||||||
uv pip install build
|
conda activate env
|
||||||
uv run --no-project setup.py clean --all
|
pip install build
|
||||||
MLX_BUILD_STAGE=1 uv run -m build -w
|
python setup.py clean --all
|
||||||
|
MLX_BUILD_STAGE=1 python -m build -w
|
||||||
|
|
||||||
- name: Build backend package
|
- name: Build backend package
|
||||||
if: ${{ inputs.build-backend }}
|
if: ${{ inputs.build-backend }}
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
|
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
|
||||||
run: |
|
run: |
|
||||||
uv run --no-project setup.py clean --all
|
conda activate env
|
||||||
MLX_BUILD_STAGE=2 uv run -m build -w
|
python setup.py clean --all
|
||||||
|
MLX_BUILD_STAGE=2 python -m build -w
|
||||||
|
|||||||
25
.github/actions/build-macos/action.yml
vendored
25
.github/actions/build-macos/action.yml
vendored
@@ -1,14 +1,31 @@
|
|||||||
name: 'Build and Test on macOS'
|
name: 'Build and Test on macOS'
|
||||||
description: 'Build and test MLX on macOS'
|
description: 'Build and test MLX on macOS'
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
python-version:
|
||||||
|
description: 'Python version to use'
|
||||||
|
required: false
|
||||||
|
default: '3.10'
|
||||||
|
macos-target:
|
||||||
|
description: 'macOS target to build and test for'
|
||||||
|
required: false
|
||||||
|
default: '14.0'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
|
- name: Setup uv
|
||||||
|
uses: astral-sh/setup-uv@v6
|
||||||
|
with:
|
||||||
|
python-version: ${{ inputs.python-version }}
|
||||||
|
activate-environment: true
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
shell: sh
|
shell: sh
|
||||||
env:
|
env:
|
||||||
DEBUG: 1
|
DEBUG: 1
|
||||||
CMAKE_ARGS: "-DCMAKE_COMPILE_WARNING_AS_ERROR=ON"
|
CMAKE_ARGS: "-DCMAKE_COMPILE_WARNING_AS_ERROR=ON"
|
||||||
|
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
|
||||||
run: |
|
run: |
|
||||||
uv pip install --upgrade pip
|
uv pip install --upgrade pip
|
||||||
uv pip install cmake setuptools nanobind==2.4.0
|
uv pip install cmake setuptools nanobind==2.4.0
|
||||||
@@ -29,6 +46,7 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
LOW_MEMORY: 1
|
LOW_MEMORY: 1
|
||||||
|
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
|
||||||
run: |
|
run: |
|
||||||
DEVICE=cpu uv run -m xmlrunner discover -v python/tests -o test-results/cpu
|
DEVICE=cpu uv run -m xmlrunner discover -v python/tests -o test-results/cpu
|
||||||
DEVICE=gpu METAL_DEVICE_WRAPPER_TYPE=1 METAL_DEBUG_ERROR_MODE=0 uv run -m xmlrunner discover -v python/tests -o test-results/gpu
|
DEVICE=gpu METAL_DEVICE_WRAPPER_TYPE=1 METAL_DEBUG_ERROR_MODE=0 uv run -m xmlrunner discover -v python/tests -o test-results/gpu
|
||||||
@@ -38,6 +56,8 @@ runs:
|
|||||||
|
|
||||||
- name: Build example extension
|
- name: Build example extension
|
||||||
shell: bash
|
shell: bash
|
||||||
|
env:
|
||||||
|
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
|
||||||
run: |
|
run: |
|
||||||
cd examples/extensions
|
cd examples/extensions
|
||||||
uv pip install -r requirements.txt
|
uv pip install -r requirements.txt
|
||||||
@@ -46,6 +66,8 @@ runs:
|
|||||||
|
|
||||||
- name: Build CPP only
|
- name: Build CPP only
|
||||||
shell: bash
|
shell: bash
|
||||||
|
env:
|
||||||
|
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
|
||||||
run: |
|
run: |
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
@@ -62,6 +84,8 @@ runs:
|
|||||||
|
|
||||||
- name: Build small binary with JIT
|
- name: Build small binary with JIT
|
||||||
shell: bash
|
shell: bash
|
||||||
|
env:
|
||||||
|
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
|
||||||
run: |
|
run: |
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
@@ -80,6 +104,7 @@ runs:
|
|||||||
DEVICE: gpu
|
DEVICE: gpu
|
||||||
METAL_DEVICE_WRAPPER_TYPE: 1
|
METAL_DEVICE_WRAPPER_TYPE: 1
|
||||||
METAL_DEBUG_ERROR_MODE: 0
|
METAL_DEBUG_ERROR_MODE: 0
|
||||||
|
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
|
||||||
run: |
|
run: |
|
||||||
CMAKE_ARGS="-DMLX_METAL_JIT=ON" \
|
CMAKE_ARGS="-DMLX_METAL_JIT=ON" \
|
||||||
uv pip install -e . -v
|
uv pip install -e . -v
|
||||||
|
|||||||
12
.github/actions/setup-macos/action.yml
vendored
12
.github/actions/setup-macos/action.yml
vendored
@@ -1,12 +1,6 @@
|
|||||||
name: 'Setup macOS Environment'
|
name: 'Setup macOS Environment'
|
||||||
description: 'Install dependencies for macOS builds'
|
description: 'Install dependencies for macOS builds'
|
||||||
|
|
||||||
inputs:
|
|
||||||
python-version:
|
|
||||||
description: 'Python version to use'
|
|
||||||
required: false
|
|
||||||
default: '3.10'
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
@@ -17,9 +11,3 @@ runs:
|
|||||||
- name: Verify MetalToolchain installed
|
- name: Verify MetalToolchain installed
|
||||||
shell: bash
|
shell: bash
|
||||||
run: xcodebuild -showComponent MetalToolchain
|
run: xcodebuild -showComponent MetalToolchain
|
||||||
|
|
||||||
- name: Setup uv
|
|
||||||
uses: astral-sh/setup-uv@v6
|
|
||||||
with:
|
|
||||||
python-version: ${{ inputs.python-version }}
|
|
||||||
activate-environment: true
|
|
||||||
|
|||||||
5
.github/workflows/pull_request.yml
vendored
5
.github/workflows/pull_request.yml
vendored
@@ -28,12 +28,17 @@ jobs:
|
|||||||
|
|
||||||
mac_build_and_test:
|
mac_build_and_test:
|
||||||
if: github.repository == 'ml-explore/mlx'
|
if: github.repository == 'ml-explore/mlx'
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
macos-target: ["14.0", "15.0"]
|
||||||
runs-on: [self-hosted, macos]
|
runs-on: [self-hosted, macos]
|
||||||
needs: check_lint
|
needs: check_lint
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: ./.github/actions/setup-macos
|
- uses: ./.github/actions/setup-macos
|
||||||
- uses: ./.github/actions/build-macos
|
- uses: ./.github/actions/build-macos
|
||||||
|
with:
|
||||||
|
macos-target: ${{ matrix.macos-target }}
|
||||||
|
|
||||||
cuda_build_and_test:
|
cuda_build_and_test:
|
||||||
if: github.repository == 'ml-explore/mlx'
|
if: github.repository == 'ml-explore/mlx'
|
||||||
|
|||||||
50
.github/workflows/release.yml
vendored
50
.github/workflows/release.yml
vendored
@@ -5,6 +5,11 @@ on:
|
|||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
dev_release:
|
||||||
|
description: "Do a dev release or regular release"
|
||||||
|
required: true
|
||||||
|
default: "false"
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -12,10 +17,6 @@ permissions:
|
|||||||
jobs:
|
jobs:
|
||||||
setup:
|
setup:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
|
||||||
pypi_env: ${{ github.event_name == 'push' && 'pypi' || 'test-pypi' }}
|
|
||||||
pypi_url: ${{ github.event_name == 'push' && 'https://upload.pypi.org/legacy/' || 'https://test.pypi.org/legacy/' }}
|
|
||||||
skip_duplicates: ${{ github.event_name == 'push' && 'false' || 'true' }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set publishing variables
|
- name: Set publishing variables
|
||||||
run: echo "Publishing setup complete"
|
run: echo "Publishing setup complete"
|
||||||
@@ -54,6 +55,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.runner }}
|
runs-on: ${{ matrix.runner }}
|
||||||
env:
|
env:
|
||||||
PYPI_RELEASE: 1
|
PYPI_RELEASE: 1
|
||||||
|
DEV_RELEASE: ${{ github.event.inputs.dev_release == 'true' && 1 || 0 }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: ./.github/actions/setup-linux
|
- uses: ./.github/actions/setup-linux
|
||||||
@@ -83,22 +85,27 @@ jobs:
|
|||||||
runs-on: [self-hosted, macos]
|
runs-on: [self-hosted, macos]
|
||||||
env:
|
env:
|
||||||
PYPI_RELEASE: 1
|
PYPI_RELEASE: 1
|
||||||
|
DEV_RELEASE: ${{ github.event.inputs.dev_release == 'true' && 1 || 0 }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: ./.github/actions/setup-macos
|
- uses: ./.github/actions/setup-macos
|
||||||
|
- uses: conda-incubator/setup-miniconda@v3
|
||||||
with:
|
with:
|
||||||
|
miniconda-version: "latest"
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
shell: sh
|
shell: sh
|
||||||
run: |
|
run: |
|
||||||
uv pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
uv pip install cmake setuptools nanobind==2.4.0
|
pip install cmake setuptools nanobind==2.4.0
|
||||||
uv pip install -e . -v
|
pip install -e . -v
|
||||||
- name: Generate package stubs
|
- name: Generate package stubs
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
uv pip install typing_extensions
|
pip install typing_extensions
|
||||||
uv run --no-project setup.py generate_stubs
|
python setup.py generate_stubs
|
||||||
- name: Build macOS 14 package
|
- name: Build macOS 14 package
|
||||||
uses: ./.github/actions/build-macos-release
|
uses: ./.github/actions/build-macos-release
|
||||||
with:
|
with:
|
||||||
@@ -126,6 +133,7 @@ jobs:
|
|||||||
runs-on: ubuntu-22-large
|
runs-on: ubuntu-22-large
|
||||||
env:
|
env:
|
||||||
PYPI_RELEASE: 1
|
PYPI_RELEASE: 1
|
||||||
|
DEV_RELEASE: ${{ github.event.inputs.dev_release == 'true' && 1 || 0 }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: ./.github/actions/setup-linux
|
- uses: ./.github/actions/setup-linux
|
||||||
@@ -148,7 +156,7 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
environment:
|
environment:
|
||||||
name: ${{ needs.setup.outputs.pypi_env }}
|
name: pypi
|
||||||
url: https://pypi.org/p/mlx
|
url: https://pypi.org/p/mlx
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/download-artifact@v6
|
- uses: actions/download-artifact@v6
|
||||||
@@ -166,9 +174,7 @@ jobs:
|
|||||||
- name: Publish package distributions to PyPI
|
- name: Publish package distributions to PyPI
|
||||||
uses: pypa/gh-action-pypi-publish@release/v1
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
repository-url: ${{ needs.setup.outputs.pypi_url }}
|
repository-url: https://upload.pypi.org/legacy/
|
||||||
skip-existing: ${{ needs.setup.outputs.skip_duplicates }}
|
|
||||||
print-hash: true
|
|
||||||
|
|
||||||
pypi-publish-cuda:
|
pypi-publish-cuda:
|
||||||
name: Upload CUDA release to PyPI
|
name: Upload CUDA release to PyPI
|
||||||
@@ -177,7 +183,7 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
environment:
|
environment:
|
||||||
name: ${{ needs.setup.outputs.pypi_env }}
|
name: pypi
|
||||||
url: https://pypi.org/p/mlx-cuda
|
url: https://pypi.org/p/mlx-cuda
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/download-artifact@v6
|
- uses: actions/download-artifact@v6
|
||||||
@@ -189,9 +195,7 @@ jobs:
|
|||||||
- name: Publish package distributions to PyPI
|
- name: Publish package distributions to PyPI
|
||||||
uses: pypa/gh-action-pypi-publish@release/v1
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
repository-url: ${{ needs.setup.outputs.pypi_url }}
|
repository-url: https://upload.pypi.org/legacy/
|
||||||
skip-existing: ${{ needs.setup.outputs.skip_duplicates }}
|
|
||||||
print-hash: true
|
|
||||||
|
|
||||||
pypi-publish-cpu:
|
pypi-publish-cpu:
|
||||||
name: Upload CPU release to PyPI
|
name: Upload CPU release to PyPI
|
||||||
@@ -200,7 +204,7 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
environment:
|
environment:
|
||||||
name: ${{ needs.setup.outputs.pypi_env }}
|
name: pypi
|
||||||
url: https://pypi.org/p/mlx-cpu
|
url: https://pypi.org/p/mlx-cpu
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/download-artifact@v6
|
- uses: actions/download-artifact@v6
|
||||||
@@ -212,9 +216,7 @@ jobs:
|
|||||||
- name: Publish package distributions to PyPI
|
- name: Publish package distributions to PyPI
|
||||||
uses: pypa/gh-action-pypi-publish@release/v1
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
repository-url: ${{ needs.setup.outputs.pypi_url }}
|
repository-url: https://upload.pypi.org/legacy/
|
||||||
skip-existing: ${{ needs.setup.outputs.skip_duplicates }}
|
|
||||||
print-hash: true
|
|
||||||
|
|
||||||
pypi-publish-metal:
|
pypi-publish-metal:
|
||||||
name: Upload Metal release to PyPI
|
name: Upload Metal release to PyPI
|
||||||
@@ -223,7 +225,7 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
environment:
|
environment:
|
||||||
name: ${{ needs.setup.outputs.pypi_env }}
|
name: pypi
|
||||||
url: https://pypi.org/p/mlx-metal
|
url: https://pypi.org/p/mlx-metal
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/download-artifact@v6
|
- uses: actions/download-artifact@v6
|
||||||
@@ -235,6 +237,4 @@ jobs:
|
|||||||
- name: Publish package distributions to PyPI
|
- name: Publish package distributions to PyPI
|
||||||
uses: pypa/gh-action-pypi-publish@release/v1
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
repository-url: ${{ needs.setup.outputs.pypi_url }}
|
repository-url: https://upload.pypi.org/legacy/
|
||||||
skip-existing: ${{ needs.setup.outputs.skip_duplicates }}
|
|
||||||
print-hash: true
|
|
||||||
|
|||||||
4
setup.py
4
setup.py
@@ -24,11 +24,11 @@ def get_version():
|
|||||||
if "#define MLX_VERSION_PATCH" in l:
|
if "#define MLX_VERSION_PATCH" in l:
|
||||||
patch = l.split()[-1]
|
patch = l.split()[-1]
|
||||||
version = f"{major}.{minor}.{patch}"
|
version = f"{major}.{minor}.{patch}"
|
||||||
if "PYPI_RELEASE" not in os.environ:
|
if os.environ.get("PYPI_RELEASE", False):
|
||||||
today = datetime.date.today()
|
today = datetime.date.today()
|
||||||
version = f"{version}.dev{today.year}{today.month:02d}{today.day:02d}"
|
version = f"{version}.dev{today.year}{today.month:02d}{today.day:02d}"
|
||||||
|
|
||||||
if "DEV_RELEASE" not in os.environ:
|
if os.environ.get("DEV_RELEASE", False):
|
||||||
git_hash = (
|
git_hash = (
|
||||||
run(
|
run(
|
||||||
"git rev-parse --short HEAD".split(),
|
"git rev-parse --short HEAD".split(),
|
||||||
|
|||||||
Reference in New Issue
Block a user