Skip to content

add github actions based on mlx#297

Merged
davidkoski merged 18 commits intomainfrom
github-actions
Nov 10, 2025
Merged

add github actions based on mlx#297
davidkoski merged 18 commits intomainfrom
github-actions

Conversation

@davidkoski
Copy link
Collaborator

@davidkoski davidkoski commented Nov 6, 2025

@madrob I copied what you did for mlx and simplified for what we need here. I don't know if you were planning to set this up in mlx-swift, if so this may be useful, if not we can use what I have. I think I additionally need repo settings to activate but I can't see what you did in mlx

@davidkoski davidkoski requested a review from madrob November 6, 2025 22:02
@madrob
Copy link

madrob commented Nov 6, 2025

You got a little ahead of me, but happy to see the contribution!

I set the repo settings to enable Actions; I will try to close and reopen the PR to see if that triggers a build. If not, then you might need to create a new PR.

@madrob madrob closed this Nov 6, 2025
@madrob madrob reopened this Nov 6, 2025
Comment on lines +15 to +16
run:
- |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there are some syntax issues in your workflow definitions. In particular, run: should be a string, not an array.

Suggested change
run:
- |
run: |

Comment on lines +13 to +15
- uses: actions/checkout@v5
- uses: ./.github/actions/setup-macos
- uses: ./.github/actions/build-macos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're not doing a second workflow (like a nightly or weekly main build or some kind of release build) then you could do all of the actions inline. Up to you for how complex this needs to be

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I think one set of actions would be fine. We don't need nightlies or release builds as people pick it up via swiftpm (and the build is on them).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so do you suggest folding the two actions together or just put the actions inline in the workflow?

I think we will want a linux build pretty soon so maybe just combine all the actions in build-macos

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macOS and linux building is sometimes different enough that we can't combine those into a single reusable/composite actions. For now I would fold setup-macos and build-macos into pull_request.yaml and then pull things out in the future as we discover that we need them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, sounds good. I will get that set up in the morning

print("target: b = \(b), m = \(m)")
print("parameters: \(model.parameters())")
// print("target: b = \(b), m = \(m)")
// print("parameters: \(model.parameters())")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were very large and not useful (unless it fails).

xcrun --show-sdk-build-version
swift --version
rm -rf ~/Library/Developer/Xcode/DerivedData/*
xcodebuild build-for-testing -scheme mlx-swift-Package -destination 'platform=macOS'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This builds both the normal targets and the test targets.

shell: sh
run: |
xcrun xctest ~/Library/Developer/Xcode/DerivedData/mlx-swift-*/Build/Products/Debug/CmlxTests.xctest
xcrun xctest ~/Library/Developer/Xcode/DerivedData/mlx-swift-*/Build/Products/Debug/MLXTests.xctest
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run the tests (avoids the connection to service named com.apple.testmanagerd.control was invalidated issue).

@davidkoski
Copy link
Collaborator Author

@madrob I think this is working now, see https://github.com/ml-explore/mlx-swift/actions/runs/19180312566

@davidkoski davidkoski requested a review from awni November 7, 2025 21:35
@madrob
Copy link

madrob commented Nov 10, 2025

https://github.com/ml-explore/mlx-swift/actions/runs/19180312566/job/54835197394?pr=297#step:10:1058

Is this a relevant failure? Shouldn't block this merge, but possibly worth investigating afterwards.

caught("[broadcast_shapes] Shapes (2,5) and (3,5) cannot be broadcast. at /Users/runner/actions-runner/_work/mlx-swift/mlx-swift/Source/Cmlx/mlx-c/mlx/c/ops.cpp:31")
caught("[broadcast_shapes] Shapes (2,5) and (3,5) cannot be broadcast. at /Users/runner/actions-runner/_work/mlx-swift/mlx-swift/Source/Cmlx/mlx-c/mlx/c/ops.cpp:31")
caught("[broadcast_shapes] Shapes (2,5) and (3,5) cannot be broadcast. at /Users/runner/actions-runner/_work/mlx-swift/mlx-swift/Source/Cmlx/mlx-c/mlx/c/ops.cpp:31")

@davidkoski
Copy link
Collaborator Author

https://github.com/ml-explore/mlx-swift/actions/runs/19180312566/job/54835197394?pr=297#step:10:1058

Is this a relevant failure? Shouldn't block this merge, but possibly worth investigating afterwards.

caught("[broadcast_shapes] Shapes (2,5) and (3,5) cannot be broadcast. at /Users/runner/actions-runner/_work/mlx-swift/mlx-swift/Source/Cmlx/mlx-c/mlx/c/ops.cpp:31")
caught("[broadcast_shapes] Shapes (2,5) and (3,5) cannot be broadcast. at /Users/runner/actions-runner/_work/mlx-swift/mlx-swift/Source/Cmlx/mlx-c/mlx/c/ops.cpp:31")
caught("[broadcast_shapes] Shapes (2,5) and (3,5) cannot be broadcast. at /Users/runner/actions-runner/_work/mlx-swift/mlx-swift/Source/Cmlx/mlx-c/mlx/c/ops.cpp:31")

That is actually the error handling code (where we catch c++ exceptions and turn them into swift errors) -- this is one of the tests. It might be worth a comment in the code or a print maybe to indicate this is expected because you are right it looks a bit alarming!

@davidkoski davidkoski merged commit a65edd4 into main Nov 10, 2025
2 checks passed
@davidkoski davidkoski deleted the github-actions branch November 10, 2025 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants