forked from ml-explore/mlx-swift-lm
-
Notifications
You must be signed in to change notification settings - Fork 9
144 lines (119 loc) · 4.7 KB
/
Copy pathci.yml
File metadata and controls
144 lines (119 loc) · 4.7 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build-and-test:
name: Build and Test (macOS 15)
runs-on: macos-15
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Metal Toolchain
run: xcodebuild -downloadComponent MetalToolchain || true
- name: Cache Swift packages
uses: actions/cache@v4
with:
path: .build
key: ${{ runner.os }}-spm-v2-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-v2-
- name: Clear stale module cache
run: find .build -type d -name ModuleCache -exec rm -rf {} + 2>/dev/null || true
- name: Checkout SharpAI/mlx-swift
uses: actions/checkout@v4
with:
repository: SharpAI/mlx-swift
path: mlx-swift
- name: Redirect mlx-swift dependency to local checkout
run: |
sed -i '' -E 's|\.package\(url: "https://github.com/SharpAI/mlx-swift\.git".*|\.package(path: "./mlx-swift"),|' Package.swift
sed -i '' -E 's|\.package\(url: "https://github.com/ml-explore/mlx-swift\.git".*|\.package(path: "./mlx-swift"),|' Package.swift
- name: Resolve dependencies
run: swift package resolve
- name: Build (Release)
run: swift build -c release -Xswiftc -enable-testing --build-tests
- name: Install MLX Metal library
run: |
python3 -m venv /tmp/mlx_venv
/tmp/mlx_venv/bin/pip install --quiet mlx
MLX_LIB=$(find /tmp/mlx_venv -name "mlx.metallib" | head -n 1)
# Copy to build root and release root
cp $MLX_LIB .build/release/ 2>/dev/null || true
cp $MLX_LIB ./ 2>/dev/null || true
# Find the xctest bundle's MacOS directory and put it right next to the test runner binary
find .build -type d -name "MacOS" -exec cp $MLX_LIB {}/ \; 2>/dev/null || true
# Also put it in Resources just in case
find .build -type d -name "Resources" -exec cp $MLX_LIB {}/ \; 2>/dev/null || true
# Aggressive: put it next to any executable in the release dir
find .build -type f -executable -exec cp $MLX_LIB $(dirname "{}")/ \; 2>/dev/null || true
- name: Run Library Tests (Metal Accelerated)
run: swift test -c release --skip-build
- name: Gemma 4 PLE Stabilization Gate
run: |
# Verify PLE signal stability with full kernel support
swift test -c release --filter Gemma4StabilizationTests --skip-build
- name: Speculative Decoding Protection Gate
run: |
# Ensure speculative decoding parity and cache integrity are never regressed
swift test -c release --filter SpeculativeDecodingTests --skip-build
- name: High-Rigor Architectural Parity (Gemma 4)
run: |
# Verify Gemma 4 Gated Residuals and PLE math integrity
swift test -c release --filter Gemma4Tests --skip-build
- name: Performance & Memory Ceiling Audit (8GB Target)
run: |
# Enforce 6GB RSS limit and throughput baselines
swift test -c release --filter PerformanceRegressionTests --skip-build
- name: Upload test results on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: library-test-results
path: .build/artifacts/
retention-days: 7
integration-test:
name: Build & Test SwiftLM Integration
runs-on: macos-15
steps:
- name: Checkout mlx-swift-lm (this repository)
uses: actions/checkout@v4
with:
path: mlx-swift-lm
submodules: recursive
- name: Checkout SwiftLM
uses: actions/checkout@v4
with:
repository: SharpAI/SwiftLM
path: SwiftLM
submodules: recursive
- name: Redirect Dependencies to Local Form
run: |
cd SwiftLM
# Replace the local submodule with the actively checked out code
rm -rf mlx-swift-lm
cp -r ../mlx-swift-lm .
- name: Build SwiftLM
run: |
cd SwiftLM
swift build -c release
- name: Install MLX Metal library
run: |
cd SwiftLM
python3 -m venv /tmp/mlx_venv
/tmp/mlx_venv/bin/pip install --quiet mlx
MLX_LIB=$(find /tmp/mlx_venv -name "mlx.metallib" | head -n 1)
cp $MLX_LIB .build/release/ 2>/dev/null || true
- name: Run Speculative Decoding Tests
run: |
cd SwiftLM
bash tests/test-speculative-eval.sh