Skip to content

Start running some tests in release config. #1405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ jobs:
strategy:
matrix:
xcode: ['13.4.1', '14.0']
config: ['debug', 'release']
steps:
- uses: actions/checkout@v2
- name: Select Xcode ${{ matrix.xcode }}
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
- name: Run tests
run: make test-library
- name: Run ${{ matrix.config }} tests
run: make test-library-${{ matrix.config }}
- name: Compile documentation
if: ${{ matrix.xcode == '13.4.1' }}
if: ${{ matrix.xcode == '14.0' }}
run: make test-docs
- name: Run benchmark
run: make benchmark
Expand Down
25 changes: 23 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ default: test-all

test-all: test-library test-examples

test-library:
test-library-debug:
xcodebuild test \
-workspace ComposableArchitecture.xcworkspace \
-scheme ComposableArchitecture \
Expand All @@ -23,7 +23,28 @@ test-library:
xcodebuild \
-workspace ComposableArchitecture.xcworkspace \
-scheme ComposableArchitecture \
-destination platform="$(PLATFORM_WATCHOS)"
-destination generic/platform=watchOS
test-library-release:
xcodebuild test \
-configuration release \
-workspace ComposableArchitecture.xcworkspace \
-scheme ComposableArchitecture \
-destination platform="$(PLATFORM_IOS)"
xcodebuild test \
-configuration release \
-workspace ComposableArchitecture.xcworkspace \
-scheme ComposableArchitecture \
-destination platform="$(PLATFORM_MACOS)"
xcodebuild test \
-configuration release \
-workspace ComposableArchitecture.xcworkspace \
-scheme ComposableArchitecture \
-destination platform="$(PLATFORM_TVOS)"
xcodebuild \
-configuration release \
-workspace ComposableArchitecture.xcworkspace \
-scheme ComposableArchitecture \
-destination generic/platform=watchOS

DOC_WARNINGS := $(shell xcodebuild clean docbuild \
-scheme ComposableArchitecture \
Expand Down
9 changes: 7 additions & 2 deletions Sources/ComposableArchitecture/Store.swift
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ public typealias StoreOf<R: ReducerProtocol> = Store<R.State, R.Action>
>: ReducerProtocol {
let rootStore: Store<RootState, RootAction>
let toScopedState: (RootState) -> ScopedState
private let parentStores: [Any]
let fromScopedAction: (ScopedAction) -> RootAction
private(set) var isSending = false

Expand All @@ -589,18 +590,21 @@ public typealias StoreOf<R: ReducerProtocol> = Store<R.State, R.Action>
where RootState == ScopedState, RootAction == ScopedAction {
self.rootStore = rootStore
self.toScopedState = { $0 }
self.parentStores = []
self.fromScopedAction = { $0 }
}

@inlinable
init(
rootStore: Store<RootState, RootAction>,
state toScopedState: @escaping (RootState) -> ScopedState,
action fromScopedAction: @escaping (ScopedAction) -> RootAction
action fromScopedAction: @escaping (ScopedAction) -> RootAction,
parentStores: [Any]
) {
self.rootStore = rootStore
self.toScopedState = toScopedState
self.fromScopedAction = fromScopedAction
self.parentStores = parentStores
}

@inlinable
Expand Down Expand Up @@ -641,7 +645,8 @@ public typealias StoreOf<R: ReducerProtocol> = Store<R.State, R.Action>
let reducer = ScopedReducer<RootState, RootAction, RescopedState, RescopedAction>(
rootStore: self.rootStore,
state: { toRescopedState(toScopedState($0)) },
action: { fromScopedAction(fromRescopedAction($0)) }
action: { fromScopedAction(fromRescopedAction($0)) },
parentStores: self.parentStores + [store]
)
let childStore = Store<RescopedState, RescopedAction>(
initialState: toRescopedState(store.state.value),
Expand Down
Loading