Skip to content

VoiceStudio is the open-source, fully-local ElevenLabs alternative — voice cloning, voice design, video dubbing, dictation, transcription & audiobook creation in 646 languages.

ci(ios): save native runtimes before app and simulator validation

debpalash94a79641fffd
diff --git a/.github/workflows/mobile-release.yml b/.github/workflows/mobile-release.yml
index 6d5c34d84..8eea22c63 100644
--- a/.github/workflows/mobile-release.yml
+++ b/.github/workflows/mobile-release.yml
@@ -106,8 +106,9 @@ jobs:
with:
persist-credentials: false
- - name: Cache native runtimes
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
+ - name: Restore native runtimes
+ id: native-cache
+ uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: mobile/native/ios/build
key: ios-native-${{ hashFiles('mobile/native/pins.json', 'mobile/native/ios/**', '!mobile/native/ios/build/**') }}
@@ -119,6 +120,13 @@ jobs:
brew install cmake ninja 2>/dev/null || true
bash mobile/native/ios/build.sh ios
+ - name: Save native runtimes
+ if: steps.native-cache.outputs.cache-hit != 'true'
+ uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
+ with:
+ path: mobile/native/ios/build
+ key: ${{ steps.native-cache.outputs.cache-primary-key }}
+
- name: Generate Xcode project
run: |
brew install xcodegen
diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml
index 51bdd73fa..618ae6c82 100644
--- a/.github/workflows/mobile.yml
+++ b/.github/workflows/mobile.yml
@@ -103,8 +103,9 @@ jobs:
# iOS xcframeworks for the pinned on-device runtimes (sherpa-onnx, onnxruntime,
# llama.cpp, omnivoice.cpp); needs Xcode, so it only runs here.
- - name: Cache native runtimes
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
+ - name: Restore native runtimes
+ id: native-cache
+ uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: mobile/native/ios/build
key: ios-native-${{ hashFiles('mobile/native/pins.json', 'mobile/native/ios/**', '!mobile/native/ios/build/**') }}
@@ -117,6 +118,14 @@ jobs:
brew install cmake ninja 2>/dev/null || true
bash mobile/native/ios/build.sh ios
+ # Preserve a successful native build even if a later simulator or app step fails.
+ - name: Save native runtimes
+ if: steps.native-cache.outputs.cache-hit != 'true'
+ uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
+ with:
+ path: mobile/native/ios/build
+ key: ${{ steps.native-cache.outputs.cache-primary-key }}
+
- name: Generate Xcode project
run: |
brew install xcodegen
diff --git a/tests/test_ios_testflight.py b/tests/test_ios_testflight.py
index 83174ec75..437a2a3c0 100644
--- a/tests/test_ios_testflight.py
+++ b/tests/test_ios_testflight.py
@@ -129,3 +129,17 @@ def test_mobile_ci_builds_ios_with_the_upload_toolchain():
assert mobile["jobs"]["ios"]["runs-on"] == load_workflow()["jobs"]["testflight"]["runs-on"]
release = yaml.load((ROOT / ".github/workflows/mobile-release.yml").read_text(), Loader=yaml.BaseLoader)
assert release["jobs"]["ios"]["runs-on"] == load_workflow()["jobs"]["testflight"]["runs-on"]
+
+
[email protected]("filename", ["mobile.yml", "mobile-release.yml"])
+def test_native_runtime_cache_survives_later_app_or_ui_failures(filename):
+ workflow = yaml.load((ROOT / ".github/workflows" / filename).read_text(), Loader=yaml.BaseLoader)
+ steps = workflow["jobs"]["ios"]["steps"]
+ restore = next(step for step in steps if step.get("uses", "").startswith("actions/cache/restore@"))
+ save = next(step for step in steps if step.get("uses", "").startswith("actions/cache/save@"))
+ build = next(i for i, step in enumerate(steps) if "bash mobile/native/ios/build.sh ios" in step.get("run", ""))
+ generate = next(i for i, step in enumerate(steps) if "xcodegen generate" in step.get("run", ""))
+ assert build < steps.index(save) < generate
+ assert "if" not in steps[build] # Cache hits still need generated headers restored.
+ assert save["with"]["path"] == restore["with"]["path"]
+ assert save["with"]["key"] == "${{ steps." + restore["id"] + ".outputs.cache-primary-key }}"