mirror of
				https://github.com/ml-explore/mlx.git
				synced 2025-11-04 18:48:15 +08:00 
			
		
		
		
	Migrate CircleCI to GitHub Actions (#2716)
Co-authored-by: Joseph Heck <j_heck@apple.com>
This commit is contained in:
		
							
								
								
									
										28
									
								
								.github/workflows/documentation.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								.github/workflows/documentation.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
name: Documentation
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  workflow_dispatch:
 | 
			
		||||
 | 
			
		||||
permissions:
 | 
			
		||||
  contents: read
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build:
 | 
			
		||||
    runs-on: [self-hosted, macos]
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v5
 | 
			
		||||
      - uses: ./.github/actions/build-docs
 | 
			
		||||
      
 | 
			
		||||
  deploy:
 | 
			
		||||
    needs: build
 | 
			
		||||
    permissions:
 | 
			
		||||
      pages: write
 | 
			
		||||
      id-token: write
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    environment:
 | 
			
		||||
      name: github-pages
 | 
			
		||||
      url: ${{ steps.deployment.outputs.page_url }}
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Deploy to GitHub Pages
 | 
			
		||||
        id: deployment
 | 
			
		||||
        uses: actions/deploy-pages@v4
 | 
			
		||||
							
								
								
									
										93
									
								
								.github/workflows/nightly.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								.github/workflows/nightly.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,93 @@
 | 
			
		||||
name: Nightly Build
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  schedule:
 | 
			
		||||
    - cron: 33 6 * * 1-5
 | 
			
		||||
  workflow_dispatch:
 | 
			
		||||
 | 
			
		||||
permissions:
 | 
			
		||||
  contents: read
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build_linux_release:
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        python_version: ["3.10", "3.14"]
 | 
			
		||||
    runs-on: ubuntu-22.04
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v5
 | 
			
		||||
      - uses: ./.github/actions/setup-linux
 | 
			
		||||
      - uses: ./.github/actions/build-linux
 | 
			
		||||
        with:
 | 
			
		||||
          build-type: release
 | 
			
		||||
          run-tests: false
 | 
			
		||||
      - name: Upload mlx artifacts
 | 
			
		||||
        uses: actions/upload-artifact@v5
 | 
			
		||||
        with:
 | 
			
		||||
          name: linux-wheels-${{ matrix.python_version }}
 | 
			
		||||
          path: wheelhouse/mlx-*.whl
 | 
			
		||||
          retention-days: 7
 | 
			
		||||
      - name: Upload mlx-cpu artifacts
 | 
			
		||||
        if: matrix.python_version == '3.10'
 | 
			
		||||
        uses: actions/upload-artifact@v5
 | 
			
		||||
        with:
 | 
			
		||||
          name: mlx-cpu
 | 
			
		||||
          path: wheelhouse/mlx_cpu-*.whl
 | 
			
		||||
          retention-days: 7
 | 
			
		||||
  
 | 
			
		||||
  build_linux_with_tests:
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
 | 
			
		||||
    runs-on: ubuntu-22.04
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v5
 | 
			
		||||
      - uses: ./.github/actions/setup-linux
 | 
			
		||||
        with:
 | 
			
		||||
          python-version: ${{ matrix.python_version }}
 | 
			
		||||
      - uses: ./.github/actions/build-linux
 | 
			
		||||
 | 
			
		||||
  build_mac_release:
 | 
			
		||||
    strategy:
 | 
			
		||||
      matrix:
 | 
			
		||||
        python-version: ["3.10", "3.13"]
 | 
			
		||||
        # TODO: 3.14 had issues finding a compatible tensorflow
 | 
			
		||||
    env:
 | 
			
		||||
      MACOSX_DEPLOYMENT_TARGET: "15.0"
 | 
			
		||||
    runs-on: [self-hosted, macos]
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v5
 | 
			
		||||
      - uses: ./.github/actions/setup-macos
 | 
			
		||||
        with:
 | 
			
		||||
          python-version: ${{ matrix.python-version }}
 | 
			
		||||
      - uses: ./.github/actions/build-macos
 | 
			
		||||
 | 
			
		||||
  build_cuda_with_tests:
 | 
			
		||||
    runs-on: gpu-t4-4-core
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v5
 | 
			
		||||
      - uses: ./.github/actions/setup-linux
 | 
			
		||||
        with:
 | 
			
		||||
          runner-type: 'cuda'
 | 
			
		||||
      - uses: ./.github/actions/build-cuda
 | 
			
		||||
 | 
			
		||||
  build_cuda_release:
 | 
			
		||||
    runs-on: ubuntu-22-large
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v5
 | 
			
		||||
      - uses: ./.github/actions/setup-linux
 | 
			
		||||
        with:
 | 
			
		||||
          runner-type: 'cuda'
 | 
			
		||||
      - name: Build Python package
 | 
			
		||||
        uses: ./.github/actions/build-cuda-release
 | 
			
		||||
        with:
 | 
			
		||||
          nvcc-location: '/usr/local/cuda-12.9/bin/nvcc'
 | 
			
		||||
      - name: Upload artifacts
 | 
			
		||||
        uses: actions/upload-artifact@v5
 | 
			
		||||
        with:
 | 
			
		||||
          name: mlx-cuda
 | 
			
		||||
          path: wheelhouse/mlx_cuda-*.whl
 | 
			
		||||
          retention-days: 7
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										56
									
								
								.github/workflows/pull_request.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										56
									
								
								.github/workflows/pull_request.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,20 +1,46 @@
 | 
			
		||||
on:
 | 
			
		||||
  pull_request:
 | 
			
		||||
    branches:
 | 
			
		||||
      - main
 | 
			
		||||
name: Build and Test
 | 
			
		||||
 | 
			
		||||
on: pull_request  
 | 
			
		||||
 | 
			
		||||
permissions:
 | 
			
		||||
  contents: read
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  check_lint:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    runs-on: ubuntu-22.04
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v4
 | 
			
		||||
      - uses: actions/setup-python@v4
 | 
			
		||||
      - uses: actions/checkout@v5
 | 
			
		||||
      - uses: ./.github/actions/setup-linux
 | 
			
		||||
      - uses: pre-commit/action@v3.0.1
 | 
			
		||||
 | 
			
		||||
  linux_build_and_test:
 | 
			
		||||
    runs-on: ubuntu-22.04
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v5
 | 
			
		||||
      - uses: ./.github/actions/setup-linux
 | 
			
		||||
      - uses: ./.github/actions/build-linux
 | 
			
		||||
 | 
			
		||||
  mac_build_and_test:
 | 
			
		||||
    runs-on: [self-hosted, macos]
 | 
			
		||||
    needs: check_lint
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v5
 | 
			
		||||
      - uses: ./.github/actions/setup-macos
 | 
			
		||||
      - uses: ./.github/actions/build-macos
 | 
			
		||||
 | 
			
		||||
  cuda_build_and_test:
 | 
			
		||||
    runs-on: gpu-t4-4-core
 | 
			
		||||
    needs: check_lint
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v5
 | 
			
		||||
      - uses: ./.github/actions/setup-linux
 | 
			
		||||
        with:
 | 
			
		||||
          python-version: 3.8
 | 
			
		||||
      - name: Install dependencies
 | 
			
		||||
        run: |
 | 
			
		||||
          python -m pip install --upgrade pip
 | 
			
		||||
          pip install pre-commit black isort clang-format
 | 
			
		||||
      - name: Run lint
 | 
			
		||||
        run: |
 | 
			
		||||
          pre-commit run --all-files
 | 
			
		||||
          runner-type: 'cuda'
 | 
			
		||||
      - uses: ./.github/actions/build-cuda
 | 
			
		||||
 | 
			
		||||
  build_documentation:
 | 
			
		||||
    runs-on: [self-hosted, macos]
 | 
			
		||||
    needs: check_lint
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v5
 | 
			
		||||
      - uses: ./.github/actions/build-docs
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										188
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										188
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,188 @@
 | 
			
		||||
name: PyPI Release
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    tags:
 | 
			
		||||
      - 'v*'
 | 
			
		||||
  workflow_dispatch:
 | 
			
		||||
 | 
			
		||||
permissions:
 | 
			
		||||
  contents: read
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build_documentation:
 | 
			
		||||
    runs-on: [self-hosted, macos]
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v5
 | 
			
		||||
      - uses: ./.github/actions/build-docs
 | 
			
		||||
    
 | 
			
		||||
  deploy_documentation:
 | 
			
		||||
    needs: build_documentation
 | 
			
		||||
    permissions:
 | 
			
		||||
      pages: write
 | 
			
		||||
      id-token: write
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    environment:
 | 
			
		||||
      name: github-pages
 | 
			
		||||
      url: ${{ steps.deployment.outputs.page_url }}
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Deploy to GitHub Pages
 | 
			
		||||
        id: deployment
 | 
			
		||||
        uses: actions/deploy-pages@v4
 | 
			
		||||
 | 
			
		||||
  build_linux_release:
 | 
			
		||||
    strategy:
 | 
			
		||||
      matrix:
 | 
			
		||||
        python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
 | 
			
		||||
    runs-on: ubuntu-22.04
 | 
			
		||||
    env:
 | 
			
		||||
      PYPI_RELEASE: 1
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v5
 | 
			
		||||
      - uses: ./.github/actions/setup-linux
 | 
			
		||||
        with:
 | 
			
		||||
          python-version: ${{ matrix.python_version }}
 | 
			
		||||
      - uses: ./.github/actions/build-linux
 | 
			
		||||
        with:
 | 
			
		||||
          build-type: release
 | 
			
		||||
          run-tests: false
 | 
			
		||||
      - name: Upload MLX artifacts
 | 
			
		||||
        uses: actions/upload-artifact@v5
 | 
			
		||||
        with:
 | 
			
		||||
          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:
 | 
			
		||||
          name: mlx-cpu
 | 
			
		||||
          path: wheelhouse/mlx_cpu-*.whl
 | 
			
		||||
  
 | 
			
		||||
  build_mac_release:
 | 
			
		||||
    strategy:
 | 
			
		||||
      matrix:
 | 
			
		||||
        python-version: ["3.10", "3.11", "3.12", "3.13"]
 | 
			
		||||
        # TODO: 3.14 had issues finding a compatible tensorflow
 | 
			
		||||
    runs-on: [self-hosted, macos]
 | 
			
		||||
    env:
 | 
			
		||||
      PYPI_RELEASE: 1
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v5
 | 
			
		||||
      - uses: ./.github/actions/setup-macos
 | 
			
		||||
        with:
 | 
			
		||||
          python-version: ${{ matrix.python-version }}
 | 
			
		||||
      - uses: ./.github/actions/build-macos
 | 
			
		||||
        with:
 | 
			
		||||
          build-type: release
 | 
			
		||||
      - name: Upload MLX artifacts
 | 
			
		||||
        uses: actions/upload-artifact@v5
 | 
			
		||||
        with:
 | 
			
		||||
          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:
 | 
			
		||||
          name: mlx-metal
 | 
			
		||||
          path: dist/mlx_metal-*.whl
 | 
			
		||||
 | 
			
		||||
  build_cuda_release:
 | 
			
		||||
    runs-on: ubuntu-22-large
 | 
			
		||||
    env:
 | 
			
		||||
      PYPI_RELEASE: 1
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v5
 | 
			
		||||
      - uses: ./.github/actions/setup-linux
 | 
			
		||||
        with:
 | 
			
		||||
          runner-type: 'cuda'
 | 
			
		||||
      - name: Build Python package
 | 
			
		||||
        uses: ./.github/actions/build-cuda-release
 | 
			
		||||
        with:
 | 
			
		||||
          nvcc-location: '/usr/local/cuda-12.9/bin/nvcc'
 | 
			
		||||
      - name: Upload artifacts
 | 
			
		||||
        uses: actions/upload-artifact@v5
 | 
			
		||||
        with:
 | 
			
		||||
          name: mlx-cuda
 | 
			
		||||
          path: wheelhouse/mlx_cuda-*.whl
 | 
			
		||||
 | 
			
		||||
  pypi-publish:
 | 
			
		||||
    name: Upload release to PyPI
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    needs: [build_linux_release, build_mac_release]
 | 
			
		||||
    permissions:
 | 
			
		||||
      id-token: write
 | 
			
		||||
    environment:
 | 
			
		||||
      name: pypi
 | 
			
		||||
      url: https://pypi.org/p/mlx
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/download-artifact@v6
 | 
			
		||||
        with:
 | 
			
		||||
          pattern: linux-wheels-*
 | 
			
		||||
          merge-multiples: true
 | 
			
		||||
          path: artifacts
 | 
			
		||||
      - uses: actions/download-artifact@v6
 | 
			
		||||
        with:
 | 
			
		||||
          pattern: mac-wheels-*
 | 
			
		||||
          merge-multiples: true
 | 
			
		||||
          path: artifacts
 | 
			
		||||
      - name: Display structure of downloaded files
 | 
			
		||||
        run: ls -R artifacts
 | 
			
		||||
      # - name: Publish package distributions to PyPI
 | 
			
		||||
      #  uses: pypa/gh-action-pypi-publish@release/v1
 | 
			
		||||
  
 | 
			
		||||
  pypi-publish-cuda:
 | 
			
		||||
    name: Upload CUDA release to PyPI
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    needs: build_cuda_release
 | 
			
		||||
    permissions:
 | 
			
		||||
      id-token: write
 | 
			
		||||
    environment:
 | 
			
		||||
      name: pypi
 | 
			
		||||
      url: https://pypi.org/p/mlx-cuda
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/download-artifact@v6
 | 
			
		||||
        with:
 | 
			
		||||
          name: mlx-cuda
 | 
			
		||||
          path: artifacts
 | 
			
		||||
      - name: Display structure of downloaded files
 | 
			
		||||
        run: ls -R artifacts
 | 
			
		||||
      # - name: Publish package distributions to PyPI
 | 
			
		||||
      #  uses: pypa/gh-action-pypi-publish@release/v1
 | 
			
		||||
 | 
			
		||||
  pypi-publish-cpu:
 | 
			
		||||
    name: Upload CPU release to PyPI
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    needs: build_linux_release
 | 
			
		||||
    permissions:
 | 
			
		||||
      id-token: write
 | 
			
		||||
    environment:
 | 
			
		||||
      name: pypi
 | 
			
		||||
      url: https://pypi.org/p/mlx-cpu
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/download-artifact@v6
 | 
			
		||||
        with:
 | 
			
		||||
          name: mlx-cpu
 | 
			
		||||
          path: artifacts
 | 
			
		||||
      - name: Display structure of downloaded files
 | 
			
		||||
        run: ls -R artifacts
 | 
			
		||||
      # - name: Publish package distributions to PyPI
 | 
			
		||||
      #  uses: pypa/gh-action-pypi-publish@release/v1
 | 
			
		||||
 | 
			
		||||
  pypi-publish-metal:
 | 
			
		||||
    name: Upload Metal release to PyPI
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    needs: build_mac_release
 | 
			
		||||
    permissions:
 | 
			
		||||
      id-token: write
 | 
			
		||||
    environment:
 | 
			
		||||
      name: pypi
 | 
			
		||||
      url: https://pypi.org/p/mlx-metal
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/download-artifact@v6
 | 
			
		||||
        with:
 | 
			
		||||
          name: mlx-metal
 | 
			
		||||
          path: artifacts
 | 
			
		||||
      - name: Display structure of downloaded files
 | 
			
		||||
        run: ls -R artifacts
 | 
			
		||||
      # - name: Publish package distributions to PyPI
 | 
			
		||||
      #  uses: pypa/gh-action-pypi-publish@release/v1
 | 
			
		||||
		Reference in New Issue
	
	Block a user