@ondeinference / onde / commits / d29a196

Add cross-compile CI for all platforms and fix TokenSource for Linux

- Add cross-compile jobs for macOS (arm64, x86_64), Linux, Android, and Windows to CI - Fix TokenSource import for Linux in token.rs to enable HuggingFace token resolution on Linux

keypair34 committed Apr 24, 2026 at 11:38 UTC d29a1965b29cd9dbfbda3ae67876e7e75adadfb3
2 files changed +108 -1
.github/workflows/ci.yml
+106 -1
@@ -60,7 +60,45 @@ jobs:
60 - uses: Swatinem/rust-cache@v2
61 - run: cargo test --lib
62
63 - # ── Cross-compile checks for all Apple platforms ──────────────────────────
63 + # ── Cross-compile checks for Darwin platforms (highest priority) ─────────
64 + check-macos-arm64:
65 + name: Check (macOS arm64)
66 + runs-on: macos-26
67 + env:
68 + GRESIQ_API_KEY_DEV: ${{ secrets.GRESIQ_API_KEY_DEV }}
69 + GRESIQ_API_SECRET_DEV: ${{ secrets.GRESIQ_API_SECRET_DEV }}
70 + GRESIQ_API_KEY_PRODUCTION: ${{ secrets.GRESIQ_API_KEY_PRODUCTION }}
71 + GRESIQ_API_SECRET_PRODUCTION: ${{ secrets.GRESIQ_API_SECRET_PRODUCTION }}
72 + HF_TOKEN: ${{ secrets.HF_TOKEN }}
73 + steps:
74 + - uses: actions/checkout@v6
75 + - uses: dtolnay/rust-toolchain@stable
76 + with:
77 + targets: aarch64-apple-darwin
78 + - uses: Swatinem/rust-cache@v2
79 + with:
80 + key: macos-arm64
81 + - run: cargo check --target aarch64-apple-darwin
82 +
83 + check-macos-intel:
84 + name: Check (macOS x86_64)
85 + runs-on: macos-26
86 + env:
87 + GRESIQ_API_KEY_DEV: ${{ secrets.GRESIQ_API_KEY_DEV }}
88 + GRESIQ_API_SECRET_DEV: ${{ secrets.GRESIQ_API_SECRET_DEV }}
89 + GRESIQ_API_KEY_PRODUCTION: ${{ secrets.GRESIQ_API_KEY_PRODUCTION }}
90 + GRESIQ_API_SECRET_PRODUCTION: ${{ secrets.GRESIQ_API_SECRET_PRODUCTION }}
91 + HF_TOKEN: ${{ secrets.HF_TOKEN }}
92 + steps:
93 + - uses: actions/checkout@v6
94 + - uses: dtolnay/rust-toolchain@stable
95 + with:
96 + targets: x86_64-apple-darwin
97 + - uses: Swatinem/rust-cache@v2
98 + with:
99 + key: macos-intel
100 + - run: cargo check --target x86_64-apple-darwin
101 +
102 check-ios:
103 name: Check (iOS device)
104 runs-on: macos-26
@@ -212,3 +250,70 @@ jobs:
250 with:
251 key: watchos-sim
252 - run: cargo +nightly check -Z build-std --target aarch64-apple-watchos-sim
253 +
254 + # ── Cross-compile checks for Unix-family platforms ────────────────────────
255 + check-linux:
256 + name: Check (Linux x86_64)
257 + runs-on: ubuntu-latest
258 + env:
259 + GRESIQ_API_KEY_DEV: ${{ secrets.GRESIQ_API_KEY_DEV }}
260 + GRESIQ_API_SECRET_DEV: ${{ secrets.GRESIQ_API_SECRET_DEV }}
261 + GRESIQ_API_KEY_PRODUCTION: ${{ secrets.GRESIQ_API_KEY_PRODUCTION }}
262 + GRESIQ_API_SECRET_PRODUCTION: ${{ secrets.GRESIQ_API_SECRET_PRODUCTION }}
263 + HF_TOKEN: ${{ secrets.HF_TOKEN }}
264 + steps:
265 + - uses: actions/checkout@v6
266 + - uses: dtolnay/rust-toolchain@stable
267 + with:
268 + targets: x86_64-unknown-linux-gnu
269 + - uses: Swatinem/rust-cache@v2
270 + with:
271 + key: linux-x86_64
272 + - run: cargo check --target x86_64-unknown-linux-gnu
273 +
274 + check-android:
275 + name: Check (Android arm64)
276 + runs-on: ubuntu-latest
277 + env:
278 + GRESIQ_API_KEY_DEV: ${{ secrets.GRESIQ_API_KEY_DEV }}
279 + GRESIQ_API_SECRET_DEV: ${{ secrets.GRESIQ_API_SECRET_DEV }}
280 + GRESIQ_API_KEY_PRODUCTION: ${{ secrets.GRESIQ_API_KEY_PRODUCTION }}
281 + GRESIQ_API_SECRET_PRODUCTION: ${{ secrets.GRESIQ_API_SECRET_PRODUCTION }}
282 + HF_TOKEN: ${{ secrets.HF_TOKEN }}
283 + CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER: aarch64-linux-android34-clang
284 + CC_aarch64_linux_android: aarch64-linux-android34-clang
285 + AR_aarch64_linux_android: llvm-ar
286 + steps:
287 + - uses: actions/checkout@v6
288 + - uses: dtolnay/rust-toolchain@stable
289 + with:
290 + targets: aarch64-linux-android
291 + - uses: android-actions/setup-android@v3
292 + - name: Configure Android NDK toolchain
293 + shell: bash
294 + run: |
295 + echo "${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin" >> "$GITHUB_PATH"
296 + - uses: Swatinem/rust-cache@v2
297 + with:
298 + key: android-arm64
299 + - run: cargo check --target aarch64-linux-android
300 +
301 + # ── Cross-compile checks for Windows (lowest priority) ────────────────────
302 + check-windows:
303 + name: Check (Windows x86_64)
304 + runs-on: windows-latest
305 + env:
306 + GRESIQ_API_KEY_DEV: ${{ secrets.GRESIQ_API_KEY_DEV }}
307 + GRESIQ_API_SECRET_DEV: ${{ secrets.GRESIQ_API_SECRET_DEV }}
308 + GRESIQ_API_KEY_PRODUCTION: ${{ secrets.GRESIQ_API_KEY_PRODUCTION }}
309 + GRESIQ_API_SECRET_PRODUCTION: ${{ secrets.GRESIQ_API_SECRET_PRODUCTION }}
310 + HF_TOKEN: ${{ secrets.HF_TOKEN }}
311 + steps:
312 + - uses: actions/checkout@v6
313 + - uses: dtolnay/rust-toolchain@stable
314 + with:
315 + targets: x86_64-pc-windows-msvc
316 + - uses: Swatinem/rust-cache@v2
317 + with:
318 + key: windows-x86_64
319 + - run: cargo check --target x86_64-pc-windows-msvc
src/inference/token.rs
+2
@@ -40,6 +40,7 @@
40 target_os = "visionos",
41 target_os = "watchos",
42 target_os = "windows",
43 + target_os = "linux",
44 target_os = "android"
45 ))]
46 use mistralrs::TokenSource;
@@ -100,6 +101,7 @@ mod tests {
101 target_os = "visionos",
102 target_os = "watchos",
103 target_os = "windows",
104 + target_os = "linux",
105 target_os = "android"
106 ))]
107 fn token_source_returns_valid_variant() {