1name: Swift
2
3on:
4 push:
5 branches: [ main ]
6 pull_request:
7 branches: [ main ]
8
9jobs:
10 build:
11 name: Build SophaxChatCore
12 runs-on: macos-15
13
14 steps:
15 - name: Checkout
16 uses: actions/checkout@v4
17
18 - name: Select Xcode
19 run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
20
21 - name: Show Swift version
22 run: swift --version
23
24 # ── Rust / MLS XCFramework ──────────────────────────────────────────────
25 # CI builds the macOS arm64 slice only (native — no cross-compilation).
26 # The UniFFI-generated header (sophax_mlsFFI.h) is already committed,
27 # so we skip the bindgen step and just assemble the XCFramework.
28
29 - name: Install Rust stable
30 uses: dtolnay/rust-toolchain@stable
31
32 - name: Cache Rust build artefacts
33 uses: actions/cache@v4
34 with:
35 path: rust/target
36 key: rust-macos-arm64-${{ hashFiles('rust/Cargo.lock') }}
37 restore-keys: rust-macos-arm64-
38
39 - name: Build mls-rs (macOS arm64, native)
40 run: |
41 cd rust
42 cargo build --release --lib --target aarch64-apple-darwin
43
44 - name: Assemble XCFramework (macOS slice only)
45 run: |
46 HEADERS="rust/target/headers-ci"
47 mkdir -p "$HEADERS" Frameworks
48
49 # Headers are committed — copy from Generated dir
50 cp Sources/SophaxChatCore/MLS/Generated/sophax_mlsFFI.h "$HEADERS/"
51 cp Sources/SophaxChatCore/MLS/Generated/sophax_mlsFFI.modulemap "$HEADERS/module.modulemap"
52
53 xcodebuild -create-xcframework \
54 -library rust/target/aarch64-apple-darwin/release/libsophax_mls.a \
55 -headers "$HEADERS" \
56 -output Frameworks/SophaxMLS.xcframework
57
58 # ── Swift ───────────────────────────────────────────────────────────────
59
60 - name: Build core library
61 run: swift build -c release
62
63 - name: Run tests
64 run: swift test
65 continue-on-error: true # XCTest host app tests require physical device