Skip to content

Commit 4712118

Browse files
authored
Improve CI (#3641)
* Don't use xcbeautify It doesn't output test failure info in Swift Testing. * Force update * wip * wip * try less quiet xcbeautify * wip * wip * wip * Update Examples/VoiceMemos/VoiceMemosTests/VoiceMemosTests.swift * always skip release tests on Xcode <16 * wip * wip
1 parent c4d0d2f commit 4712118

File tree

4 files changed

+27
-20
lines changed

4 files changed

+27
-20
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Select Xcode ${{ matrix.xcode }}
2828
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
2929
- name: Update xcbeautify
30-
run: brew upgrade xcbeautify
30+
run: brew update && brew upgrade xcbeautify
3131
- name: List available devices
3232
run: xcrun simctl list devices available
3333
- name: Cache derived data
@@ -52,23 +52,27 @@ jobs:
5252
strategy:
5353
matrix:
5454
command: [test, '']
55-
platform: [IOS, MAC_CATALYST, MACOS, TVOS, VISIONOS, WATCHOS]
55+
platform:
56+
- IOS
57+
- MAC_CATALYST
58+
- MACOS
59+
- TVOS
60+
# - VISIONOS # Unfortunately, visionOS on CI is too flakey
61+
- WATCHOS
5662
xcode: [15.2, 15.4]
5763
exclude:
5864
- {xcode: 15.2, command: test}
5965
- {xcode: 15.4, command: ''}
6066
- {xcode: 15.2, platform: MAC_CATALYST}
6167
- {xcode: 15.2, platform: TVOS}
62-
- {xcode: 15.2, platform: VISIONOS}
68+
# - {xcode: 15.2, platform: VISIONOS}
6369
- {xcode: 15.2, platform: WATCHOS}
64-
include:
65-
- {xcode: 15.2, skip_release: 1}
6670
steps:
6771
- uses: actions/checkout@v4
6872
- name: Select Xcode ${{ matrix.xcode }}
6973
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
7074
- name: Update xcbeautify
71-
run: brew upgrade xcbeautify
75+
run: brew update && brew upgrade xcbeautify
7276
- name: Install visionOS runtime
7377
if: matrix.platform == 'visionOS'
7478
run: |
@@ -93,9 +97,6 @@ jobs:
9397
uses: chetan/git-restore-mtime-action@v2
9498
- name: Debug
9599
run: make XCODEBUILD_ARGUMENT="${{ matrix.command }}" CONFIG=Debug PLATFORM="${{ matrix.platform }}" WORKSPACE=.github/package.xcworkspace xcodebuild
96-
- name: Release
97-
if: matrix.skip_release != '1'
98-
run: make XCODEBUILD_ARGUMENT="${{ matrix.command }}" CONFIG=Release PLATFORM="${{ matrix.platform }}" WORKSPACE=.github/package.xcworkspace xcodebuild
99100

100101
library-evolution:
101102
name: Library (evolution)
@@ -105,7 +106,7 @@ jobs:
105106
- name: Select Xcode 15.4
106107
run: sudo xcode-select -s /Applications/Xcode_15.4.app
107108
- name: Update xcbeautify
108-
run: brew upgrade xcbeautify
109+
run: brew update && brew upgrade xcbeautify
109110
- name: Build for library evolution
110111
run: make build-for-library-evolution
111112

@@ -125,7 +126,7 @@ jobs:
125126
- name: Select Xcode 16
126127
run: sudo xcode-select -s /Applications/Xcode_16.2.app
127128
- name: Update xcbeautify
128-
run: brew upgrade xcbeautify
129+
run: brew update && brew upgrade xcbeautify
129130
- name: Set IgnoreFileSystemDeviceInodeChanges flag
130131
run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
131132
- name: Update mtime for incremental builds

Examples/VoiceMemos/VoiceMemosTests/VoiceMemosTests.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ struct VoiceMemosTests {
1212
@Test
1313
func recordAndPlayback() async throws {
1414
let didFinish = AsyncThrowingStream.makeStream(of: Bool.self)
15-
let clock = TestClock()
15+
// NB: We would prefer to use a test clock here, but due to testing async still being unreliable
16+
// in Swift, we will use a real clock and sleep, instead.
17+
// let clock = TestClock()
1618
let store = TestStore(initialState: VoiceMemos.State()) {
1719
VoiceMemos()
1820
} withDependencies: {
1921
$0.audioPlayer.play = { @Sendable _ in
20-
try await clock.sleep(for: .milliseconds(2_500))
22+
try await Task.sleep(for: .milliseconds(2_500))
2123
return true
2224
}
2325
$0.audioRecorder.currentTime = { 2.5 }
@@ -30,7 +32,7 @@ struct VoiceMemosTests {
3032
didFinish.continuation.finish()
3133
}
3234
$0.date = .constant(Date(timeIntervalSinceReferenceDate: 0))
33-
$0.continuousClock = clock
35+
$0.continuousClock = ContinuousClock()
3436
$0.temporaryDirectory = { URL(fileURLWithPath: "/tmp") }
3537
$0.uuid = .constant(deadbeefID)
3638
}
@@ -68,7 +70,7 @@ struct VoiceMemosTests {
6870
$0.voiceMemos[id: deadbeefURL]?.mode = .playing(progress: 0)
6971
}
7072
await store.receive(\.voiceMemos[id: deadbeefURL].delegate.playbackStarted)
71-
await clock.run()
73+
try await Task.sleep(for: .seconds(3))
7274

7375
await store.receive(\.voiceMemos[id: deadbeefURL].timerUpdated) {
7476
$0.voiceMemos[id: deadbeefURL]?.mode = .playing(progress: 0.2)
@@ -82,6 +84,9 @@ struct VoiceMemosTests {
8284
await store.receive(\.voiceMemos[id: deadbeefURL].timerUpdated) {
8385
$0.voiceMemos[id: deadbeefURL]?.mode = .playing(progress: 0.8)
8486
}
87+
await store.receive(\.voiceMemos[id: deadbeefURL].timerUpdated) {
88+
$0.voiceMemos[id: deadbeefURL]?.mode = .playing(progress: 1.0)
89+
}
8590
await store.receive(\.voiceMemos[id: deadbeefURL].audioPlayerClient.success) {
8691
$0.voiceMemos[id: deadbeefURL]?.mode = .notPlaying
8792
}

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ XCODEBUILD_FLAGS = \
3030

3131
XCODEBUILD_COMMAND = xcodebuild $(XCODEBUILD_ARGUMENT) $(XCODEBUILD_FLAGS)
3232

33+
# TODO: Prefer 'xcbeautify --quiet' when this is fixed:
34+
# https://github.com/cpisciotta/xcbeautify/issues/339
3335
ifneq ($(strip $(shell which xcbeautify)),)
34-
XCODEBUILD = set -o pipefail && $(XCODEBUILD_COMMAND) | xcbeautify --quiet
36+
XCODEBUILD = set -o pipefail && $(XCODEBUILD_COMMAND) | xcbeautify
3537
else
3638
XCODEBUILD = $(XCODEBUILD_COMMAND)
3739
endif

Tests/ComposableArchitectureTests/StoreLifetimeTests.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,20 +145,19 @@ final class StoreLifetimeTests: BaseTCATestCase {
145145

146146
@MainActor
147147
@available(*, deprecated)
148-
func testUnCachedStores() async {
148+
func testUnCachedStores() async throws {
149149
Logger.shared.isEnabled = true
150-
let clock = TestClock()
151150
let store = Store(initialState: Parent.State()) {
152151
Parent()
153152
} withDependencies: {
154-
$0.continuousClock = clock
153+
$0.continuousClock = ContinuousClock()
155154
}
156155
do {
157156
let child = store.scope(state: { $0.child }, action: { .child($0) })
158157
child.send(.start)
159158
XCTAssertEqual(store.withState(\.child.count), 1)
160159
}
161-
await clock.run(timeout: .seconds(5))
160+
try await Task.sleep(nanoseconds: 1_000_000_000)
162161
XCTAssertEqual(store.withState(\.child.count), 2)
163162
}
164163
}

0 commit comments

Comments
 (0)