Fast test #55
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PyPI Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| branches: | |
| - test-publish/* | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: 'Dry run (do not publish to PyPi)' | |
| required: false | |
| type: boolean | |
| dev_release: | |
| description: 'Development release (DEV_RELEASE=1)' | |
| required: false | |
| type: boolean | |
| permissions: | |
| contents: read | |
| jobs: | |
| build_documentation: | |
| if: github.repository == 'ml-explore/mlx' | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/build-docs | |
| deploy_documentation: | |
| needs: build_documentation | |
| permissions: | |
| pages: write | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: ${{ inputs.dry_run && 'none' || 'github-pages' }} | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| - name: Dry run check | |
| if: failure() && inputs.dry_run | |
| shell: bash | |
| run: echo 'Expected deployment failure' | |
| build_linux_release: | |
| if: github.repository == 'ml-explore/mlx' | |
| strategy: | |
| matrix: | |
| python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| arch: ['x86_64', 'aarch64'] | |
| runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-22.04' || 'ubuntu-22.04-arm' }} | |
| env: | |
| PYPI_RELEASE: 1 | |
| DEV_RELEASE: ${{ inputs.dev_release && 1 || 0 }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup-linux | |
| with: | |
| python-version: ${{ matrix.python_version }} | |
| clear-disk: true | |
| use-ccache: false | |
| - uses: ./.github/actions/build-linux-release | |
| with: | |
| build-backend: ${{ matrix.python_version == '3.10' }} | |
| arch: ${{ matrix.arch }} | |
| - name: Upload MLX artifacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| overwrite: true | |
| name: linux-wheels-${{ matrix.python_version }}-${{ matrix.arch }} | |
| path: wheelhouse/mlx-*.whl | |
| if-no-files-found: error | |
| - name: Upload CPU artifacts | |
| if: matrix.python_version == '3.10' | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| overwrite: true | |
| name: mlx-cpu-${{ matrix.arch }} | |
| path: wheelhouse/mlx_cpu-*.whl | |
| if-no-files-found: error | |
| pypi-publish-cpu: | |
| name: Upload CPU release to PyPI | |
| runs-on: ubuntu-latest | |
| needs: [build_linux_release] | |
| permissions: | |
| id-token: write | |
| environment: | |
| name: ${{ inputs.dry_run && 'none' || 'pypi' }} | |
| url: https://pypi.org/p/mlx-cpu | |
| steps: | |
| - uses: actions/download-artifact@v7 | |
| with: | |
| pattern: mlx-cpu-* | |
| merge-multiple: true | |
| path: dist | |
| - name: Display structure of downloaded files | |
| run: du -ah dist | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://upload.pypi.org/legacy/ | |
| - name: Dry run check | |
| if: failure() && inputs.dry_run | |
| shell: bash | |
| run: echo 'Expected deployment failure' |