Skip to content

chore(swift-sdk): reduce swift-sdk test time in CI#3869

Open
ZocoLini wants to merge 1 commit into
v3.1-devfrom
chore/optimize-sdk-ci
Open

chore(swift-sdk): reduce swift-sdk test time in CI#3869
ZocoLini wants to merge 1 commit into
v3.1-devfrom
chore/optimize-sdk-ci

Conversation

@ZocoLini

@ZocoLini ZocoLini commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Ci was being slowed down when trying to execute the build and test step of the swift-sdk, to improve the job execution time I changed:

  • Removed the ExampleApp unit tests from the pipeline. Most of them are in reality swift-sdk tests so I will be opening a following PR moving them to were they belong to avoid having to create iOS simlulators
  • Removed lto="thin" from the dev-ios profile
  • Recycling previous swift build artifacts by removing the swift package clean step run_tests.sh was calling
  • I also change a str concat line in a .swift file in the example app, it was stalling my Xcode version and it may also stall the runner in a runner if we update Xcode there

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR optimizes iOS release builds with fat link-time optimization, consolidates test execution scripts to use a new tests target build option, and refactors UI footer text construction in the Swift SDK example application.

Changes

Swift SDK Build and UI Updates

Layer / File(s) Summary
iOS release build optimization
Cargo.toml
iOS release build profile switches link-time optimization from thin to fat.
Test script refactoring and consolidation
packages/swift-sdk/build_ios.sh, packages/swift-sdk/run_tests.sh
Build script adds a new --target tests option that sets both simulator and macOS build flags; test runner is simplified to invoke the build script with the tests target in dev profile and then run swift test locally, removing prior simulator selection and xcodebuild-based test orchestration.
UI footer text refactoring
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/CreateIdentityView.swift
Funding Source section footer text is reconstructed by computing a conditional shielded balance note and joining it with other footer messages instead of using nested Text concatenation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • dashpay/platform#3837: Introduces the [profile.release-ios] configuration with lto = "fat", directly related to this PR's LTO optimization update.

Suggested reviewers

  • shumkov
  • QuantumExplorer
  • llbartekll

Poem

🐰 Fat LTO bundled swift,
Tests now run with simple shift,
Footer text takes cleaner lift,
Build's a gift, review's a gift!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately describes the main objective of the PR: optimizing swift-sdk test time in CI by reducing build overhead and test scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/optimize-sdk-ci

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@thepastaclaw

thepastaclaw commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

✅ Review complete (commit 28ce415)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/swift-sdk/build_ios.sh`:
- Line 85: The help text returned by the show_help() function omits the newly
added --target value "tests" even though the script accepts it (see the case
branch that sets BUILD_SIM=true; BUILD_MAC=true for tests); update show_help()
to list "tests" among valid --target options and update any related usage lines
that enumerate targets so CLI users and CI see the new tests option consistent
with the case handling for BUILD_SIM/BUILD_MAC.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d6da8bea-fa00-449a-95b4-53d4465a29d5

📥 Commits

Reviewing files that changed from the base of the PR and between 0121185 and 28ce415.

📒 Files selected for processing (4)
  • Cargo.toml
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/CreateIdentityView.swift
  • packages/swift-sdk/build_ios.sh
  • packages/swift-sdk/run_tests.sh
💤 Files with no reviewable changes (1)
  • Cargo.toml

Comment thread packages/swift-sdk/build_ios.sh

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

PR introduces a real regression in the published PR artifact: run_tests.sh now invokes build_ios.sh --target tests, which only builds the simulator and macOS slices, yet swift-sdk-build.yml continues to zip the resulting DashSDKFFI.xcframework as the PR artifact and recommends it as a SwiftPM .binaryTarget — consumers targeting physical iOS devices cannot link it. Two minor follow-ups: build_ios.sh show_help() does not advertise the new tests target, and the SwiftExampleAppTests/UITests targets are no longer exercised anywhere in CI.

🔴 1 blocking | 🟡 1 suggestion(s) | 💬 1 nitpick(s)

1 additional finding(s) omitted (not in diff).

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `packages/swift-sdk/run_tests.sh`:
- [BLOCKING] packages/swift-sdk/run_tests.sh:7: PR-artifact XCFramework no longer contains the iOS device slice
  run_tests.sh now calls `build_ios.sh --target tests`, which only sets BUILD_SIM=true and BUILD_MAC=true (build_ios.sh:85). The downstream `xcodebuild -create-xcframework` step (build_ios.sh:236–240) is driven by IOS_LIB/SIM_LIB/MAC_LIB, so the resulting DashSDKFFI.xcframework contains only `ios-arm64-simulator` and `macos-arm64` — no `ios-arm64` device slice. swift-sdk-build.yml then zips that same xcframework and uploads it as the PR artifact (lines 89–107) and posts a PR comment instructing consumers to wire it up as a SwiftPM `.binaryTarget` (lines 143–158). Any consumer following those instructions and linking the artifact into an app targeting a physical iOS device will fail to link, and device-only FFI build breakages will no longer be caught at PR time (release builds still use `--target all`, so production releases are unaffected, but the PR-level deliverable is silently incomplete). Either build the iOS device slice in CI before the upload step (e.g. invoke `build_ios.sh --target ios --profile dev` after `run_tests.sh`, or split the PR upload step off `--target all`) or update the PR comment template to declare the artifact as simulator+mac only.
- [SUGGESTION] packages/swift-sdk/run_tests.sh:6-9: SwiftExampleAppTests/UITests have zero CI coverage after this change
  Removing the `xcodebuild test -scheme SwiftExampleApp` invocation eliminates the only place SwiftExampleAppTests (KeyManagerTests, StateTransitionTests, ValidationTests, CreateIdentityResumableTests, ShieldedSyncGenerationTests, WalletTests/*, etc.) and SwiftExampleAppUITests were exercised. `swift test` only runs the SwiftPM-defined test targets, not Xcode app test bundles. The PR description acknowledges this and promises a follow-up migration PR, but until that lands these tests will silently rot and regressions will not be caught. Land the migration in the same PR, or keep a slimmed `xcodebuild test` invocation (e.g. with `-skip-testing` filters on the slow cases) so coverage is not dropped to zero in the interim.

Comment thread packages/swift-sdk/run_tests.sh
Comment thread packages/swift-sdk/run_tests.sh
@github-actions

Copy link
Copy Markdown
Contributor

✅ DashSDKFFI.xcframework built for this PR.

SwiftPM (host the zip at a stable URL, then use):

.binaryTarget(
  name: "DashSDKFFI",
  url: "https://your.cdn.example/DashSDKFFI.xcframework.zip",
  checksum: "08697fb7c90de689d57fae0dc5b6e55a5a3faf5193491f637b44d051682ca0df"
)

Xcode manual integration:

  • Download 'DashSDKFFI.xcframework' artifact from the run link above.
  • Drag it into your app target (Frameworks, Libraries & Embedded Content) and set Embed & Sign.
  • If using the Swift wrapper package, point its binaryTarget to the xcframework location or add the package and place the xcframework at the expected path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants