Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/swift-sdk-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build Swift SDK and Example (no warnings)

on:
pull_request:
paths:
- 'packages/swift-sdk/**'
- '.github/workflows/swift-sdk-build.yml'
push:
branches: [ main, master ]
paths:
- 'packages/swift-sdk/**'
- '.github/workflows/swift-sdk-build.yml'
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Run this workflow when Rust FFI sources change.

The build_ios.sh compiles crates under packages/rs-*. Currently, PRs that only touch those paths won’t trigger this workflow.

 on:
   pull_request:
     paths:
-      - 'packages/swift-sdk/**'
+      - 'packages/swift-sdk/**'
+      - 'packages/rs-*/**'
+      - 'packages/**/Cargo.toml'
+      - 'packages/**/Cargo.lock'
       - '.github/workflows/swift-sdk-build.yml'
   push:
     branches: [ main, master ]
     paths:
-      - 'packages/swift-sdk/**'
+      - 'packages/swift-sdk/**'
+      - 'packages/rs-*/**'
+      - 'packages/**/Cargo.toml'
+      - 'packages/**/Cargo.lock'
       - '.github/workflows/swift-sdk-build.yml'
🤖 Prompt for AI Agents
In .github/workflows/swift-sdk-build.yml around lines 3 to 12, the workflow
currently watches only packages/swift-sdk/** and the workflow file itself, but
it should also trigger when Rust FFI crates under packages/rs-* change; update
both the pull_request and push path filters to include the Rust patterns (for
example add packages/rs-*/** or packages/rs-**/**) so changes to those crates
will run the workflow.


jobs:
swift-sdk-build:
name: Swift SDK and Example build (warnings as errors)
runs-on: macos-latest
timeout-minutes: 60

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Select Xcode 16
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '16.*'

- name: Show Xcode and Swift versions
run: |
xcodebuild -version
swift --version

- name: Build SwiftDashSDK package (warnings as errors)
working-directory: packages/swift-sdk
run: |
swift build -c debug -Xswiftc -warnings-as-errors

- name: Resolve ExampleApp dependencies
working-directory: packages/swift-sdk
run: |
xcodebuild -project SwiftExampleApp/SwiftExampleApp.xcodeproj -resolvePackageDependencies

- name: Build SwiftExampleApp (warnings as errors)
working-directory: packages/swift-sdk
env:
# Treat Swift warnings as errors during xcodebuild
OTHER_SWIFT_FLAGS: -warnings-as-errors
SWIFT_TREAT_WARNINGS_AS_ERRORS: YES
run: |
xcodebuild \
-project SwiftExampleApp/SwiftExampleApp.xcodeproj \
-scheme SwiftExampleApp \
-sdk iphonesimulator \
-destination 'generic/platform=iOS Simulator' \
-configuration Debug \
ONLY_ACTIVE_ARCH=YES \
OTHER_SWIFT_FLAGS="$OTHER_SWIFT_FLAGS" \
SWIFT_TREAT_WARNINGS_AS_ERRORS=$SWIFT_TREAT_WARNINGS_AS_ERRORS \
Comment on lines +250 to +262
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Quote environment variables to prevent word splitting

The OTHER_SWIFT_FLAGS and SWIFT_TREAT_WARNINGS_AS_ERRORS variables should be quoted in the shell command to prevent potential word splitting issues.

           xcodebuild \
             -project SwiftExampleApp/SwiftExampleApp.xcodeproj \
             -scheme SwiftExampleApp \
             -sdk iphonesimulator \
             -destination 'generic/platform=iOS Simulator' \
             -configuration Debug \
             ONLY_ACTIVE_ARCH=YES \
-            OTHER_SWIFT_FLAGS="$OTHER_SWIFT_FLAGS" \
-            SWIFT_TREAT_WARNINGS_AS_ERRORS=$SWIFT_TREAT_WARNINGS_AS_ERRORS \
+            OTHER_SWIFT_FLAGS="${OTHER_SWIFT_FLAGS}" \
+            SWIFT_TREAT_WARNINGS_AS_ERRORS="${SWIFT_TREAT_WARNINGS_AS_ERRORS}" \
             build
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Treat Swift warnings as errors during xcodebuild
OTHER_SWIFT_FLAGS: -warnings-as-errors
SWIFT_TREAT_WARNINGS_AS_ERRORS: YES
run: |
xcodebuild \
-project SwiftExampleApp/SwiftExampleApp.xcodeproj \
-scheme SwiftExampleApp \
-sdk iphonesimulator \
-destination 'generic/platform=iOS Simulator' \
-configuration Debug \
ONLY_ACTIVE_ARCH=YES \
OTHER_SWIFT_FLAGS="$OTHER_SWIFT_FLAGS" \
SWIFT_TREAT_WARNINGS_AS_ERRORS=$SWIFT_TREAT_WARNINGS_AS_ERRORS \
# Treat Swift warnings as errors during xcodebuild
OTHER_SWIFT_FLAGS: -warnings-as-errors
SWIFT_TREAT_WARNINGS_AS_ERRORS: YES
run: |
xcodebuild \
-project SwiftExampleApp/SwiftExampleApp.xcodeproj \
-scheme SwiftExampleApp \
-sdk iphonesimulator \
-destination 'generic/platform=iOS Simulator' \
-configuration Debug \
ONLY_ACTIVE_ARCH=YES \
OTHER_SWIFT_FLAGS="${OTHER_SWIFT_FLAGS}" \
SWIFT_TREAT_WARNINGS_AS_ERRORS="${SWIFT_TREAT_WARNINGS_AS_ERRORS}" \
build
🧰 Tools
🪛 actionlint (1.7.7)

50-50: shellcheck reported issue in this script: SC2086:info:9:34: Double quote to prevent globbing and word splitting

(shellcheck)

🤖 Prompt for AI Agents
.github/workflows/swift-sdk-build.yml around lines 47 to 59: the shell
invocation passes OTHER_SWIFT_FLAGS and SWIFT_TREAT_WARNINGS_AS_ERRORS unquoted
which can cause word splitting; update the xcodebuild command to wrap these
variables in double quotes (e.g. OTHER_SWIFT_FLAGS="$OTHER_SWIFT_FLAGS" and
SWIFT_TREAT_WARNINGS_AS_ERRORS="$SWIFT_TREAT_WARNINGS_AS_ERRORS") so their
values are preserved as single arguments.

build
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@
- iOS/FFI artifacts: `packages/rs-sdk-ffi` and Swift app in `packages/swift-sdk`.
- Example: build iOS framework
- `cd packages/rs-sdk-ffi && ./build_ios.sh`
- iOS Simulator MCP server: see `packages/swift-sdk/IOS_SIMULATOR_MCP.md` for Codex config, tools, and usage. Default output dir set via `IOS_SIMULATOR_MCP_DEFAULT_OUTPUT_DIR`.
Loading
Loading