From 49e4566df3b88a7e05e5cc8030c45105ff52a18f Mon Sep 17 00:00:00 2001 From: Awni Hannun Date: Sun, 16 Nov 2025 11:39:53 -0800 Subject: [PATCH] fix release 2 (#2767) * fix release 2 * login * fix --- .../actions/build-macos-release/action.yml | 10 +-- .github/actions/build-macos/action.yml | 69 ++++++------------- .github/actions/setup-macos/action.yml | 11 +++ .github/workflows/nightly.yml | 1 - .github/workflows/pull_request.yml | 8 ++- .github/workflows/release.yml | 19 +++-- 6 files changed, 50 insertions(+), 68 deletions(-) diff --git a/.github/actions/build-macos-release/action.yml b/.github/actions/build-macos-release/action.yml index c71b26699..61712cdc6 100644 --- a/.github/actions/build-macos-release/action.yml +++ b/.github/actions/build-macos-release/action.yml @@ -16,21 +16,15 @@ runs: using: "composite" steps: - name: Build Python package - shell: bash - env: - MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }} + shell: bash -l {0} run: | - conda activate env pip install build python setup.py clean --all MLX_BUILD_STAGE=1 python -m build -w - name: Build backend package if: ${{ inputs.build-backend }} - shell: bash - env: - MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }} + shell: bash -l {0} run: | - conda activate env python setup.py clean --all MLX_BUILD_STAGE=2 python -m build -w diff --git a/.github/actions/build-macos/action.yml b/.github/actions/build-macos/action.yml index ac1163872..e63160165 100644 --- a/.github/actions/build-macos/action.yml +++ b/.github/actions/build-macos/action.yml @@ -1,73 +1,51 @@ name: 'Build and Test 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: using: "composite" steps: - - name: Setup uv - uses: astral-sh/setup-uv@v6 - with: - python-version: ${{ inputs.python-version }} - activate-environment: true - - name: Install dependencies - shell: sh env: DEBUG: 1 CMAKE_ARGS: "-DCMAKE_COMPILE_WARNING_AS_ERROR=ON" - MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }} + shell: bash -l {0} run: | - uv pip install --upgrade pip - uv pip install cmake setuptools nanobind==2.4.0 - uv pip install -e . -v + pip install --upgrade pip + pip install cmake setuptools nanobind==2.4.0 + pip install -e . -v - name: Generate package stubs - shell: bash + shell: bash -l {0} run: | - uv pip install typing_extensions - uv run --no-project setup.py generate_stubs + pip install typing_extensions + python setup.py generate_stubs - name: Install tests dependencies - shell: sh + shell: bash -l {0} run: | - uv pip install numpy torch tensorflow unittest-xml-reporting + pip install numpy torch tensorflow unittest-xml-reporting - name: Run Python tests - shell: bash + shell: bash -l {0} env: LOW_MEMORY: 1 - MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }} run: | - 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=cpu python -m xmlrunner discover -v python/tests -o test-results/cpu + DEVICE=gpu METAL_DEVICE_WRAPPER_TYPE=1 METAL_DEBUG_ERROR_MODE=0 python -m xmlrunner discover -v python/tests -o test-results/gpu mpirun --bind-to none -host localhost:8 -np 8 -x DYLD_LIBRARY_PATH=/opt/homebrew/lib/ python python/tests/mpi_test_distributed.py mlx.launch --verbose -n 8 python/tests/ring_test_distributed.py -v 2> >(tee -a stderr.log >&2) if $(grep "\[WARN\]" stderr.log); then echo "Distributed ring test failed"; exit 1; fi - name: Build example extension - shell: bash - env: - MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }} + shell: bash -l {0} run: | cd examples/extensions - uv pip install -r requirements.txt - uv run --no-project setup.py build_ext --inplace - uv run --no-project test.py + pip install -r requirements.txt + python setup.py build_ext --inplace + python test.py - name: Build CPP only - shell: bash - env: - MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }} + shell: bash -l {0} run: | mkdir -p build cd build @@ -75,7 +53,7 @@ runs: make -j $(sysctl -n hw.ncpu) - name: Run CPP tests - shell: bash + shell: bash -l {0} env: DEVICE: gpu METAL_DEVICE_WRAPPER_TYPE: 1 @@ -83,9 +61,7 @@ runs: run: ./build/tests/tests - name: Build small binary with JIT - shell: bash - env: - MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }} + shell: bash -l {0} run: | mkdir -p build cd build @@ -98,16 +74,15 @@ runs: make -j $(sysctl -n hw.ncpu) - name: Run Python tests with JIT - shell: bash + shell: bash -l {0} env: LOW_MEMORY: 1 DEVICE: gpu METAL_DEVICE_WRAPPER_TYPE: 1 METAL_DEBUG_ERROR_MODE: 0 - MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }} run: | CMAKE_ARGS="-DMLX_METAL_JIT=ON" \ - uv pip install -e . -v - uv run -m xmlrunner discover \ + pip install -e . -v + python -m xmlrunner discover \ -v python/tests \ -o test-results/gpu_jit diff --git a/.github/actions/setup-macos/action.yml b/.github/actions/setup-macos/action.yml index cf89ba3b1..a108e686f 100644 --- a/.github/actions/setup-macos/action.yml +++ b/.github/actions/setup-macos/action.yml @@ -1,6 +1,12 @@ name: 'Setup macOS Environment' description: 'Install dependencies for macOS builds' +inputs: + python-version: + description: 'Python version to use' + required: false + default: '3.10' + runs: using: "composite" steps: @@ -11,3 +17,8 @@ runs: - name: Verify MetalToolchain installed shell: bash run: xcodebuild -showComponent MetalToolchain + + - uses: conda-incubator/setup-miniconda@v3 + with: + miniconda-version: "latest" + python-version: ${{ inputs.python-version }} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 0b7bd2579..2909e8359 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -67,7 +67,6 @@ jobs: with: python-version: ${{ matrix.python-version }} - uses: ./.github/actions/build-macos - - name: Build macOS 15 package uses: ./.github/actions/build-macos-release with: diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 7f180ce1e..542db841e 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -5,6 +5,10 @@ on: pull_request permissions: contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: check_lint: runs-on: ubuntu-22.04 @@ -35,13 +39,13 @@ jobs: matrix: macos-target: ["14.0", "15.0"] runs-on: [self-hosted, macos] + env: + MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macos-target }} needs: check_lint steps: - uses: actions/checkout@v5 - uses: ./.github/actions/setup-macos - uses: ./.github/actions/build-macos - with: - macos-target: ${{ matrix.macos-target }} cuda_build_and_test: if: github.repository == 'ml-explore/mlx' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9163d42ed..f23dc572e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,12 +47,8 @@ jobs: strategy: matrix: python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"] - include: - - runner: ubuntu-24.04 - arch: x64 - - runner: ubuntu-24.04-arm64 - arch: arm64 - runs-on: ${{ matrix.runner }} + arch: ['x86_64', 'aarch64'] + runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-22.04' || 'ubuntu-22.04-arm' }} env: PYPI_RELEASE: 1 DEV_RELEASE: ${{ github.event.inputs.dev_release == 'true' && 1 || 0 }} @@ -68,12 +64,14 @@ jobs: - name: Upload MLX artifacts uses: actions/upload-artifact@v5 with: + overwrite: true name: linux-wheels-${{ matrix.python_version }} path: wheelhouse/mlx-*.whl - name: Upload CPU artifacts if: matrix.python_version == '3.10' uses: actions/upload-artifact@v5 with: + overwrite: true name: mlx-cpu path: wheelhouse/mlx_cpu-*.whl @@ -90,19 +88,17 @@ jobs: steps: - uses: actions/checkout@v5 - uses: ./.github/actions/setup-macos - - uses: conda-incubator/setup-miniconda@v3 with: - miniconda-version: "latest" python-version: ${{ matrix.python-version }} - name: Install dependencies - shell: sh + shell: bash -l {0} run: | pip install --upgrade pip pip install cmake setuptools nanobind==2.4.0 pip install -e . -v - name: Generate package stubs - shell: bash + shell: bash -l {0} run: | pip install typing_extensions python setup.py generate_stubs @@ -119,12 +115,14 @@ jobs: - name: Upload MLX artifacts uses: actions/upload-artifact@v5 with: + overwrite: true name: mac-wheels-${{ matrix.python-version }} path: dist/mlx-*.whl - name: Upload Metal artifacts if: matrix.python-version == '3.10' uses: actions/upload-artifact@v5 with: + overwrite: true name: mlx-metal path: dist/mlx_metal-*.whl @@ -146,6 +144,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v5 with: + overwrite: true name: mlx-cuda path: wheelhouse/mlx_cuda-*.whl