ci: add Android (aarch64) and iOS (arm64) build jobs with lint and tests #27
Workflow file for this run
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: CI | |
| on: | |
| push: | |
| branches: ["**"] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| RUSTC_WRAPPER: "" | |
| jobs: | |
| test: | |
| name: Test (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo registry & build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: ${{ runner.os }}-cargo- | |
| - name: Build (CPU, all models) | |
| run: cargo build -p cake-core -p cake-cli | |
| - name: Unit tests (cake-core lib) | |
| run: cargo test -p cake-core --lib | |
| - name: Unit tests (cake-core external) | |
| run: cargo test -p cake-core --test unit | |
| - name: Protocol tests | |
| run: cargo test -p cake-core --test protocol | |
| build-android: | |
| name: Build (Android aarch64) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| env: | |
| ANDROID_NDK_VERSION: r27c | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-linux-android | |
| components: clippy | |
| - name: Set up Android NDK ${{ env.ANDROID_NDK_VERSION }} | |
| id: setup-ndk | |
| uses: nttld/setup-ndk@v1 | |
| with: | |
| ndk-version: ${{ env.ANDROID_NDK_VERSION }} | |
| add-to-path: false | |
| - name: Cache cargo registry & build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: android-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: android-cargo- | |
| - name: Cache cargo-ndk binary | |
| id: cache-cargo-ndk | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/bin/cargo-ndk | |
| key: cargo-ndk-bin-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Install cargo-ndk | |
| if: steps.cache-cargo-ndk.outputs.cache-hit != 'true' | |
| run: cargo install cargo-ndk --locked | |
| - name: Build cake-mobile (Android aarch64) | |
| env: | |
| ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
| run: cargo ndk -t aarch64-linux-android build -p cake-mobile | |
| - name: Clippy (cake-core + cake-mobile, Android) | |
| env: | |
| ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
| run: cargo ndk -t aarch64-linux-android clippy -p cake-core --lib --no-default-features --features "llama,qwen2,qwen3_5" -p cake-mobile -- -D warnings | |
| - name: Compile tests (cake-core lib, Android) | |
| env: | |
| ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
| run: cargo ndk -t aarch64-linux-android test -p cake-core --lib --no-default-features --features "llama,qwen2,qwen3_5,qwen3,qwen3_moe,qwen3_5_moe,phi4,mistral,gemma3,falcon3,olmo2,exaone4,flux,vibevoice,luxtts" --no-run | |
| - name: Compile tests (cake-core unit, Android) | |
| env: | |
| ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
| run: cargo ndk -t aarch64-linux-android test -p cake-core --test unit --no-default-features --features "llama,qwen2,qwen3_5,qwen3,qwen3_moe,qwen3_5_moe,phi4,mistral,gemma3,falcon3,olmo2,exaone4,flux,vibevoice,luxtts" --no-run | |
| - name: Compile tests (cake-core protocol, Android) | |
| env: | |
| ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
| run: cargo ndk -t aarch64-linux-android test -p cake-core --test protocol --no-default-features --features "llama,qwen2,qwen3_5,qwen3,qwen3_moe,qwen3_5_moe,phi4,mistral,gemma3,falcon3,olmo2,exaone4,flux,vibevoice,luxtts" --no-run | |
| build-ios: | |
| name: Build (iOS arm64) | |
| runs-on: macos-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-apple-ios | |
| components: clippy | |
| - name: Cache cargo registry & build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ios-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: ios-cargo- | |
| - name: Build cake-mobile (iOS arm64) | |
| run: cargo build --target=aarch64-apple-ios -p cake-mobile --features metal | |
| - name: Clippy (cake-core + cake-mobile, iOS) | |
| run: cargo clippy --target=aarch64-apple-ios -p cake-core --lib --no-default-features --features "llama,qwen2,qwen3_5,metal" -p cake-mobile --features metal -- -D warnings | |
| - name: Compile tests (cake-core lib, iOS) | |
| run: cargo test --target=aarch64-apple-ios -p cake-core --lib --no-default-features --features "llama,qwen2,qwen3_5,qwen3,qwen3_moe,qwen3_5_moe,phi4,mistral,gemma3,falcon3,olmo2,exaone4,flux,vibevoice,luxtts,metal" --no-run | |
| - name: Compile tests (cake-core unit, iOS) | |
| run: cargo test --target=aarch64-apple-ios -p cake-core --test unit --no-default-features --features "llama,qwen2,qwen3_5,qwen3,qwen3_moe,qwen3_5_moe,phi4,mistral,gemma3,falcon3,olmo2,exaone4,flux,vibevoice,luxtts,metal" --no-run | |
| - name: Compile tests (cake-core protocol, iOS) | |
| run: cargo test --target=aarch64-apple-ios -p cake-core --test protocol --no-default-features --features "llama,qwen2,qwen3_5,qwen3,qwen3_moe,qwen3_5_moe,phi4,mistral,gemma3,falcon3,olmo2,exaone4,flux,vibevoice,luxtts,metal" --no-run | |
| clippy: | |
| name: Clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| - name: Cache cargo registry & build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: ${{ runner.os }}-cargo-clippy- | |
| - name: Clippy (cake-core + cake-cli) | |
| run: cargo clippy -p cake-core --lib --tests -p cake-cli -- -D warnings |