forked from ml-explore/mlx-swift
-
Notifications
You must be signed in to change notification settings - Fork 3
65 lines (55 loc) · 2.42 KB
/
downstream_integration.yml
File metadata and controls
65 lines (55 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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