Repository navigation
🔄 Auto-Sync: Apple Upstream Repository #41
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: Downstream Integration Test | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test-swiftlm-umbrella: | |
| name: Test with SwiftLM (Umbrella Repo) | |
| runs-on: macos-15 | |
| timeout-minutes: 40 | |
| steps: | |
| - name: Checkout PR branch (mlx-swift) | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| path: mlx-swift-pr | |
| - name: Checkout SwiftLM (Parent Repo) | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: SharpAI/SwiftLM | |
| path: SwiftLM | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| submodules: recursive | |
| - name: Install Metal Toolchain | |
| run: xcodebuild -downloadComponent MetalToolchain || true | |
| - name: Resolve Dependencies (to populate SPM cache) | |
| run: swift package resolve | |
| working-directory: SwiftLM | |
| - name: Override mlx-swift dependency with PR checkout | |
| # SwiftLM uses mlx-swift as a local path dependency (./mlx-swift submodule). | |
| # SPM `package edit` cannot edit path dependencies, so we directly overwrite | |
| # the submodule directory with our PR branch content. | |
| run: | | |
| rsync -a --delete $GITHUB_WORKSPACE/mlx-swift-pr/ $GITHUB_WORKSPACE/SwiftLM/mlx-swift/ | |
| working-directory: SwiftLM | |
| - name: Install MLX Metal library | |
| run: | | |
| python3 -m venv /tmp/mlx_venv | |
| /tmp/mlx_venv/bin/pip install --quiet mlx | |
| METALLIB=$(echo /tmp/mlx_venv/lib/python*/site-packages/mlx/lib/mlx.metallib) | |
| # Make it available system-wide for all subsequent steps | |
| sudo cp "$METALLIB" /usr/local/lib/mlx.metallib || true | |
| echo "MLX_METAL_LIB=$METALLIB" >> $GITHUB_ENV | |
| - name: Build SwiftLM | |
| run: swift build --build-tests | |
| working-directory: SwiftLM | |
| - name: Copy Metal library to build outputs | |
| run: | | |
| METALLIB="$MLX_METAL_LIB" | |
| # Copy to all locations the test runner and linked bundles may search | |
| find SwiftLM/.build -type d \( -name "debug" -o -name "release" \) -exec cp "$METALLIB" {}/ \; 2>/dev/null || true | |
| find SwiftLM/.build -name "*.xctest" -exec cp "$METALLIB" {}/Contents/MacOS/ \; 2>/dev/null || true | |
| find SwiftLM/.build -name "*Tests" -type f -exec sh -c 'cp "'"$METALLIB"'" "$(dirname ${1})/"' _ {} \; 2>/dev/null || true | |
| - name: Run SwiftLM Integration Tests | |
| run: swift test --parallel --skip-build | |
| working-directory: SwiftLM |