-
Notifications
You must be signed in to change notification settings - Fork 346
294 lines (246 loc) · 9.69 KB
/
commons-release.yml
File metadata and controls
294 lines (246 loc) · 9.69 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
name: Build and Release XCFrameworks
# =============================================================================
# This workflow builds modular XCFrameworks for iOS/macOS:
# - RACommons.xcframework (core commons library)
# - RABackendLlamaCPP.xcframework (LLM backend)
# - RABackendONNX.xcframework (STT/TTS/VAD backend)
#
# It downloads runanywhere-core source from the public runanywhere-binaries
# repository, builds the XCFrameworks, and publishes them.
#
# Trigger:
# - Tag push: commons-v*
# - Manual workflow_dispatch
#
# =============================================================================
on:
push:
tags:
- 'commons-v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 2.0.0)'
required: true
type: string
core_version:
description: 'runanywhere-core version to use (leave empty for latest)'
required: false
type: string
dry_run:
description: 'Dry run (build only, do not publish)'
required: false
default: false
type: boolean
env:
# Public binaries repository for publishing XCFrameworks
PUBLIC_REPO_OWNER: 'RunanywhereAI'
PUBLIC_REPO_NAME: 'runanywhere-binaries'
# Working directory for commons
COMMONS_DIR: sdk/runanywhere-commons
jobs:
# ===========================================================================
# Build iOS XCFrameworks
# ===========================================================================
build-ios:
name: Build iOS XCFrameworks
runs-on: macos-14
outputs:
version: ${{ steps.version.outputs.version }}
core_version: ${{ steps.core.outputs.core_version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Determine Version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="${GITHUB_REF#refs/tags/commons-v}"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Building version: $VERSION"
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.4'
- name: Install Dependencies
run: brew install cmake ninja
- name: Download runanywhere-core Source
id: core
working-directory: ${{ env.COMMONS_DIR }}
run: |
chmod +x scripts/download-core.sh
# Determine core version
if [ -n "${{ github.event.inputs.core_version }}" ]; then
CORE_VERSION="${{ github.event.inputs.core_version }}"
else
CORE_VERSION="0.1.1-dev.03aacf9"
fi
echo "Using core version: $CORE_VERSION"
echo "core_version=$CORE_VERSION" >> $GITHUB_OUTPUT
RUNANYWHERE_CORE_VERSION="$CORE_VERSION" ./scripts/download-core.sh
- name: Verify Downloads
working-directory: ${{ env.COMMONS_DIR }}
run: |
echo "=== Verifying Downloads ==="
# Check core source
if [ ! -f "third_party/runanywhere-core/CMakeLists.txt" ]; then
echo "ERROR: runanywhere-core not downloaded"
exit 1
fi
echo "✓ Core: $(cat third_party/runanywhere-core/DOWNLOADED_VERSION)"
# Check ONNX Runtime
if [ ! -d "third_party/onnxruntime-ios/onnxruntime.xcframework" ]; then
echo "ERROR: onnxruntime.xcframework not downloaded"
exit 1
fi
echo "✓ ONNX Runtime"
# Check Sherpa-ONNX
if [ ! -d "third_party/sherpa-onnx-ios/sherpa-onnx.xcframework" ]; then
echo "ERROR: sherpa-onnx.xcframework not downloaded"
exit 1
fi
echo "✓ Sherpa-ONNX"
echo ""
echo "=== third_party/ contents ==="
ls -la third_party/
- name: Setup Development Config
working-directory: ${{ env.COMMONS_DIR }}
run: |
# Create development_config.cpp from template (gitignored, contains placeholders)
cp src/infrastructure/network/development_config.cpp.template \
src/infrastructure/network/development_config.cpp
- name: Build iOS XCFrameworks
working-directory: ${{ env.COMMONS_DIR }}
run: |
chmod +x scripts/build-ios.sh
./scripts/build-ios.sh
- name: Package Release
working-directory: ${{ env.COMMONS_DIR }}
run: |
chmod +x scripts/package-release.sh
./scripts/package-release.sh ${{ steps.version.outputs.version }}
- name: List Artifacts
working-directory: ${{ env.COMMONS_DIR }}
run: |
echo "=== Build Artifacts ==="
ls -la dist/
echo ""
echo "=== XCFramework Sizes ==="
for xcf in dist/*.xcframework; do
if [ -d "$xcf" ]; then
size=$(du -sh "$xcf" | cut -f1)
echo " $(basename "$xcf"): $size"
fi
done
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: xcframeworks-${{ steps.version.outputs.version }}
path: |
${{ env.COMMONS_DIR }}/dist/*.xcframework.zip
${{ env.COMMONS_DIR }}/dist/*.zip
${{ env.COMMONS_DIR }}/dist/*.sha256
${{ env.COMMONS_DIR }}/dist/MANIFEST.md
retention-days: 30
# ===========================================================================
# Publish to runanywhere-binaries
# ===========================================================================
publish:
name: Publish to runanywhere-binaries
needs: build-ios
if: github.event.inputs.dry_run != 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: xcframeworks-${{ needs.build-ios.outputs.version }}
path: dist
- name: List Downloaded Artifacts
run: |
echo "=== Downloaded Artifacts ==="
ls -laR dist/
- name: Checkout Public Binaries Repo
uses: actions/checkout@v4
with:
repository: ${{ env.PUBLIC_REPO_OWNER }}/${{ env.PUBLIC_REPO_NAME }}
token: ${{ secrets.BINARY_REPO_PAT }}
path: public-repo
fetch-depth: 0
- name: Update Public Repository
run: |
VERSION="${{ needs.build-ios.outputs.version }}"
CORE_VERSION="${{ needs.build-ios.outputs.core_version }}"
cd public-repo
# Create releases directory
mkdir -p releases/commons-v${VERSION}
# Copy all XCFramework ZIPs (handle nested directory from artifact download)
find ../dist -name "*.zip" -exec cp {} releases/commons-v${VERSION}/ \; 2>/dev/null || true
find ../dist -name "*.sha256" -exec cp {} releases/commons-v${VERSION}/ \; 2>/dev/null || true
# Update version files
echo "${VERSION}" > LATEST_COMMONS_VERSION
# Git operations
git config user.name "GitHub Actions Bot"
git config user.email "actions@github.com"
git add -A
git commit -m "Release runanywhere-commons v${VERSION}
Built with runanywhere-core: ${CORE_VERSION}
XCFrameworks:
$(ls -1 releases/commons-v${VERSION}/*.zip 2>/dev/null | xargs -I {} basename {} || echo 'None')
" || echo "No changes to commit"
- name: Create Git Tag
run: |
VERSION="${{ needs.build-ios.outputs.version }}"
cd public-repo
git tag -a "commons-v${VERSION}" -m "runanywhere-commons v${VERSION}" 2>/dev/null || echo "Tag already exists"
- name: Push to Public Repository
run: |
cd public-repo
git push origin main --tags
env:
GITHUB_TOKEN: ${{ secrets.BINARY_REPO_PAT }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
repository: ${{ env.PUBLIC_REPO_OWNER }}/${{ env.PUBLIC_REPO_NAME }}
tag_name: commons-v${{ needs.build-ios.outputs.version }}
name: RunAnywhere Commons v${{ needs.build-ios.outputs.version }}
files: |
dist/**/*.zip
dist/**/*.sha256
body: |
## RunAnywhere Commons v${{ needs.build-ios.outputs.version }}
Modular XCFrameworks for iOS/macOS.
### XCFrameworks
| Framework | Description |
|-----------|-------------|
| `RACommons.xcframework` | Core commons library (service registry, model management) |
| `RABackendLlamaCPP.xcframework` | LLM backend (llama.cpp + Metal) |
| `RABackendONNX.xcframework` | STT/TTS/VAD backend (Sherpa-ONNX) |
### Swift Package Manager
Update your `Package.swift`:
```swift
.binaryTarget(
name: "RACommonsBinary",
url: "https://github.com/${{ env.PUBLIC_REPO_OWNER }}/${{ env.PUBLIC_REPO_NAME }}/releases/download/commons-v${{ needs.build-ios.outputs.version }}/RACommons-${{ needs.build-ios.outputs.version }}.zip",
checksum: "..."
),
```
### Requirements
- **ONNX Runtime**: `RABackendONNX` requires `onnxruntime.xcframework` (download separately)
- **Platforms**: iOS 17+, macOS 14+
### Verification
```bash
shasum -a 256 -c *.sha256
```
---
Built with runanywhere-core: ${{ needs.build-ios.outputs.core_version }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.BINARY_REPO_PAT }}