Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
18 changes: 12 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Select Xcode ${{ matrix.xcode }}
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
- name: Update xcbeautify
run: brew upgrade xcbeautify
run: brew update && brew upgrade xcbeautify
- name: List available devices
run: xcrun simctl list devices available
- name: Cache derived data
Expand All @@ -52,14 +52,20 @@ jobs:
strategy:
matrix:
command: [test, '']
platform: [IOS, MAC_CATALYST, MACOS, TVOS, VISIONOS, WATCHOS]
platform:
- IOS
- MAC_CATALYST
- MACOS
- TVOS
# - VISIONOS # Unfortunately, visionOS on CI is too flakey
- WATCHOS
xcode: [15.2, 15.4]
exclude:
- {xcode: 15.2, command: test}
- {xcode: 15.4, command: ''}
- {xcode: 15.2, platform: MAC_CATALYST}
- {xcode: 15.2, platform: TVOS}
- {xcode: 15.2, platform: VISIONOS}
# - {xcode: 15.2, platform: VISIONOS}
- {xcode: 15.2, platform: WATCHOS}
include:
- {xcode: 15.2, skip_release: 1}
Expand All @@ -68,7 +74,7 @@ jobs:
- name: Select Xcode ${{ matrix.xcode }}
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
- name: Update xcbeautify
run: brew upgrade xcbeautify
run: brew update && brew upgrade xcbeautify
- name: Install visionOS runtime
if: matrix.platform == 'visionOS'
run: |
Expand Down Expand Up @@ -105,7 +111,7 @@ jobs:
- name: Select Xcode 15.4
run: sudo xcode-select -s /Applications/Xcode_15.4.app
- name: Update xcbeautify
run: brew upgrade xcbeautify
run: brew update && brew upgrade xcbeautify
- name: Build for library evolution
run: make build-for-library-evolution

Expand All @@ -125,7 +131,7 @@ jobs:
- name: Select Xcode 16
run: sudo xcode-select -s /Applications/Xcode_16.2.app
- name: Update xcbeautify
run: brew upgrade xcbeautify
run: brew update && brew upgrade xcbeautify
- name: Set IgnoreFileSystemDeviceInodeChanges flag
run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
- name: Update mtime for incremental builds
Expand Down
13 changes: 9 additions & 4 deletions Examples/VoiceMemos/VoiceMemosTests/VoiceMemosTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ struct VoiceMemosTests {
@Test
func recordAndPlayback() async throws {
let didFinish = AsyncThrowingStream.makeStream(of: Bool.self)
let clock = TestClock()
// NB: We would prefer to use a test clock here, but due to testing async still being unreliable
// in Swift, we will use a real clock and sleep, instead.
// let clock = TestClock()
let store = TestStore(initialState: VoiceMemos.State()) {
VoiceMemos()
} withDependencies: {
$0.audioPlayer.play = { @Sendable _ in
try await clock.sleep(for: .milliseconds(2_500))
try await Task.sleep(for: .milliseconds(2_500))
return true
}
$0.audioRecorder.currentTime = { 2.5 }
Expand All @@ -30,7 +32,7 @@ struct VoiceMemosTests {
didFinish.continuation.finish()
}
$0.date = .constant(Date(timeIntervalSinceReferenceDate: 0))
$0.continuousClock = clock
$0.continuousClock = ContinuousClock()
$0.temporaryDirectory = { URL(fileURLWithPath: "/tmp") }
$0.uuid = .constant(deadbeefID)
}
Expand Down Expand Up @@ -68,7 +70,7 @@ struct VoiceMemosTests {
$0.voiceMemos[id: deadbeefURL]?.mode = .playing(progress: 0)
}
await store.receive(\.voiceMemos[id: deadbeefURL].delegate.playbackStarted)
await clock.run()
try await Task.sleep(nanoseconds: 3_000_000_000)

await store.receive(\.voiceMemos[id: deadbeefURL].timerUpdated) {
$0.voiceMemos[id: deadbeefURL]?.mode = .playing(progress: 0.2)
Expand All @@ -82,6 +84,9 @@ struct VoiceMemosTests {
await store.receive(\.voiceMemos[id: deadbeefURL].timerUpdated) {
$0.voiceMemos[id: deadbeefURL]?.mode = .playing(progress: 0.8)
}
await store.receive(\.voiceMemos[id: deadbeefURL].timerUpdated) {
$0.voiceMemos[id: deadbeefURL]?.mode = .playing(progress: 1.0)
}
await store.receive(\.voiceMemos[id: deadbeefURL].audioPlayerClient.success) {
$0.voiceMemos[id: deadbeefURL]?.mode = .notPlaying
}
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ XCODEBUILD_FLAGS = \

XCODEBUILD_COMMAND = xcodebuild $(XCODEBUILD_ARGUMENT) $(XCODEBUILD_FLAGS)

# TODO: Prefer 'xcbeautify --quiet' when this is fixed:
# https://github.com/cpisciotta/xcbeautify/issues/339
ifneq ($(strip $(shell which xcbeautify)),)
XCODEBUILD = set -o pipefail && $(XCODEBUILD_COMMAND) | xcbeautify --quiet
XCODEBUILD = set -o pipefail && $(XCODEBUILD_COMMAND) | xcbeautify
else
XCODEBUILD = $(XCODEBUILD_COMMAND)
endif
Expand Down
7 changes: 3 additions & 4 deletions Tests/ComposableArchitectureTests/StoreLifetimeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,20 +145,19 @@ final class StoreLifetimeTests: BaseTCATestCase {

@MainActor
@available(*, deprecated)
func testUnCachedStores() async {
func testUnCachedStores() async throws {
Logger.shared.isEnabled = true
let clock = TestClock()
let store = Store(initialState: Parent.State()) {
Parent()
} withDependencies: {
$0.continuousClock = clock
$0.continuousClock = ContinuousClock()
}
do {
let child = store.scope(state: { $0.child }, action: { .child($0) })
child.send(.start)
XCTAssertEqual(store.withState(\.child.count), 1)
}
await clock.run(timeout: .seconds(5))
try await Task.sleep(nanoseconds: 1_000_000_000)
XCTAssertEqual(store.withState(\.child.count), 2)
}
}
Expand Down