-
Notifications
You must be signed in to change notification settings - Fork 172
Add release workflow that builds and attaches XCFramework assets #351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| name: Release XCFrameworks | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: 'Release tag to upload assets to (leave empty for dry run)' | ||
| required: false | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| build_xcframeworks: | ||
| if: github.repository == 'ml-explore/mlx-swift' | ||
| runs-on: [self-hosted, macos] | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Verify MetalToolchain installed | ||
| shell: bash | ||
| run: xcodebuild -showComponent MetalToolchain | ||
|
|
||
| - name: Build XCFrameworks | ||
| shell: bash | ||
| env: | ||
| DEVELOPER_DIR: /Applications/Xcode-latest.app | ||
| working-directory: xcode | ||
| run: | | ||
| xcodebuild -version | ||
| ../tools/create-xcframework.sh | ||
|
|
||
| - name: Create archives | ||
| shell: bash | ||
| working-directory: xcode/build/output | ||
| run: | | ||
| for framework in MLX Cmlx MLXNN MLXOptimizers; do | ||
| zip -r -y "${framework}.xcframework.zip" "${framework}.xcframework" | ||
| done | ||
|
|
||
| - name: Upload XCFrameworks to release | ||
| if: github.event.release.tag_name || inputs.tag | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| gh release upload "${{ github.event.release.tag_name || inputs.tag }}" \ | ||
| xcode/build/output/MLX.xcframework.zip \ | ||
| xcode/build/output/Cmlx.xcframework.zip \ | ||
| xcode/build/output/MLXNN.xcframework.zip \ | ||
| xcode/build/output/MLXOptimizers.xcframework.zip | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully this part works -- the repo doesn't have such a secret but maybe this is automatic? I am not sure how to test the run of the action until it is merged. No worries, this is new so can't break anything existing :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it goes with GitHub Actions #yolo 🥲
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thrilled to see that the first run succeeded in building the framework! Looks like it stopped just shy of attaching it to a release. Excited to see what happens when it triggers on the next release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I did the dry run variant -- otherwise it looked like it would build
mainand attach to the current release (which is a few commits back). Hopefully today.