From 30bb4ebb218706c33346951bfea96a0374b7d3df Mon Sep 17 00:00:00 2001 From: Kanat Date: Mon, 23 Nov 2026 16:20:33 +0100 Subject: [PATCH 1/2] AI-3583: build swift_demo into its own DerivedData The core build and swift_demo shared one DerivedData. When the SPM cache lacks the repositories, the core build resolves StreamWebRTC 156.0.7 while swift_demo pins 145.17.0, and swift_demo then fails on modules built from the other version's headers ("has been modified since the module file"). The SPM cache is no longer saved from a cancelled run or a failed core build: run 45192193934 was cancelled mid-fetch and saved a partial cache that every later main run restored as an exact hit. The key prefix changes so main stops restoring that entry. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/client-sdks.yml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/client-sdks.yml b/.github/workflows/client-sdks.yml index f803c55bad..1d17b3a102 100644 --- a/.github/workflows/client-sdks.yml +++ b/.github/workflows/client-sdks.yml @@ -192,17 +192,20 @@ jobs: - name: generate.py tests run: uv run --no-project --with pytest --with pyyaml pytest -c /dev/null --rootdir=sdks/swift --confcutdir=sdks/swift sdks/swift/test_generate.py - # Both builds resolve into one checkout directory and compile into one DerivedData, so - # the Stream SDKs and WebRTC are fetched and built once a run rather than twice. + # Both builds resolve into one checkout directory, so the Stream SDKs and WebRTC are + # fetched once a run. Each compiles into its own DerivedData: swift_demo takes the + # versions its Package.resolved pins, the core build those Package.swift allows, and a + # module built from one StreamWebRTC's headers fails the build that has the other's. - uses: actions/cache/restore@v4 id: packages with: path: ${{ runner.temp }}/spm - key: spm-${{ runner.os }}-xcode27-${{ hashFiles('Package.swift', 'examples/voice_agents/swift_demo/app/SwiftDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }} - restore-keys: spm-${{ runner.os }}-xcode27- + key: swiftpm-${{ runner.os }}-xcode27-${{ hashFiles('Package.swift', 'examples/voice_agents/swift_demo/app/SwiftDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }} + restore-keys: swiftpm-${{ runner.os }}-xcode27- # The package is iOS only, so it is tested on a simulator rather than with `swift test`. - name: Build core tests + id: build-core timeout-minutes: 15 run: | device=$(xcrun simctl list devices available -j | python3 -c "import json, sys; devices = json.load(sys.stdin)['devices']; print(next(d['udid'] for runtime, found in devices.items() if 'iOS' in runtime for d in found if d['name'].startswith('iPhone')))") @@ -235,11 +238,15 @@ jobs: timeout-minutes: 10 run: | xcodebuild -project SwiftDemo.xcodeproj -scheme SwiftDemo -destination 'generic/platform=iOS Simulator' \ - -clonedSourcePackagesDirPath "$RUNNER_TEMP/spm" -derivedDataPath "$RUNNER_TEMP/DerivedData" build + -clonedSourcePackagesDirPath "$RUNNER_TEMP/spm" -derivedDataPath "$RUNNER_TEMP/SwiftDemoDerivedData" build - # Saved even when a test fails, so a red run still leaves the next one a warm cache. + # Saved even when a test fails, so a red run still leaves the next one a warm cache. Not + # from a cancelled run or a failed core build, whose fetch may have stopped half way: a + # key once saved is restored as is and never saved again. - uses: actions/cache/save@v4 - if: always() && steps.packages.outcome == 'success' && steps.packages.outputs.cache-hit != 'true' + if: >- + !cancelled() && steps.packages.outcome == 'success' && steps.build-core.outcome == 'success' + && steps.packages.outputs.cache-hit != 'true' with: path: ${{ runner.temp }}/spm key: ${{ steps.packages.outputs.cache-primary-key }} From 156dd4c1958f7fbd7213997ab5d126caa560a77e Mon Sep 17 00:00:00 2001 From: Kanat Date: Mon, 23 Nov 2026 17:12:25 +0100 Subject: [PATCH 2/2] AI-3583: Do not save the package cache after a failed swift_demo build Build swift_demo fetches and checks out its pins in the cached folder, so a failure there can leave it half updated under the primary key. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/client-sdks.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/client-sdks.yml b/.github/workflows/client-sdks.yml index 1d17b3a102..dbd7ecf64a 100644 --- a/.github/workflows/client-sdks.yml +++ b/.github/workflows/client-sdks.yml @@ -234,6 +234,7 @@ jobs: run: xcrun simctl shutdown "$SIMULATOR" || true - name: Build swift_demo + id: build-demo working-directory: examples/voice_agents/swift_demo/app timeout-minutes: 10 run: | @@ -241,11 +242,12 @@ jobs: -clonedSourcePackagesDirPath "$RUNNER_TEMP/spm" -derivedDataPath "$RUNNER_TEMP/SwiftDemoDerivedData" build # Saved even when a test fails, so a red run still leaves the next one a warm cache. Not - # from a cancelled run or a failed core build, whose fetch may have stopped half way: a - # key once saved is restored as is and never saved again. + # from a cancelled run, a failed core build or a failed swift_demo build, whose fetch + # may have stopped half way: a key once saved is restored as is and never saved again. - uses: actions/cache/save@v4 if: >- !cancelled() && steps.packages.outcome == 'success' && steps.build-core.outcome == 'success' + && steps.build-demo.outcome != 'failure' && steps.packages.outputs.cache-hit != 'true' with: path: ${{ runner.temp }}/spm