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 lto="thin" from the dev-ios profile, reducing the .a size was not worth the time it was taking to compile, an alternative has been introduce to that profile
  • Removed a couple of unused dependencies I was able to spot
  • Bumped groveDB version. Its a new major release but no public API was changed (apparently)
  • Removed some debug symbols for iOS builds allowing the compiler to write smaller .a (700 MB apron I think), which means lower link times for the swift compiler (at least 5x faster)
  • Recycling previous swift build artifacts by removing the swift package clean step run_tests.sh was calling

All of this made the test script 4x faster

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

grovedb-family git revision pins are bumped from fc814983... to 9b98a356... across six Rust packages. Two unused dev-dependencies (tempfile, predicates) are removed from wallet packages. The workspace iOS dev profile switches from lto = "thin" to debug = "line-tables-only". The Swift SDK build script gains a tests target, and run_tests.sh is rewritten to use strict mode and run only the new target.

Changes

Rust grovedb rev bump and dev-dep cleanup

Layer / File(s) Summary
grovedb rev bump across packages
packages/rs-drive/Cargo.toml, packages/rs-platform-version/Cargo.toml, packages/rs-dpp/Cargo.toml, packages/rs-drive-abci/Cargo.toml, packages/rs-platform-wallet/Cargo.toml, packages/rs-sdk/Cargo.toml
Pinned git rev for grovedb, grovedb-costs, grovedb-path, grovedb-storage, grovedb-version, grovedb-epoch-based-storage-flags, and grovedb-commitment-tree is changed from fc814983... to 9b98a356... in all affected manifests.
Unused dev-dependency removals
packages/rs-platform-wallet-ffi/Cargo.toml, packages/rs-platform-wallet-storage/Cargo.toml
tempfile = "3.8" is removed from wallet-ffi dev-dependencies; predicates = "3" is removed from wallet-storage dev-dependencies.

Swift SDK build and test refactoring

Layer / File(s) Summary
iOS dev profile and tests build target
Cargo.toml, packages/swift-sdk/build_ios.sh
Workspace [profile.dev-ios] replaces lto = "thin" with debug = "line-tables-only"; build_ios.sh adds a tests case that sets BUILD_SIM=true and BUILD_MAC=true.
run_tests.sh pipeline refactoring
packages/swift-sdk/run_tests.sh
Script gains set -euo pipefail and cd-to-script-dir; prior --target all plus swift package clean/swift build steps are replaced by build_ios.sh --target tests --profile dev followed by swift test.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • dashpay/platform#3656: Bumps the same grovedb-family git rev pins across the same set of Cargo manifests.
  • dashpay/platform#3789: Updates pinned grovedb/grovedb-commitment-tree git rev values in the same packages (rs-dpp, rs-drive-abci, rs-drive, rs-sdk).
  • dashpay/platform#3837: Modifies the same root Cargo.toml [profile.dev-ios] settings for iOS build configuration.

Suggested reviewers

  • QuantumExplorer
  • shumkov
  • llbartekll

Poem

🐇 Hop, hop, the rev pins are new,
grovedb hashes updated through and through!
LTO thin is gone, line-tables stay,
swift test now runs in a tidier way.
No more predicates, no tempfile in sight—
This bunny's Cargo.tomls are feeling just right! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main objective: reducing swift-sdk test time in CI through specific optimizations like removing redundant tests and build artifacts.
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 971c3f8)

@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.

@LuuOW LuuOW left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Technical audit: Implementation verified for system consistency and engineering integrity.

@ZocoLini ZocoLini force-pushed the chore/optimize-sdk-ci branch from 28ce415 to 971c3f8 Compare June 21, 2026 22:45
@ZocoLini ZocoLini requested a review from lklimek as a code owner June 21, 2026 22:45

@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

Cumulative review at 971c3f8 (Swift SDK CI/test speedup PR). Prior 'SwiftExampleApp tests have zero CI coverage' is now resolved — run_tests.sh re-introduced an xcodebuild test invocation at lines 23-27. Prior 'XCFramework missing iOS device slice' was misframed (run_tests.sh produces test artifacts, not the PR/release framework, which uses --target all) and is dropped. One prior nitpick still stands: build_ios.sh show_help() does not document the new 'tests' target. New reviewer findings (grovedb rev bump, SwiftPM clean removal, tokio-metrics on dev-ios) are speculative/out-of-scope.

💬 1 nitpick(s)

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

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.18%. Comparing base (96cba16) to head (971c3f8).
⚠️ Report is 2 commits behind head on v3.1-dev.

Additional details and impacted files
@@              Coverage Diff              @@
##           v3.1-dev    #3869       +/-   ##
=============================================
+ Coverage     52.54%   87.18%   +34.63%     
=============================================
  Files            11     2632     +2621     
  Lines          1707   327563   +325856     
=============================================
+ Hits            897   285592   +284695     
- Misses          810    41971    +41161     
Components Coverage Δ
dpp 87.70% <ø> (∅)
drive 86.14% <ø> (∅)
drive-abci 89.45% <ø> (∅)
sdk ∅ <ø> (∅)
dapi-client ∅ <ø> (∅)
platform-version ∅ <ø> (∅)
platform-value 92.20% <ø> (∅)
platform-wallet ∅ <ø> (∅)
drive-proof-verifier 49.55% <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

3 participants