Skip to content

Commit 0b964f6

Browse files
committed
Also run CI on Big Sur (#691)
* Also run CI on Big Sur * Update ci.yml * Fix * fix
1 parent 8d28ba6 commit 0b964f6

File tree

2 files changed

+86
-73
lines changed

2 files changed

+86
-73
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,21 @@ jobs:
2525
if: ${{ matrix.xcode != 11.3 }}
2626
run: make benchmark
2727

28+
library-beta:
29+
runs-on: macos-11.0
30+
strategy:
31+
matrix:
32+
xcode:
33+
- '13.0'
34+
steps:
35+
- uses: actions/checkout@v2
36+
- name: Select Xcode ${{ matrix.xcode }}
37+
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
38+
- name: Run tests
39+
run: make test-library
40+
- name: Run benchmark
41+
run: make benchmark
42+
2843
examples:
2944
runs-on: macos-10.15
3045
strategy:
@@ -38,20 +53,6 @@ jobs:
3853
- name: Run tests
3954
run: make test-examples
4055

41-
# NB: GitHub's Big Sur instances are super flaky. We should revisit later.
42-
# bigsur-tests:
43-
# runs-on: macos-11.0
44-
# strategy:
45-
# matrix:
46-
# xcode:
47-
# - 12.4
48-
# steps:
49-
# - uses: actions/checkout@v2
50-
# - name: Select Xcode ${{ matrix.xcode }}
51-
# run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
52-
# - name: Run tests
53-
# run: make test
54-
5556
swiftpm-linux:
5657
name: SwiftPM Linux
5758
runs-on: ubuntu-latest

Tests/ComposableArchitectureTests/ViewStoreTests.swift

Lines changed: 71 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -100,29 +100,29 @@ final class ViewStoreTests: XCTestCase {
100100

101101
#if canImport(Combine)
102102
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
103-
func testWillSet() {
103+
func testWillSet() {
104104
var cancellables: Set<AnyCancellable> = []
105105

106-
let reducer = Reducer<Int, Void, Void> { count, _, _ in
107-
count += 1
108-
return .none
109-
}
106+
let reducer = Reducer<Int, Void, Void> { count, _, _ in
107+
count += 1
108+
return .none
109+
}
110110

111-
let store = Store(initialState: 0, reducer: reducer, environment: ())
112-
let viewStore = ViewStore(store)
111+
let store = Store(initialState: 0, reducer: reducer, environment: ())
112+
let viewStore = ViewStore(store)
113113

114-
var results: [Int] = []
114+
var results: [Int] = []
115115

116-
viewStore.objectWillChange
117-
.sink { _ in results.append(viewStore.state) }
116+
viewStore.objectWillChange
117+
.sink { _ in results.append(viewStore.state) }
118118
.store(in: &cancellables)
119119

120-
viewStore.send(())
121-
viewStore.send(())
122-
viewStore.send(())
120+
viewStore.send(())
121+
viewStore.send(())
122+
viewStore.send(())
123123

124-
XCTAssertEqual([0, 1, 2], results)
125-
}
124+
XCTAssertEqual([0, 1, 2], results)
125+
}
126126
#endif
127127

128128
// disabled as the fix for this would be onerous with
@@ -145,61 +145,73 @@ final class ViewStoreTests: XCTestCase {
145145
}
146146

147147
#if compiler(>=5.5)
148-
@available(iOS 15, macOS 12, tvOS 15, watchOS 8, *)
149-
func testSendWhile() async {
150-
enum Action {
151-
case response
152-
case tapped
153-
}
154-
let reducer = Reducer<Bool, Action, Void> { state, action, environment in
155-
switch action {
156-
case .response:
157-
state = false
158-
return .none
159-
case .tapped:
160-
state = true
161-
return Effect(value: .response)
148+
func testSendWhile() {
149+
guard #available(iOS 15, macOS 12, tvOS 15, watchOS 8, *) else { return }
150+
151+
let expectation = self.expectation(description: "await")
152+
Task { @MainActor in
153+
enum Action {
154+
case response
155+
case tapped
156+
}
157+
let reducer = Reducer<Bool, Action, Void> { state, action, environment in
158+
switch action {
159+
case .response:
160+
state = false
161+
return .none
162+
case .tapped:
163+
state = true
164+
return Effect(value: .response)
162165
.start(on: QueueScheduler.main)
163166
.observe(on: QueueScheduler.main)
167+
}
164168
}
165-
}
166-
167-
let store = Store(initialState: false, reducer: reducer, environment: ())
168-
let viewStore = ViewStore(store)
169169

170-
XCTAssertEqual(viewStore.state, false)
171-
await viewStore.send(.tapped, while: { $0 })
172-
XCTAssertEqual(viewStore.state, false)
173-
}
170+
let store = Store(initialState: false, reducer: reducer, environment: ())
171+
let viewStore = ViewStore(store)
174172

175-
@available(iOS 15, macOS 12, tvOS 15, watchOS 8, *)
176-
func testSuspend() async {
177-
enum Action {
178-
case response
179-
case tapped
173+
XCTAssertEqual(viewStore.state, false)
174+
await viewStore.send(.tapped, while: { $0 })
175+
XCTAssertEqual(viewStore.state, false)
176+
expectation.fulfill()
177+
}
178+
self.wait(for: [expectation], timeout: 1)
180179
}
181-
let reducer = Reducer<Bool, Action, Void> { state, action, environment in
182-
switch action {
183-
case .response:
184-
state = false
185-
return .none
186-
case .tapped:
187-
state = true
188-
return Effect(value: .response)
180+
181+
func testSuspend() {
182+
guard #available(iOS 15, macOS 12, tvOS 15, watchOS 8, *) else { return }
183+
184+
let expectation = self.expectation(description: "await")
185+
Task { @MainActor in
186+
enum Action {
187+
case response
188+
case tapped
189+
}
190+
let reducer = Reducer<Bool, Action, Void> { state, action, environment in
191+
switch action {
192+
case .response:
193+
state = false
194+
return .none
195+
case .tapped:
196+
state = true
197+
return Effect(value: .response)
189198
.start(on: QueueScheduler.main)
190199
.observe(on: QueueScheduler.main)
200+
}
191201
}
192-
}
193202

194-
let store = Store(initialState: false, reducer: reducer, environment: ())
195-
let viewStore = ViewStore(store)
203+
let store = Store(initialState: false, reducer: reducer, environment: ())
204+
let viewStore = ViewStore(store)
196205

197-
XCTAssertEqual(viewStore.state, false)
198-
viewStore.send(.tapped)
199-
XCTAssertEqual(viewStore.state, true)
200-
await viewStore.suspend(while: { $0 })
201-
XCTAssertEqual(viewStore.state, false)
202-
}
206+
XCTAssertEqual(viewStore.state, false)
207+
viewStore.send(.tapped)
208+
XCTAssertEqual(viewStore.state, true)
209+
await viewStore.suspend(while: { $0 })
210+
XCTAssertEqual(viewStore.state, false)
211+
expectation.fulfill()
212+
}
213+
self.wait(for: [expectation], timeout: 1)
214+
}
203215
#endif
204216
}
205217

0 commit comments

Comments
 (0)