Repository navigation
integration tests to run using xcode 27 (now that it is released) #743
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
Changes from all commits
8f811ef
88d4b24
1c1e5c7
75fa753
1246bb5
42b9210
2e8a5a1
216cb43
2fb5acb
951fc11
f076bfe
e6e3362
62ff25d
2c325a9
2892398
f1c866d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,163 +103,54 @@ jobs: | |
| needs: lint | ||
| if: github.repository == 'ml-explore/mlx-swift-lm' | ||
| runs-on: [self-hosted, macos] | ||
| env: | ||
| DEVELOPER_DIR: /Applications/Xcode-latest.app/Contents/Developer | ||
| # xcodebuild does not forward DEVELOPER_DIR to xctest. MLX's CPU JIT runs g++ | ||
| # from inside the tests, so pass it with the TEST_RUNNER_ prefix. | ||
| TEST_RUNNER_DEVELOPER_DIR: /Applications/Xcode-latest.app/Contents/Developer | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Xcode and Swift versions | ||
| shell: sh | ||
| run: | | ||
| xcodebuild -version | ||
| xcode-select -p | ||
| xcrun --sdk macosx --show-sdk-path | ||
| swift --version | ||
| ls -l /Applications/Xcode-latest.app | ||
| ls /Applications | grep -i xcode | ||
|
|
||
| - name: "Infra: verify MetalToolchain installed" | ||
| shell: bash | ||
| run: xcodebuild -showComponent MetalToolchain | ||
|
|
||
| - name: Verify documentation | ||
| run: scripts/verify-docs.sh | ||
|
Comment on lines
+130
to
+131
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do this first -- matches mlx-swift |
||
|
|
||
| - name: Build (Xcode, macOS) | ||
| shell: sh | ||
| run: | | ||
| xcodebuild -version | ||
| swift --version | ||
| rm -rf ~/Library/Developer/Xcode/DerivedData/* | ||
| xcodebuild build-for-testing -skipPackagePluginValidation -scheme mlx-swift-lm-Package -destination 'platform=macOS' | ||
|
|
||
| - name: Verify documentation | ||
| run: scripts/verify-docs.sh | ||
|
|
||
| - name: Run Tests (Xcode, macOS) | ||
| shell: sh | ||
| run: | | ||
| xcrun xctest ~/Library/Developer/Xcode/DerivedData/mlx-swift-lm-*/Build/Products/Debug/MLXLMTests.xctest | ||
| # Keep the result bundle outside the package root. xcodebuild re-resolves | ||
| # the package graph when files there change, and the resolve can crash it. | ||
| rm -rf "$RUNNER_TEMP/MLXSwiftLMTests.xcresult" | ||
| xcodebuild test -skipPackagePluginValidation -scheme mlx-swift-lm-Package \ | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can use xcodebuild now -- it was having issues on headless hosts in the past. |
||
| -destination 'platform=macOS' -resultBundlePath "$RUNNER_TEMP/MLXSwiftLMTests.xcresult" | ||
|
|
||
| - name: Upload test results | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bonus -- this step now works! |
||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test-results | ||
| path: | | ||
| ~/Library/Developer/Xcode/DerivedData/**/Logs/Test/*.xcresult | ||
| /Users/runner/Library/Developer/Xcode/DerivedData/**/Logs/Test/*.xcresult | ||
| ~/Library/Logs/DiagnosticReports/* | ||
| retention-days: 7 | ||
|
|
||
| # Compile the IntegrationTesting project against the macOS 27 SDK. | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need this any more -- the normal runner has what we need. |
||
| # | ||
| # Two gaps this closes. First, mac_build_and_test above only builds | ||
| # `-scheme mlx-swift-lm-Package`, so the IntegrationTesting Xcode project is | ||
| # never built on the PR path at all and a change that breaks it merges green | ||
| # (see #512, which left seven exhaustive switches over `Generation` unhandled | ||
| # in MTPIteratorEndToEndDiagnosticTests.swift). Second, the nightly | ||
| # integration_tests.yml pins Xcode 26, where everything behind | ||
| # `canImport(FoundationModels, _version: 2)` -- the whole | ||
| # MLXFoundationModelsIntegration/ tree and the MLXFoundationModels adapter -- | ||
| # compiles out and therefore cannot break the build. This job builds both. | ||
| # | ||
| # This is a COMPILE check, and cannot be anything more on this image. The | ||
| # hosted `xcode-27` image carries the macOS 27 SDK on a macOS 26 host, and a | ||
| # test bundle built against the 27 SDK cannot run *any* test there: XCTest | ||
| # calls objc_copyClassList at startup, which realizes every class including | ||
| # the @available(macOS 27, *) `TestResponseStream`, whose metadata instantiates | ||
| # AsyncThrowingStream<MLXLanguageModel.Executor.GenerationEvent, Error> and so | ||
| # calls through weak-null FoundationModels metadata. The runner segfaults | ||
| # during test-suite construction, before any test body or #available guard | ||
| # runs, so no `-only-testing:` selection can dodge it. FM runtime coverage | ||
| # needs a macOS 27 host, which no hosted image offers yet (see #499). | ||
| integration_build_xcode27: | ||
| needs: lint | ||
| # Temporarily disabled. To restore, put back: | ||
| # if: github.repository == 'ml-explore/mlx-swift-lm' | ||
| if: false | ||
| # Public preview label, see actions/runner-images#14404. | ||
| runs-on: xcode-27 | ||
| timeout-minutes: 60 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Report toolchain and host | ||
| shell: bash | ||
| run: | | ||
| xcodebuild -version | ||
| swift --version | ||
| echo "macOS SDK: $(xcrun --sdk macosx --show-sdk-version)" | ||
| sw_vers | ||
| # DeviceTier classifies on the *runtime* OS version rather than the | ||
| # SDK, so printing it here records why this job builds but does not | ||
| # test: on an OS 26 host the FM surface is unavailable at runtime. | ||
| case "$(sw_vers -productVersion)" in | ||
| 27.*|2[89].*|3*) echo "Host DeviceTier would be: full (OS >= 27)" ;; | ||
| 26.*) echo "Host DeviceTier would be: partial (OS 26): the FM surface is @available(macOS 27, *)" ;; | ||
| *) echo "Host DeviceTier would be: absent (OS < 26)" ;; | ||
| esac | ||
|
|
||
| - name: "Infra: assert Xcode 27 and the macOS 27 SDK" | ||
| shell: bash | ||
| run: | | ||
| # `xcode-27` is a preview label and its default toolchain has moved | ||
| # before. On a 26 SDK the entire `_version: 2` tree compiles out and | ||
| # this job goes green while proving nothing, so fail loudly instead. | ||
| case "$(xcodebuild -version | head -1)" in | ||
| "Xcode 27"*) ;; | ||
| *) | ||
| echo "::error::Expected Xcode 27, got '$(xcodebuild -version | head -1)' (DEVELOPER_DIR=${DEVELOPER_DIR:-default})." | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| case "$(xcrun --sdk macosx --show-sdk-version)" in | ||
| 27.*) ;; | ||
| *) | ||
| echo "::error::Expected the macOS 27 SDK, got $(xcrun --sdk macosx --show-sdk-version). The MLXFoundationModels sources are gated on canImport(FoundationModels, _version: 2) and would compile out." | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| - name: "Infra: install MetalToolchain" | ||
| shell: bash | ||
| run: | | ||
| # The self-hosted mac is provisioned with this already, so the jobs | ||
| # above only assert it. The hosted image ships WITHOUT it, and | ||
| # mlx-swift compiles .metal sources during the build (mlx-swift_Cmlx). | ||
| # | ||
| # Parse `Status:` rather than trusting the exit code: -showComponent | ||
| # exits 0 and prints "Status: uninstalled" when the component is | ||
| # absent, so an exit-code guard silently succeeds and the build then | ||
| # dies much later on the first CompileMetalFile with | ||
| # "cannot execute tool 'metal'". | ||
| component_status() { | ||
| xcodebuild -showComponent MetalToolchain 2>&1 \ | ||
| | awk -F': *' '/^Status:/ { print tolower($2); exit }' | ||
| } | ||
| if [ "$(component_status)" = "installed" ]; then | ||
| echo "MetalToolchain installed." | ||
| else | ||
| echo "MetalToolchain reports '$(component_status)'; downloading (839 MB)." | ||
| xcodebuild -downloadComponent MetalToolchain | ||
| if [ "$(component_status)" != "installed" ]; then | ||
| echo "::error::MetalToolchain still reports '$(component_status)' after -downloadComponent." | ||
| exit 1 | ||
| fi | ||
| echo "MetalToolchain installed." | ||
| fi | ||
|
|
||
| - name: Build IntegrationTesting for testing (Xcode, macOS) | ||
| shell: bash | ||
| run: | | ||
| # `build-for-testing` rather than `test`: this compiles both the | ||
| # ungated suites and the `_version: 2` tree, which is the coverage this | ||
| # job exists for. Running them is not an option here (see the crash | ||
| # described above), and a cold-cache `xcodebuild test` would also spend | ||
| # 2-3 hours downloading Hugging Face models. | ||
| xcodebuild build-for-testing \ | ||
| -project IntegrationTesting/IntegrationTesting.xcodeproj \ | ||
| -scheme IntegrationTesting \ | ||
| -destination 'platform=macOS' \ | ||
| -skipPackagePluginValidation \ | ||
| -resultBundlePath IntegrationTesting-build.xcresult | ||
|
|
||
| - name: Upload results | ||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: integration-build-xcode27-results | ||
| path: | | ||
| IntegrationTesting-build.xcresult | ||
| ${{ runner.temp }}/MLXSwiftLMTests.xcresult | ||
| ~/Library/Logs/DiagnosticReports/* | ||
| retention-days: 7 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| version: 1 | ||
| builder: | ||
| configs: | ||
| - documentation_targets: [MLXLLM, MLXVLM, MLXLMCommon, MLXEmbedders, MLXScriptedLM] | ||
| - documentation_targets: [MLXLMCommon, MLXLLM, MLXVLM, MLXEmbedders, MLXFoundationModels, MLXGuidedGeneration, MLXHuggingFace, MLXHuggingFaceMacros, MLXRerankers, MLXScriptedLM] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -254,7 +254,7 @@ public struct MLXLanguageModel: FoundationModels.LanguageModel, Sendable { | |
| /// Capabilities are declared explicitly by the caller at ``init(configuration:capabilities:configurationResolver:prefillStepSize:weightsLocation:load:)`` | ||
| /// and stored verbatim. The caller includes | ||
| /// `.guidedGeneration`/`.toolCalling`/`.reasoning` as appropriate; the | ||
| /// adapter does not consult ``ReasoningHeuristics`` (which remains a | ||
| /// adapter does not consult `ReasoningHeuristics` (which remains a | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some docs build issues (cross module linking) |
||
| /// standalone helper a caller may use to compute their own capability set). | ||
| /// | ||
| /// Declaring `.reasoning` matters for request routing: the framework only | ||
|
|
@@ -264,7 +264,7 @@ public struct MLXLanguageModel: FoundationModels.LanguageModel, Sendable { | |
| /// capability was declared. | ||
| public let capabilities: LanguageModelCapabilities | ||
|
|
||
| /// The configuration resolver that patches a per-call ``ModelConfiguration`` | ||
| /// The configuration resolver that patches a per-call `ModelConfiguration` | ||
| /// for this instance. Defaults to ``DefaultConfigurationResolver`` when | ||
| /// omitted. | ||
| public let configurationResolver: any ModelConfigurationResolver | ||
|
|
@@ -288,7 +288,7 @@ public struct MLXLanguageModel: FoundationModels.LanguageModel, Sendable { | |
| /// - capabilities: The capabilities this model supports | ||
| /// (`.guidedGeneration`, `.toolCalling`, `.reasoning`, `.vision`). | ||
| /// Stored verbatim; the adapter never infers or expands the set. | ||
| /// - configurationResolver: Patches a per-call ``ModelConfiguration`` | ||
| /// - configurationResolver: Patches a per-call `ModelConfiguration` | ||
| /// (reasoning config, extra stop tokens) for this instance. | ||
| /// - prefillStepSize: Prompt prefill step size. `nil` uses the default step size. | ||
| /// - weightsLocation: Resolves a model identifier to its on-disk weights | ||
|
|
||
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.
We will use
Xcode-latest.appnow