Skip to content

Merge pull request #12 from SharpAI/feat/add-fp8-fast #64

Merge pull request #12 from SharpAI/feat/add-fp8-fast

Merge pull request #12 from SharpAI/feat/add-fp8-fast #64

name: SwiftLM Integration Tests
on: [pull_request, push]
jobs:
integration-test:
name: Build & Test SwiftLM
runs-on: macos-15
steps:
- name: Checkout mlx-swift (this repository)
uses: actions/checkout@v4
with:
path: mlx-swift
submodules: recursive
- name: Checkout SwiftLM
uses: actions/checkout@v4
with:
repository: SharpAI/SwiftLM
path: SwiftLM
submodules: recursive
- name: Redirect Dependencies to Local Form
run: |
# Point SwiftLM to the local checkout of mlx-swift PR branch
sed -i '' -E 's|\.package\(url: "https://github.com/SharpAI/mlx-swift\.git".*|\.package(path: "../mlx-swift"),|' SwiftLM/Package.swift
sed -i '' -E 's|\.package\(url: "https://github.com/ml-explore/mlx-swift\.git".*|\.package(path: "../mlx-swift"),|' SwiftLM/Package.swift
# Point the inner mlx-swift-lm submodule to the local checkout of mlx-swift PR branch
sed -i '' -E 's|\.package\(url: "https://github.com/SharpAI/mlx-swift\.git".*|\.package(path: "../../mlx-swift"),|' SwiftLM/mlx-swift-lm/Package.swift
sed -i '' -E 's|\.package\(url: "https://github.com/ml-explore/mlx-swift\.git".*|\.package(path: "../../mlx-swift"),|' SwiftLM/mlx-swift-lm/Package.swift
- name: Build SwiftLM
run: |
cd SwiftLM
swift build -c release
- name: Install MLX Metal library (matching pinned version)
run: |
# Extract the exact mlx-swift version pinned in SwiftLM/Package.swift
# and install the matching Python mlx wheel — it ships the same metallib
PINNED=$(grep -E 'mlx-swift.*exact:' SwiftLM/Package.swift | grep -oE '"[0-9]+\.[0-9]+\.[0-9]+"' | tr -d '"' | head -1)
echo "SwiftLM pins mlx-swift at: ${PINNED:-latest}"
python3 -m venv /tmp/mlx_venv
if [ -n "$PINNED" ]; then
/tmp/mlx_venv/bin/pip install --quiet "mlx==$PINNED" || \
/tmp/mlx_venv/bin/pip install --quiet mlx # fallback to latest
else
/tmp/mlx_venv/bin/pip install --quiet mlx
fi
MLX_LIB=$(find /tmp/mlx_venv -name "mlx.metallib" | head -1)
echo "Found metallib: $MLX_LIB"
cp "$MLX_LIB" SwiftLM/.build/release/mlx.metallib
echo "Installed mlx.metallib -> SwiftLM/.build/release/"
- name: Run Speculative Decoding Tests
run: |
cd SwiftLM
bash tests/test-speculative-eval.sh