3 files changed
+274
-445
.github/workflows/release-crate.yml
-25
@@ -28,7 +28,6 @@ jobs:
28
publish_cli_sdk_pypi: ${{ steps.downstream.outputs.publish_cli_sdk_pypi }}
29
publish_cli_sdk_npm: ${{ steps.downstream.outputs.publish_cli_sdk_npm }}
30
publish_cli_sdk_gem: ${{ steps.downstream.outputs.publish_cli_sdk_gem }}
31
- publish_cli_sdk_swift: ${{ steps.downstream.outputs.publish_cli_sdk_swift }}
31
32
steps:
33
- name: Checkout
@@ -129,17 +128,14 @@ jobs:
128
publish_cli_sdk_pypi="$(jq -r 'map(.name) | any(. == "smbcloud-auth-sdk-py" or . == "smbcloud-auth-sdk" or . == "smbcloud-model" or . == "smbcloud-network")' plan.json)"
129
publish_cli_sdk_npm="$(jq -r 'map(.name) | any(. == "smbcloud-auth-sdk-wasm" or . == "smbcloud-auth-sdk" or . == "smbcloud-network" or . == "smbcloud-networking")' plan.json)"
130
publish_cli_sdk_gem="$(jq -r 'map(.name) | any(. == "smbcloud-auth-sdk" or . == "smbcloud-model" or . == "smbcloud-network")' plan.json)"
132
- publish_cli_sdk_swift="$(jq -r 'map(.name) | any(. == "smbcloud-auth-sdk" or . == "smbcloud-auth-sdk-apple" or . == "smbcloud-model" or . == "smbcloud-network")' plan.json)"
131
132
echo "publish_cli_sdk_pypi=${publish_cli_sdk_pypi}" >> "$GITHUB_OUTPUT"
133
echo "publish_cli_sdk_npm=${publish_cli_sdk_npm}" >> "$GITHUB_OUTPUT"
134
echo "publish_cli_sdk_gem=${publish_cli_sdk_gem}" >> "$GITHUB_OUTPUT"
137
- echo "publish_cli_sdk_swift=${publish_cli_sdk_swift}" >> "$GITHUB_OUTPUT"
135
136
echo "SDK PyPI trigger: ${publish_cli_sdk_pypi}"
137
echo "SDK npm trigger: ${publish_cli_sdk_npm}"
138
echo "SDK gem trigger: ${publish_cli_sdk_gem}"
142
- echo "SDK Swift trigger: ${publish_cli_sdk_swift}"
139
140
- name: Publish workspace crates to crates.io
141
if: steps.plan.outputs.count != '0'
@@ -283,24 +279,3 @@ jobs:
279
tag: '${{ needs.publish.outputs.tag }}'
280
}
281
})
286
-
287
- dispatch-sdk-swift:
288
- name: Trigger SDK Swift release
289
- needs: publish
290
- if: needs.publish.outputs.publish_cli_sdk_swift == 'true'
291
- runs-on: ubuntu-latest
292
-
293
- steps:
294
- - name: Trigger SDK Swift release workflow
295
- uses: actions/github-script@v7
296
- with:
297
- script: |
298
- await github.rest.actions.createWorkflowDispatch({
299
- owner: context.repo.owner,
300
- repo: context.repo.repo,
301
- workflow_id: 'release-sdk-swift.yml',
302
- ref: '${{ needs.publish.outputs.tag }}',
303
- inputs: {
304
- tag: '${{ needs.publish.outputs.tag }}'
305
- }
306
- })
.github/workflows/release-sdk-swift.yml
deleted
-420
@@ -1,420 +0,0 @@
1
-name: SDK Swift Release
2
-
3
-# Builds the Apple-platform XCFramework for the smbCloud Auth Swift package,
4
-# updates the standalone `smbcloud-auth-swift` repo, tags it with the release
5
-# version, and publishes the XCFramework zip as a GitHub Release asset.
6
-#
7
-# Required secrets:
8
-# SMBCLOUD_SWIFT_REPO_TOKEN — GitHub token/PAT with contents:write access to
9
-# smbcloudXYZ/smbcloud-auth-swift
10
-
11
-on:
12
- workflow_dispatch:
13
- inputs:
14
- tag:
15
- description: "Release tag (e.g. v0.4.1)"
16
- required: true
17
-
18
-permissions:
19
- contents: read
20
-
21
-env:
22
- CARGO_TERM_COLOR: always
23
- SWIFT_SDK_REPOSITORY: smbcloudXYZ/smbcloud-auth-swift
24
- SWIFT_XCFRAMEWORK_NAME: smbcloud_authFFI.xcframework
25
- SWIFT_XCFRAMEWORK_ZIP: smbcloud_authFFI.xcframework.zip
26
-
27
-jobs:
28
- publish-sdk-swift:
29
- name: Build and publish SmbCloudAuth Swift SDK
30
- runs-on: macos-26
31
-
32
- steps:
33
- - name: Checkout smbcloud-cli
34
- uses: actions/checkout@v6
35
- with:
36
- ref: ${{ github.event.inputs.tag || github.ref }}
37
-
38
- - name: Checkout smbcloud-auth-swift
39
- uses: actions/checkout@v6
40
- with:
41
- repository: ${{ env.SWIFT_SDK_REPOSITORY }}
42
- path: swift-sdk
43
- fetch-depth: 0
44
- token: ${{ secrets.SMBCLOUD_SWIFT_REPO_TOKEN }}
45
-
46
- - name: Set the release version
47
- shell: bash
48
- run: |
49
- if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
50
- release_version="${GITHUB_REF_NAME#v}"
51
- else
52
- release_version="${{ github.event.inputs.tag }}"
53
- release_version="${release_version#v}"
54
- fi
55
-
56
- echo "RELEASE_VERSION=${release_version}" >> "$GITHUB_ENV"
57
-
58
- - name: Prepare smbcloud-auth-swift working tree
59
- id: swift-repo
60
- shell: bash
61
- working-directory: swift-sdk
62
- run: |
63
- set -euo pipefail
64
-
65
- git fetch origin --tags
66
-
67
- default_branch="$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')"
68
- if [[ -z "${default_branch}" ]]; then
69
- echo "Failed to determine default branch for ${SWIFT_SDK_REPOSITORY}" >&2
70
- exit 1
71
- fi
72
-
73
- git checkout -B "${default_branch}" "origin/${default_branch}"
74
- echo "default_branch=${default_branch}" >> "$GITHUB_OUTPUT"
75
-
76
- - name: Read Rust toolchain
77
- shell: bash
78
- run: |
79
- rust_toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml | head -n 1)"
80
- if [[ -z "${rust_toolchain}" ]]; then
81
- echo "Failed to read Rust toolchain from rust-toolchain.toml" >&2
82
- exit 1
83
- fi
84
-
85
- echo "RUST_TOOLCHAIN=${rust_toolchain}" >> "$GITHUB_ENV"
86
-
87
- - name: Install stable Rust with Apple targets
88
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
89
- with:
90
- toolchain: ${{ env.RUST_TOOLCHAIN }}
91
- targets: aarch64-apple-ios,aarch64-apple-ios-sim,aarch64-apple-darwin
92
-
93
- - name: Install nightly Rust with Apple targets
94
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
95
- with:
96
- toolchain: nightly
97
- targets: aarch64-apple-tvos,aarch64-apple-tvos-sim,aarch64-apple-visionos,aarch64-apple-visionos-sim
98
-
99
- - name: Setup Rust cache
100
- uses: Swatinem/rust-cache@v2
101
- with:
102
- key: sdk-swift
103
-
104
- - name: Verify Rust crate versions match tag
105
- shell: bash
106
- run: |
107
- set -euo pipefail
108
-
109
- cargo metadata --no-deps --format-version 1 > metadata.json
110
-
111
- for crate_name in smbcloud-auth-sdk smbcloud-auth-sdk-apple; do
112
- cargo_version="$(jq -r --arg crate_name "${crate_name}" '.packages[] | select(.name == $crate_name) | .version' metadata.json)"
113
-
114
- echo "${crate_name} version : ${cargo_version}"
115
- echo "Release tag version : ${RELEASE_VERSION}"
116
-
117
- if [[ -z "${cargo_version}" || "${cargo_version}" == "null" ]]; then
118
- echo "::error::Unable to find ${crate_name} in cargo metadata."
119
- exit 1
120
- fi
121
-
122
- if [[ "${cargo_version}" != "${RELEASE_VERSION}" ]]; then
123
- echo "::error::Version mismatch — ${crate_name} must be ${RELEASE_VERSION} before releasing Swift SDK."
124
- exit 1
125
- fi
126
- done
127
-
128
- - name: Build XCFramework and generated Swift bindings
129
- id: build
130
- shell: bash
131
- run: |
132
- set -euo pipefail
133
-
134
- cli_repo="${GITHUB_WORKSPACE}"
135
- swift_repo="${GITHUB_WORKSPACE}/swift-sdk"
136
- build_root="${RUNNER_TEMP}/smbcloud-auth-swift-build"
137
- generated_dir="${build_root}/generated"
138
- headers_dir="${build_root}/Headers"
139
- frameworks_dir="${build_root}/frameworks"
140
- output_xcframework="${swift_repo}/${SWIFT_XCFRAMEWORK_NAME}"
141
- output_zip="${swift_repo}/dist/${SWIFT_XCFRAMEWORK_ZIP}"
142
- bindgen_bin="${cli_repo}/target/release/uniffi-bindgen"
143
- apple_manifest="${cli_repo}/crates/smbcloud-auth-sdk-apple/Cargo.toml"
144
- workspace_manifest="${cli_repo}/Cargo.toml"
145
- static_lib_name="libsmbcloud_auth.a"
146
-
147
- rm -rf "${build_root}" "${output_xcframework}" "${swift_repo}/dist"
148
- mkdir -p "${generated_dir}" "${headers_dir}" "${frameworks_dir}" "${swift_repo}/dist"
149
-
150
- cargo +"${RUST_TOOLCHAIN}" build \
151
- --manifest-path "${apple_manifest}" \
152
- --features bindgen \
153
- --bin uniffi-bindgen \
154
- --release
155
-
156
- IPHONEOS_DEPLOYMENT_TARGET=16.0 cargo +"${RUST_TOOLCHAIN}" rustc \
157
- --manifest-path "${workspace_manifest}" \
158
- --package smbcloud-auth-sdk-apple \
159
- --target aarch64-apple-ios \
160
- --release \
161
- --lib \
162
- --crate-type staticlib
163
-
164
- IPHONEOS_DEPLOYMENT_TARGET=16.0 cargo +"${RUST_TOOLCHAIN}" rustc \
165
- --manifest-path "${workspace_manifest}" \
166
- --package smbcloud-auth-sdk-apple \
167
- --target aarch64-apple-ios-sim \
168
- --release \
169
- --lib \
170
- --crate-type staticlib
171
-
172
- MACOSX_DEPLOYMENT_TARGET=14.0 cargo +"${RUST_TOOLCHAIN}" rustc \
173
- --manifest-path "${workspace_manifest}" \
174
- --package smbcloud-auth-sdk-apple \
175
- --target aarch64-apple-darwin \
176
- --release \
177
- --lib \
178
- --crate-type staticlib
179
-
180
- TVOS_DEPLOYMENT_TARGET=16.0 cargo +nightly rustc -Z build-std \
181
- --manifest-path "${workspace_manifest}" \
182
- --package smbcloud-auth-sdk-apple \
183
- --target aarch64-apple-tvos \
184
- --release \
185
- --lib \
186
- --crate-type staticlib
187
-
188
- TVOS_DEPLOYMENT_TARGET=16.0 cargo +nightly rustc -Z build-std \
189
- --manifest-path "${workspace_manifest}" \
190
- --package smbcloud-auth-sdk-apple \
191
- --target aarch64-apple-tvos-sim \
192
- --release \
193
- --lib \
194
- --crate-type staticlib
195
-
196
- XROS_DEPLOYMENT_TARGET=1.0 cargo +nightly rustc -Z build-std \
197
- --manifest-path "${workspace_manifest}" \
198
- --package smbcloud-auth-sdk-apple \
199
- --target aarch64-apple-visionos \
200
- --release \
201
- --lib \
202
- --crate-type staticlib
203
-
204
- XROS_DEPLOYMENT_TARGET=1.0 cargo +nightly rustc -Z build-std \
205
- --manifest-path "${workspace_manifest}" \
206
- --package smbcloud-auth-sdk-apple \
207
- --target aarch64-apple-visionos-sim \
208
- --release \
209
- --lib \
210
- --crate-type staticlib
211
-
212
- "${bindgen_bin}" generate \
213
- --library "${cli_repo}/target/aarch64-apple-ios/release/${static_lib_name}" \
214
- --language swift \
215
- --out-dir "${generated_dir}"
216
-
217
- cp "${generated_dir}/smbcloud_auth.swift" "${swift_repo}/Sources/SmbCloudAuth/smbcloud_auth.swift"
218
- cp "${generated_dir}/smbcloud_authFFI.h" "${headers_dir}/smbcloud_authFFI.h"
219
-
220
- stage_framework() {
221
- lib_input="$1"
222
- framework_output="$2"
223
-
224
- rm -rf "${framework_output}"
225
- mkdir -p "${framework_output}/Headers" "${framework_output}/Modules"
226
-
227
- cp "${lib_input}" "${framework_output}/smbcloud_authFFI"
228
- cp "${headers_dir}/smbcloud_authFFI.h" "${framework_output}/Headers/smbcloud_authFFI.h"
229
-
230
- cat > "${framework_output}/Modules/module.modulemap" <<'EOF'
231
- framework module smbcloud_authFFI {
232
- header "smbcloud_authFFI.h"
233
- export *
234
- use "Darwin"
235
- use "_Builtin_stdbool"
236
- use "_Builtin_stdint"
237
- }
238
- EOF
239
-
240
- cat > "${framework_output}/Info.plist" <<EOF
241
- <?xml version="1.0" encoding="UTF-8"?>
242
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">
243
- <plist version="1.0">
244
- <dict>
245
- <key>CFBundleIdentifier</key>
246
- <string>xyz.smbcloud.smbcloud-auth-ffi</string>
247
- <key>CFBundleName</key>
248
- <string>smbcloud_authFFI</string>
249
- <key>CFBundleExecutable</key>
250
- <string>smbcloud_authFFI</string>
251
- <key>CFBundlePackageType</key>
252
- <string>FMWK</string>
253
- <key>CFBundleShortVersionString</key>
254
- <string>${RELEASE_VERSION}</string>
255
- <key>CFBundleVersion</key>
256
- <string>1</string>
257
- </dict>
258
- </plist>
259
- EOF
260
- }
261
-
262
- stage_framework \
263
- "${cli_repo}/target/aarch64-apple-ios/release/${static_lib_name}" \
264
- "${frameworks_dir}/ios/smbcloud_authFFI.framework"
265
- stage_framework \
266
- "${cli_repo}/target/aarch64-apple-ios-sim/release/${static_lib_name}" \
267
- "${frameworks_dir}/ios-sim/smbcloud_authFFI.framework"
268
- stage_framework \
269
- "${cli_repo}/target/aarch64-apple-darwin/release/${static_lib_name}" \
270
- "${frameworks_dir}/macos/smbcloud_authFFI.framework"
271
- stage_framework \
272
- "${cli_repo}/target/aarch64-apple-tvos/release/${static_lib_name}" \
273
- "${frameworks_dir}/tvos/smbcloud_authFFI.framework"
274
- stage_framework \
275
- "${cli_repo}/target/aarch64-apple-tvos-sim/release/${static_lib_name}" \
276
- "${frameworks_dir}/tvos-sim/smbcloud_authFFI.framework"
277
- stage_framework \
278
- "${cli_repo}/target/aarch64-apple-visionos/release/${static_lib_name}" \
279
- "${frameworks_dir}/visionos/smbcloud_authFFI.framework"
280
- stage_framework \
281
- "${cli_repo}/target/aarch64-apple-visionos-sim/release/${static_lib_name}" \
282
- "${frameworks_dir}/visionos-sim/smbcloud_authFFI.framework"
283
-
284
- xcodebuild -create-xcframework \
285
- -framework "${frameworks_dir}/ios/smbcloud_authFFI.framework" \
286
- -framework "${frameworks_dir}/ios-sim/smbcloud_authFFI.framework" \
287
- -framework "${frameworks_dir}/macos/smbcloud_authFFI.framework" \
288
- -framework "${frameworks_dir}/tvos/smbcloud_authFFI.framework" \
289
- -framework "${frameworks_dir}/tvos-sim/smbcloud_authFFI.framework" \
290
- -framework "${frameworks_dir}/visionos/smbcloud_authFFI.framework" \
291
- -framework "${frameworks_dir}/visionos-sim/smbcloud_authFFI.framework" \
292
- -output "${output_xcframework}"
293
-
294
- ditto -c -k --sequesterRsrc --keepParent \
295
- "${output_xcframework}" \
296
- "${output_zip}"
297
-
298
- framework_checksum="$(cd "${swift_repo}" && swift package compute-checksum "dist/${SWIFT_XCFRAMEWORK_ZIP}")"
299
-
300
- echo "FRAMEWORK_CHECKSUM=${framework_checksum}" >> "$GITHUB_ENV"
301
- echo "framework_zip=${output_zip}" >> "$GITHUB_OUTPUT"
302
-
303
- - name: Upload XCFramework zip artifact
304
- uses: actions/upload-artifact@v7
305
- with:
306
- name: sdk-swift-xcframework
307
- path: ${{ steps.build.outputs.framework_zip }}
308
-
309
- - name: Update smbcloud-auth-swift package metadata
310
- shell: bash
311
- working-directory: swift-sdk
312
- run: |
313
- set -euo pipefail
314
-
315
- python3 <<'PY'
316
- from pathlib import Path
317
- import os
318
- import re
319
-
320
- package_path = Path("Package.swift")
321
- text = package_path.read_text()
322
- release_version = os.environ["RELEASE_VERSION"]
323
- checksum = os.environ["FRAMEWORK_CHECKSUM"]
324
- url = f"https://github.com/smbcloudXYZ/smbcloud-auth-swift/releases/download/{release_version}/smbcloud_authFFI.xcframework.zip"
325
-
326
- text = re.sub(
327
- r'https://github\.com/smbcloudXYZ/smbcloud-auth-swift/releases/download/[^"]+/smbcloud_authFFI\.xcframework\.zip',
328
- url,
329
- text,
330
- )
331
- text = re.sub(
332
- r'let releaseFrameworkChecksum =\n\s+"[0-9a-f]{64}"',
333
- f'let releaseFrameworkChecksum =\n "{checksum}"',
334
- text,
335
- )
336
-
337
- package_path.write_text(text)
338
- PY
339
-
340
- - name: Commit and tag smbcloud-auth-swift release
341
- shell: bash
342
- working-directory: swift-sdk
343
- run: |
344
- set -euo pipefail
345
-
346
- git fetch origin --tags
347
-
348
- if git ls-remote --tags origin "refs/tags/${RELEASE_VERSION}" | grep -q .; then
349
- echo "::error::${SWIFT_SDK_REPOSITORY} tag ${RELEASE_VERSION} already exists."
350
- exit 1
351
- fi
352
-
353
- git config user.name "github-actions[bot]"
354
- git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
355
-
356
- git add Package.swift Sources/SmbCloudAuth/smbcloud_auth.swift
357
-
358
- if ! git diff --cached --quiet; then
359
- git commit -m "Release ${RELEASE_VERSION}"
360
- git push origin HEAD:${{ steps.swift-repo.outputs.default_branch }}
361
- else
362
- echo "Swift repo metadata already up to date on ${RELEASE_VERSION}."
363
- fi
364
-
365
- git tag "${RELEASE_VERSION}"
366
- git push origin "${RELEASE_VERSION}"
367
-
368
- - name: Create GitHub Release in smbcloud-auth-swift
369
- shell: bash
370
- working-directory: swift-sdk
371
- env:
372
- GH_TOKEN: ${{ secrets.SMBCLOUD_SWIFT_REPO_TOKEN }}
373
- run: |
374
- set -euo pipefail
375
-
376
- release_notes_file="${RUNNER_TEMP}/smbcloud-auth-swift-release-notes.md"
377
- cat > "${release_notes_file}" <<EOF
378
- ## smbCloud Auth Swift ${RELEASE_VERSION}
379
-
380
- ### Installation
381
-
382
- Add the Swift package dependency:
383
-
384
- \`\`\`swift
385
- .package(url: "https://github.com/smbcloudXYZ/smbcloud-auth-swift", from: "${RELEASE_VERSION}")
386
- \`\`\`
387
-
388
- ### Platforms
389
-
390
- | Platform | Minimum Version |
391
- |----------|-----------------|
392
- | iOS | 16.0 |
393
- | macOS | 14.0 |
394
- | tvOS | 16.0 |
395
- | visionOS | 1.0 |
396
- EOF
397
-
398
- if gh release view "${RELEASE_VERSION}" --repo "${SWIFT_SDK_REPOSITORY}" >/dev/null 2>&1; then
399
- gh release upload "${RELEASE_VERSION}" "dist/${SWIFT_XCFRAMEWORK_ZIP}" \
400
- --clobber \
401
- --repo "${SWIFT_SDK_REPOSITORY}"
402
- else
403
- gh release create "${RELEASE_VERSION}" "dist/${SWIFT_XCFRAMEWORK_ZIP}" \
404
- --repo "${SWIFT_SDK_REPOSITORY}" \
405
- --title "smbCloud Auth Swift ${RELEASE_VERSION}" \
406
- --notes-file "${release_notes_file}"
407
- fi
408
-
409
- - name: Publish summary
410
- shell: bash
411
- run: |
412
- cat <<EOF >> "$GITHUB_STEP_SUMMARY"
413
- ## Swift SDK Release
414
-
415
- - Source tag: ${GITHUB_REF_NAME:-${{ github.event.inputs.tag }}}
416
- - Swift repo: ${SWIFT_SDK_REPOSITORY}
417
- - Swift tag: ${RELEASE_VERSION}
418
- - XCFramework: ${SWIFT_XCFRAMEWORK_NAME}
419
- - Checksum: ${FRAMEWORK_CHECKSUM}
420
- EOF
.github/workflows/verify-sdk-apple.yml
new
+274
@@ -0,0 +1,274 @@
1
+name: Apple Bridge SDK Verification
2
+
3
+# Verifies the internal Apple bridge crate used for local UniFFI/XCFramework
4
+# development. This workflow does not publish or update the standalone
5
+# smbcloud-auth-swift repository.
6
+#
7
+# It builds the Rust Apple bridge for supported Apple targets, generates the
8
+# UniFFI Swift bindings, assembles a local XCFramework, and uploads the
9
+# generated artifacts for inspection.
10
+
11
+on:
12
+ push:
13
+ paths:
14
+ - ".github/workflows/verify-sdk-apple.yml"
15
+ - "Cargo.toml"
16
+ - "Cargo.lock"
17
+ - "rust-toolchain.toml"
18
+ - "crates/smbcloud-auth-sdk-apple/**"
19
+ - "crates/smbcloud-auth-sdk/**"
20
+ - "crates/smbcloud-model/**"
21
+ - "crates/smbcloud-network/**"
22
+ pull_request:
23
+ paths:
24
+ - ".github/workflows/verify-sdk-apple.yml"
25
+ - "Cargo.toml"
26
+ - "Cargo.lock"
27
+ - "rust-toolchain.toml"
28
+ - "crates/smbcloud-auth-sdk-apple/**"
29
+ - "crates/smbcloud-auth-sdk/**"
30
+ - "crates/smbcloud-model/**"
31
+ - "crates/smbcloud-network/**"
32
+ workflow_dispatch:
33
+
34
+permissions:
35
+ contents: read
36
+
37
+env:
38
+ CARGO_TERM_COLOR: always
39
+ XCFRAMEWORK_NAME: smbcloud_authFFI.xcframework
40
+ STATIC_LIB_NAME: libsmbcloud_auth.a
41
+
42
+jobs:
43
+ verify-sdk-apple:
44
+ name: Verify smbcloud-auth-sdk-apple
45
+ runs-on: macos-latest
46
+
47
+ steps:
48
+ - name: Checkout
49
+ uses: actions/checkout@v6
50
+
51
+ - name: Read Rust toolchain
52
+ shell: bash
53
+ run: |
54
+ rust_toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml | head -n 1)"
55
+ if [ -z "${rust_toolchain}" ]; then
56
+ echo "Failed to read Rust toolchain from rust-toolchain.toml" >&2
57
+ exit 1
58
+ fi
59
+
60
+ echo "RUST_TOOLCHAIN=${rust_toolchain}" >> "$GITHUB_ENV"
61
+
62
+ - name: Install stable Rust with Apple targets
63
+ uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
64
+ with:
65
+ toolchain: ${{ env.RUST_TOOLCHAIN }}
66
+ targets: aarch64-apple-ios,aarch64-apple-ios-sim,aarch64-apple-darwin
67
+
68
+ - name: Install nightly Rust with Apple targets
69
+ uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
70
+ with:
71
+ toolchain: nightly
72
+ components: rust-src
73
+ targets: aarch64-apple-tvos,aarch64-apple-tvos-sim,aarch64-apple-visionos,aarch64-apple-visionos-sim
74
+
75
+ - name: Setup Rust cache
76
+ uses: Swatinem/rust-cache@v2
77
+ with:
78
+ key: verify-sdk-apple
79
+
80
+ - name: Build UniFFI bindgen helper
81
+ shell: bash
82
+ run: |
83
+ cargo +"${RUST_TOOLCHAIN}" build \
84
+ --manifest-path crates/smbcloud-auth-sdk-apple/Cargo.toml \
85
+ --features bindgen \
86
+ --bin uniffi-bindgen \
87
+ --release
88
+
89
+ - name: Build Apple bridge static libraries
90
+ shell: bash
91
+ run: |
92
+ set -euo pipefail
93
+
94
+ IPHONEOS_DEPLOYMENT_TARGET=16.0 cargo +"${RUST_TOOLCHAIN}" rustc \
95
+ --manifest-path Cargo.toml \
96
+ --package smbcloud-auth-sdk-apple \
97
+ --target aarch64-apple-ios \
98
+ --release \
99
+ --lib \
100
+ --crate-type staticlib
101
+
102
+ IPHONEOS_DEPLOYMENT_TARGET=16.0 cargo +"${RUST_TOOLCHAIN}" rustc \
103
+ --manifest-path Cargo.toml \
104
+ --package smbcloud-auth-sdk-apple \
105
+ --target aarch64-apple-ios-sim \
106
+ --release \
107
+ --lib \
108
+ --crate-type staticlib
109
+
110
+ MACOSX_DEPLOYMENT_TARGET=14.0 cargo +"${RUST_TOOLCHAIN}" rustc \
111
+ --manifest-path Cargo.toml \
112
+ --package smbcloud-auth-sdk-apple \
113
+ --target aarch64-apple-darwin \
114
+ --release \
115
+ --lib \
116
+ --crate-type staticlib
117
+
118
+ TVOS_DEPLOYMENT_TARGET=16.0 cargo +nightly rustc -Z build-std \
119
+ --manifest-path Cargo.toml \
120
+ --package smbcloud-auth-sdk-apple \
121
+ --target aarch64-apple-tvos \
122
+ --release \
123
+ --lib \
124
+ --crate-type staticlib
125
+
126
+ TVOS_DEPLOYMENT_TARGET=16.0 cargo +nightly rustc -Z build-std \
127
+ --manifest-path Cargo.toml \
128
+ --package smbcloud-auth-sdk-apple \
129
+ --target aarch64-apple-tvos-sim \
130
+ --release \
131
+ --lib \
132
+ --crate-type staticlib
133
+
134
+ XROS_DEPLOYMENT_TARGET=1.0 cargo +nightly rustc -Z build-std \
135
+ --manifest-path Cargo.toml \
136
+ --package smbcloud-auth-sdk-apple \
137
+ --target aarch64-apple-visionos \
138
+ --release \
139
+ --lib \
140
+ --crate-type staticlib
141
+
142
+ XROS_DEPLOYMENT_TARGET=1.0 cargo +nightly rustc -Z build-std \
143
+ --manifest-path Cargo.toml \
144
+ --package smbcloud-auth-sdk-apple \
145
+ --target aarch64-apple-visionos-sim \
146
+ --release \
147
+ --lib \
148
+ --crate-type staticlib
149
+
150
+ - name: Generate Swift bindings and assemble XCFramework
151
+ id: package
152
+ shell: bash
153
+ run: |
154
+ set -euo pipefail
155
+
156
+ build_root="${RUNNER_TEMP}/sdk-apple-build"
157
+ generated_dir="${build_root}/generated"
158
+ headers_dir="${build_root}/Headers"
159
+ frameworks_dir="${build_root}/frameworks"
160
+ output_dir="${GITHUB_WORKSPACE}/dist/sdk-apple"
161
+ output_xcframework="${output_dir}/${XCFRAMEWORK_NAME}"
162
+ bindgen_bin="${GITHUB_WORKSPACE}/target/release/uniffi-bindgen"
163
+
164
+ rm -rf "${build_root}" "${output_dir}"
165
+ mkdir -p "${generated_dir}" "${headers_dir}" "${frameworks_dir}" "${output_dir}"
166
+
167
+ "${bindgen_bin}" generate \
168
+ --library "${GITHUB_WORKSPACE}/target/aarch64-apple-ios/release/${STATIC_LIB_NAME}" \
169
+ --language swift \
170
+ --out-dir "${generated_dir}"
171
+
172
+ cp "${generated_dir}/smbcloud_auth.swift" "${output_dir}/smbcloud_auth.swift"
173
+ cp "${generated_dir}/smbcloud_authFFI.h" "${headers_dir}/smbcloud_authFFI.h"
174
+ cp "${generated_dir}/smbcloud_authFFI.h" "${output_dir}/smbcloud_authFFI.h"
175
+
176
+ stage_framework() {
177
+ local lib_input="$1"
178
+ local framework_output="$2"
179
+
180
+ rm -rf "${framework_output}"
181
+ mkdir -p "${framework_output}/Headers" "${framework_output}/Modules"
182
+
183
+ cp "${lib_input}" "${framework_output}/smbcloud_authFFI"
184
+ cp "${headers_dir}/smbcloud_authFFI.h" "${framework_output}/Headers/smbcloud_authFFI.h"
185
+
186
+ cat > "${framework_output}/Modules/module.modulemap" <<'EOF'
187
+ framework module smbcloud_authFFI {
188
+ header "smbcloud_authFFI.h"
189
+ export *
190
+ use "Darwin"
191
+ use "_Builtin_stdbool"
192
+ use "_Builtin_stdint"
193
+ }
194
+ EOF
195
+
196
+ cat > "${framework_output}/Info.plist" <<'EOF'
197
+ <?xml version="1.0" encoding="UTF-8"?>
198
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">
199
+ <plist version="1.0">
200
+ <dict>
201
+ <key>CFBundleIdentifier</key>
202
+ <string>xyz.smbcloud.smbcloud-auth-ffi</string>
203
+ <key>CFBundleName</key>
204
+ <string>smbcloud_authFFI</string>
205
+ <key>CFBundleExecutable</key>
206
+ <string>smbcloud_authFFI</string>
207
+ <key>CFBundlePackageType</key>
208
+ <string>FMWK</string>
209
+ <key>CFBundleShortVersionString</key>
210
+ <string>dev</string>
211
+ <key>CFBundleVersion</key>
212
+ <string>1</string>
213
+ </dict>
214
+ </plist>
215
+ EOF
216
+ }
217
+
218
+ stage_framework \
219
+ "${GITHUB_WORKSPACE}/target/aarch64-apple-ios/release/${STATIC_LIB_NAME}" \
220
+ "${frameworks_dir}/ios/smbcloud_authFFI.framework"
221
+ stage_framework \
222
+ "${GITHUB_WORKSPACE}/target/aarch64-apple-ios-sim/release/${STATIC_LIB_NAME}" \
223
+ "${frameworks_dir}/ios-sim/smbcloud_authFFI.framework"
224
+ stage_framework \
225
+ "${GITHUB_WORKSPACE}/target/aarch64-apple-darwin/release/${STATIC_LIB_NAME}" \
226
+ "${frameworks_dir}/macos/smbcloud_authFFI.framework"
227
+ stage_framework \
228
+ "${GITHUB_WORKSPACE}/target/aarch64-apple-tvos/release/${STATIC_LIB_NAME}" \
229
+ "${frameworks_dir}/tvos/smbcloud_authFFI.framework"
230
+ stage_framework \
231
+ "${GITHUB_WORKSPACE}/target/aarch64-apple-tvos-sim/release/${STATIC_LIB_NAME}" \
232
+ "${frameworks_dir}/tvos-sim/smbcloud_authFFI.framework"
233
+ stage_framework \
234
+ "${GITHUB_WORKSPACE}/target/aarch64-apple-visionos/release/${STATIC_LIB_NAME}" \
235
+ "${frameworks_dir}/visionos/smbcloud_authFFI.framework"
236
+ stage_framework \
237
+ "${GITHUB_WORKSPACE}/target/aarch64-apple-visionos-sim/release/${STATIC_LIB_NAME}" \
238
+ "${frameworks_dir}/visionos-sim/smbcloud_authFFI.framework"
239
+
240
+ xcodebuild -create-xcframework \
241
+ -framework "${frameworks_dir}/ios/smbcloud_authFFI.framework" \
242
+ -framework "${frameworks_dir}/ios-sim/smbcloud_authFFI.framework" \
243
+ -framework "${frameworks_dir}/macos/smbcloud_authFFI.framework" \
244
+ -framework "${frameworks_dir}/tvos/smbcloud_authFFI.framework" \
245
+ -framework "${frameworks_dir}/tvos-sim/smbcloud_authFFI.framework" \
246
+ -framework "${frameworks_dir}/visionos/smbcloud_authFFI.framework" \
247
+ -framework "${frameworks_dir}/visionos-sim/smbcloud_authFFI.framework" \
248
+ -output "${output_xcframework}"
249
+
250
+ ditto -c -k --sequesterRsrc --keepParent \
251
+ "${output_xcframework}" \
252
+ "${output_dir}/${XCFRAMEWORK_NAME}.zip"
253
+
254
+ echo "artifact_dir=${output_dir}" >> "$GITHUB_OUTPUT"
255
+
256
+ - name: Upload Apple bridge artifacts
257
+ uses: actions/upload-artifact@v7
258
+ with:
259
+ name: sdk-apple-artifacts
260
+ path: ${{ steps.package.outputs.artifact_dir }}
261
+
262
+ - name: Publish summary
263
+ shell: bash
264
+ run: |
265
+ cat <<EOF >> "$GITHUB_STEP_SUMMARY"
266
+ ## Apple bridge SDK verification
267
+
268
+ Verified crate: `smbcloud-auth-sdk-apple`
269
+
270
+ Generated artifacts:
271
+ - UniFFI Swift bindings
272
+ - smbcloud_authFFI XCFramework
273
+ - zipped XCFramework artifact
274
+ EOF