-
Notifications
You must be signed in to change notification settings - Fork 344
460 lines (384 loc) · 16 KB
/
commons-release.yml
File metadata and controls
460 lines (384 loc) · 16 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
name: Build and Release RACommons
# =============================================================================
# RACommons Release Workflow
#
# Builds RACommons.xcframework - the standalone infrastructure library.
# This does NOT build backends (LlamaCPP, ONNX, WhisperCPP) - those are
# released from runanywhere-core repository.
#
# Trigger:
# - Tag push: commons-v*
# - Manual workflow_dispatch
# =============================================================================
on:
push:
tags:
- 'commons-v*'
workflow_call:
inputs:
version:
description: 'Version to release (e.g., 0.2.0)'
required: true
type: string
dry_run:
description: 'Dry run (build only, do not publish)'
required: false
default: false
type: boolean
skip_publish:
description: 'Skip creating individual release (for unified release)'
required: false
default: false
type: boolean
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 0.2.0)'
required: true
type: string
dry_run:
description: 'Dry run (build only, do not publish)'
required: false
default: false
type: boolean
permissions:
contents: read
env:
COMMONS_DIR: sdk/runanywhere-commons
jobs:
# ===========================================================================
# Build iOS XCFramework
# ===========================================================================
build-ios:
name: Build iOS
runs-on: macos-14
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Determine Version
id: version
run: |
# Handle workflow_call (from release-all.yml) and workflow_dispatch
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
elif [[ "$GITHUB_REF" == refs/tags/commons-v* ]]; then
VERSION="${GITHUB_REF#refs/tags/commons-v}"
elif [[ "$GITHUB_REF" == refs/tags/v* ]]; then
VERSION="${GITHUB_REF#refs/tags/v}"
else
VERSION="0.0.0-$(git rev-parse --short HEAD)"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Building RACommons v$VERSION"
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.4'
- name: Install Dependencies
run: brew install cmake ninja
- name: Setup Development Config
working-directory: ${{ env.COMMONS_DIR }}
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }}
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
run: |
CONFIG_FILE="src/infrastructure/network/development_config.cpp"
CLEAN_URL=$(printf '%s' "$SUPABASE_URL" | tr -d '\n\r')
CLEAN_KEY=$(printf '%s' "$SUPABASE_ANON_KEY" | tr -d '\n\r')
CLEAN_TOKEN=$(printf '%s' "${BUILD_TOKEN:-bt_release_build}" | tr -d '\n\r')
cat > "$CONFIG_FILE" << CONFIGEOF
/**
* @file development_config.cpp
* @brief Development mode configuration with credentials from CI secrets
*/
#include <cstring>
#include "rac/core/rac_logger.h"
#include "rac/infrastructure/network/rac_dev_config.h"
namespace {
constexpr const char* SUPABASE_URL = "${CLEAN_URL}";
constexpr const char* SUPABASE_ANON_KEY = "${CLEAN_KEY}";
constexpr const char* BUILD_TOKEN = "${CLEAN_TOKEN}";
constexpr const char* SENTRY_DSN = nullptr;
} // anonymous namespace
extern "C" {
bool rac_dev_config_is_available(void) {
if (SUPABASE_URL == nullptr || SUPABASE_ANON_KEY == nullptr) return false;
if (std::strlen(SUPABASE_URL) == 0 || std::strlen(SUPABASE_ANON_KEY) == 0) return false;
if (std::strstr(SUPABASE_URL, "YOUR_") != nullptr) return false;
if (std::strstr(SUPABASE_ANON_KEY, "YOUR_") != nullptr) return false;
return true;
}
const char* rac_dev_config_get_supabase_url(void) {
return SUPABASE_URL;
}
const char* rac_dev_config_get_supabase_key(void) {
return SUPABASE_ANON_KEY;
}
const char* rac_dev_config_get_build_token(void) {
return BUILD_TOKEN;
}
const char* rac_dev_config_get_sentry_dsn(void) {
return SENTRY_DSN;
}
bool rac_dev_config_has_supabase(void) {
return rac_dev_config_is_available();
}
bool rac_dev_config_has_build_token(void) {
return BUILD_TOKEN != nullptr && std::strlen(BUILD_TOKEN) > 0;
}
} // extern "C"
CONFIGEOF
echo "=== Generated development_config.cpp ==="
head -20 "$CONFIG_FILE"
- name: Build RACommons XCFramework
working-directory: ${{ env.COMMONS_DIR }}
run: |
chmod +x scripts/build-ios.sh
./scripts/build-ios.sh --skip-backends --release --package
- name: List Artifacts
working-directory: ${{ env.COMMONS_DIR }}
run: |
echo "=== Build Artifacts ==="
ls -la dist/
if [ -d dist/packages ]; then
echo ""
echo "=== Packages ==="
ls -la dist/packages/
fi
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: racommons-ios-${{ steps.version.outputs.version }}
path: |
${{ env.COMMONS_DIR }}/dist/RACommons.xcframework
${{ env.COMMONS_DIR }}/dist/packages/*.zip
${{ env.COMMONS_DIR }}/dist/packages/*.sha256
retention-days: 30
# ===========================================================================
# Build Android Libraries
# ===========================================================================
build-android:
name: Build Android (${{ matrix.abi }})
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
strategy:
fail-fast: false
matrix:
abi: [arm64-v8a, armeabi-v7a, x86_64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Determine Version
id: version
run: |
# Handle workflow_call (from release-all.yml) and workflow_dispatch
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
elif [[ "$GITHUB_REF" == refs/tags/commons-v* ]]; then
VERSION="${GITHUB_REF#refs/tags/commons-v}"
elif [[ "$GITHUB_REF" == refs/tags/v* ]]; then
VERSION="${GITHUB_REF#refs/tags/v}"
else
VERSION="0.0.0-$(git rev-parse --short HEAD)"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Setup NDK
run: |
NDK_VERSION="27.0.12077973"
echo "y" | sdkmanager --install "ndk;${NDK_VERSION}" --sdk_root=${ANDROID_SDK_ROOT}
echo "ANDROID_NDK_HOME=${ANDROID_SDK_ROOT}/ndk/${NDK_VERSION}" >> $GITHUB_ENV
- name: Setup Development Config
working-directory: ${{ env.COMMONS_DIR }}
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }}
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
run: |
CONFIG_FILE="src/infrastructure/network/development_config.cpp"
CLEAN_URL=$(printf '%s' "$SUPABASE_URL" | tr -d '\n\r')
CLEAN_KEY=$(printf '%s' "$SUPABASE_ANON_KEY" | tr -d '\n\r')
CLEAN_TOKEN=$(printf '%s' "${BUILD_TOKEN:-bt_release_build}" | tr -d '\n\r')
cat > "$CONFIG_FILE" << CONFIGEOF
/**
* @file development_config.cpp
* @brief Development mode configuration with credentials from CI secrets
*/
#include <cstring>
#include "rac/core/rac_logger.h"
#include "rac/infrastructure/network/rac_dev_config.h"
namespace {
constexpr const char* SUPABASE_URL = "${CLEAN_URL}";
constexpr const char* SUPABASE_ANON_KEY = "${CLEAN_KEY}";
constexpr const char* BUILD_TOKEN = "${CLEAN_TOKEN}";
constexpr const char* SENTRY_DSN = nullptr;
} // anonymous namespace
extern "C" {
bool rac_dev_config_is_available(void) {
if (SUPABASE_URL == nullptr || SUPABASE_ANON_KEY == nullptr) return false;
if (std::strlen(SUPABASE_URL) == 0 || std::strlen(SUPABASE_ANON_KEY) == 0) return false;
if (std::strstr(SUPABASE_URL, "YOUR_") != nullptr) return false;
if (std::strstr(SUPABASE_ANON_KEY, "YOUR_") != nullptr) return false;
return true;
}
const char* rac_dev_config_get_supabase_url(void) {
return SUPABASE_URL;
}
const char* rac_dev_config_get_supabase_key(void) {
return SUPABASE_ANON_KEY;
}
const char* rac_dev_config_get_build_token(void) {
return BUILD_TOKEN;
}
const char* rac_dev_config_get_sentry_dsn(void) {
return SENTRY_DSN;
}
bool rac_dev_config_has_supabase(void) {
return rac_dev_config_is_available();
}
bool rac_dev_config_has_build_token(void) {
return BUILD_TOKEN != nullptr && std::strlen(BUILD_TOKEN) > 0;
}
} // extern "C"
CONFIGEOF
echo "=== Generated development_config.cpp for Android ==="
- name: Download Dependencies
working-directory: ${{ env.COMMONS_DIR }}
run: |
chmod +x scripts/android/download-sherpa-onnx.sh
# Force fresh download by removing any existing partial downloads
rm -rf third_party/sherpa-onnx-android
./scripts/android/download-sherpa-onnx.sh
# Verify required files exist
echo "=== Verifying downloaded files ==="
ls -la third_party/sherpa-onnx-android/ || echo "Directory not found!"
ls -la third_party/sherpa-onnx-android/jniLibs/ || echo "jniLibs not found!"
ls -la "third_party/sherpa-onnx-android/jniLibs/${{ matrix.abi }}/" || echo "ABI directory not found!"
# Check for required .so files
for lib in libsherpa-onnx-jni.so libsherpa-onnx-c-api.so libonnxruntime.so; do
if [ -f "third_party/sherpa-onnx-android/jniLibs/${{ matrix.abi }}/$lib" ]; then
echo "✅ Found: $lib"
else
echo "❌ Missing: $lib"
fi
done
- name: Build Android ${{ matrix.abi }}
working-directory: ${{ env.COMMONS_DIR }}
run: |
chmod +x scripts/build-android.sh
# Build all backends - ONNX (STT/TTS/VAD) + LlamaCPP (LLM)
./scripts/build-android.sh all ${{ matrix.abi }}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: racommons-android-${{ matrix.abi }}-${{ steps.version.outputs.version }}
path: |
${{ env.COMMONS_DIR }}/dist/android/
retention-days: 30
# ===========================================================================
# Publish Release
# ===========================================================================
publish:
name: Publish Release
needs: [build-ios, build-android]
# Skip if dry_run or skip_publish (for unified release)
if: |
inputs.dry_run != true &&
inputs.skip_publish != true
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download iOS Artifact
uses: actions/download-artifact@v4
with:
name: racommons-ios-${{ needs.build-ios.outputs.version }}
path: dist/ios
- name: Download Android Artifacts
uses: actions/download-artifact@v4
with:
pattern: racommons-android-*
path: dist/android-artifacts
merge-multiple: false
- name: Prepare Release Assets
run: |
VERSION="${{ needs.build-ios.outputs.version }}"
mkdir -p release-assets
if [ -d dist/ios/RACommons.xcframework ]; then
cd dist/ios
zip -r "../../release-assets/RACommons-ios-v${VERSION}.zip" RACommons.xcframework
cd ../../release-assets
shasum -a 256 "RACommons-ios-v${VERSION}.zip" > "RACommons-ios-v${VERSION}.zip.sha256"
cd ..
fi
mkdir -p android-combined/jniLibs
for dir in dist/android-artifacts/racommons-android-*/jniLibs/*/; do
if [ -d "$dir" ]; then
abi=$(basename "$dir")
mkdir -p "android-combined/jniLibs/${abi}"
cp -r "${dir}"* "android-combined/jniLibs/${abi}/" 2>/dev/null || true
echo "Copied libs for ${abi}: $(ls android-combined/jniLibs/${abi}/ 2>/dev/null | wc -l) files"
fi
done
HEADER_DIR=$(find dist/android-artifacts -name "include" -type d | head -1)
if [ -n "$HEADER_DIR" ]; then
cp -r "$HEADER_DIR" android-combined/
fi
cd android-combined
echo "=== Android Combined Contents ==="
find . -type f | head -20
zip -r "../release-assets/RACommons-android-v${VERSION}.zip" .
cd ../release-assets
shasum -a 256 "RACommons-android-v${VERSION}.zip" > "RACommons-android-v${VERSION}.zip.sha256"
echo "=== Release Assets ==="
ls -la
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: commons-v${{ needs.build-ios.outputs.version }}
name: RACommons v${{ needs.build-ios.outputs.version }}
files: |
release-assets/*.zip
release-assets/*.sha256
body: |
## RACommons v${{ needs.build-ios.outputs.version }}
Standalone infrastructure library for RunAnywhere SDKs.
### Contents
- Logging, error handling, and event tracking
- Service registry and provider infrastructure
- Model management (download strategies, storage)
- Platform backend (Apple Foundation Models, System TTS) - iOS/macOS only
### iOS/macOS
`RACommons-ios-v${{ needs.build-ios.outputs.version }}.zip`
- Contains `RACommons.xcframework`
### Android
`RACommons-android-v${{ needs.build-ios.outputs.version }}.zip`
- Contains `jniLibs/{abi}/librac_commons.so` (core library)
- Contains `jniLibs/{abi}/librunanywhere_jni.so` (JNI bridge for Kotlin SDK)
- Contains `include/` headers
### Note
Backend libraries (LlamaCPP, ONNX, WhisperCPP) are released separately from `runanywhere-core`.
### Verification
```bash
shasum -a 256 -c *.sha256
```
---
Built from runanywhere-sdks @ ${{ github.sha }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}