Skip to content

Commit

Permalink
Fix CI for Xcode 15.3 & iOS 17
Browse files Browse the repository at this point in the history
Disable Linux, for now

Xcode 15.3

endless fixes

Move foo test class out of test

vision darwin

macOS arch

more

beautify

Use built-in Swift runtime
  • Loading branch information
freak4pc committed Apr 20, 2024
1 parent de14b86 commit 2c8061b
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 45 deletions.
29 changes: 17 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ on:
workflow_dispatch:

jobs:
xcode14:
name: "Xcode 14"
runs-on: macos-latest
xcode15:
name: "Xcode 15"
runs-on: macos-14

strategy:
fail-fast: false
Expand All @@ -19,15 +19,20 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Select Xcode 15.3
run: sudo xcode-select -s /Applications/Xcode_15.3.app
- name: Run Tests
run: CI=1 ./scripts/all-tests.sh "${{ matrix.environment }}"
linux:
name: "Test (Linux)"
runs-on: ubuntu-latest

# We're having some issues with the Linux tests, so we're disabling them for now.
# Hopefully we'll be able to fix and re-enable them soon.
# Even more hopefully that I won't git blame this comment in the future and see it was 5 years ago :)

steps:
- name: Swift 5.5 Docker Container
uses: docker://swift:5.5.0-slim
- uses: actions/checkout@v3
- name: Run tests
run: CI=1 ./scripts/all-tests.sh "Unix"
# linux:
# name: "Test (Linux)"
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v3
# - name: Run tests
# run: CI=1 ./scripts/all-tests.sh "Unix"
1 change: 0 additions & 1 deletion .jazzy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ custom_categories:
- RxCollectionViewDataSourcePrefetchingProxy
- RxCollectionViewDataSourceProxy
- RxCollectionViewDelegateProxy
- RxDelegateProxyCrashFix
- RxNavigationControllerDelegateProxy
- RxPickerViewDataSourceProxy
- RxPickerViewDelegateProxy
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ All contributions are handled via Pull Requests (PRs). Your PR _must_ target the

Before submitting a pull request please make sure **`./scripts/all-tests.sh`** is passing (exits with 0), otherwise we won't be able to pull your code.

To be able to run `./scripts/all-tests.sh`, you'll need to install [xcpretty](https://github.com/supermarin/xcpretty).
To be able to run `./scripts/all-tests.sh`, you'll need to install [xcbeautify](https://github.com/cpisciotta/xcbeautify).

`sudo gem install xcpretty`
`brew install xcbeautify`

Once the tests pass, you can push your feature branch to your clone of the repository, then open a pull request. There are some best practices that will be followed during the development of this project for common good ([Gitflow](http://nvie.com/posts/a-successful-git-branching-model/) branching model).

Expand Down
2 changes: 1 addition & 1 deletion Platform/Platform.Darwin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)

import Darwin
import Foundation
Expand Down
2 changes: 2 additions & 0 deletions Sources/AllTestz/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1657,6 +1657,8 @@ final class ObservableTest_ : ObservableTest, RxTestCase {
("testAsObservable_hides", ObservableTest.testAsObservable_hides),
("testAsObservable_never", ObservableTest.testAsObservable_never),
("testSubscribeWithNext", ObservableTest.testSubscribeWithNext),
("testDeferredFactoryClosureLifetime", ObservableTest.testDeferredFactoryClosureLifetime),
("testObservableFactoryClosureLifetime", ObservableTest.testObservableFactoryClosureLifetime),
] }
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/RxCocoaTests/DelegateProxyTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,6 @@ extension MockTestDelegateProtocol
: UIPickerViewDelegate
{
}
#endif

@objc class MockDelegate: NSObject, UICollectionViewDelegate {
@objc var demoText: String {
Expand All @@ -799,3 +798,4 @@ extension DelegateProxyTest {
}
}
}
#endif
30 changes: 15 additions & 15 deletions Tests/RxSwiftTests/Observable+Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -229,26 +229,26 @@ extension ObservableTest {
}

// MARK: - Deferred
extension ObservableTest {
func testDeferredFactoryClosureLifetime() {
class Foo {
let expectation: XCTestExpectation
private class DeferredExpectation {
let expectation: XCTestExpectation

init(expectation: XCTestExpectation) {
self.expectation = expectation
}
init(expectation: XCTestExpectation) {
self.expectation = expectation
}

func bar() -> Observable<Void> {
Observable<Void>
.deferred {
self.expectation.fulfill()
return .never()
}
func bar() -> Observable<Void> {
Observable<Void>
.deferred {
self.expectation.fulfill()
return .never()
}
}
}
}

extension ObservableTest {
func testDeferredFactoryClosureLifetime() {
let factoryClosureInvoked = expectation(description: "Factory closure has been invoked")
var foo: Foo? = Foo(expectation: factoryClosureInvoked)
var foo: DeferredExpectation? = DeferredExpectation(expectation: factoryClosureInvoked)
weak var initialFoo = foo

let disposable = foo?.bar().subscribe()
Expand Down
24 changes: 12 additions & 12 deletions scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,28 @@ BOLDWHITE="\033[1m\033[37m"

# make sure all tests are passing
if [[ `uname` == "Darwin" ]]; then
echo "🏔 Running iOS 16 / Xcode 14"
echo "🏔 Running iOS 17 / Xcode 15"

if [ `xcrun simctl list runtimes | grep com.apple.CoreSimulator.SimRuntime.iOS-16- | wc -l` -ge 1 ]; then
DEFAULT_IOS_SIMULATOR=RxSwiftTest/iPhone-14/iOS/16.2
if [ `xcrun simctl list runtimes | grep com.apple.CoreSimulator.SimRuntime.iOS-17- | wc -l` -ge 1 ]; then
DEFAULT_IOS_SIMULATOR=RxSwiftTest/iPhone-15/iOS/17.4
else
echo "No iOS 16.* Simulator found, available runtimes are:"
echo "No iOS 17.* Simulator found, available runtimes are:"
xcrun simctl list runtimes
exit -1
fi

if [ `xcrun simctl list runtimes | grep com.apple.CoreSimulator.SimRuntime.watchOS-9- | wc -l` -ge 1 ]; then
DEFAULT_WATCHOS_SIMULATOR=RxSwiftTest/Apple-Watch-Series-8-45mm/watchOS/9.0
if [ `xcrun simctl list runtimes | grep com.apple.CoreSimulator.SimRuntime.watchOS-10- | wc -l` -ge 1 ]; then
DEFAULT_WATCHOS_SIMULATOR=RxSwiftTest/Apple-Watch-Series-9-45mm/watchOS/10.0
else
echo "No watchOS 9.* Simulator found, available runtimes are:"
echo "No watchOS 10.* Simulator found, available runtimes are:"
xcrun simctl list runtimes
exit -1
fi

if [ `xcrun simctl list runtimes | grep com.apple.CoreSimulator.SimRuntime.tvOS-16- | wc -l` -ge 1 ]; then
DEFAULT_TVOS_SIMULATOR=RxSwiftTest/Apple-TV-1080p/tvOS/16.0
if [ `xcrun simctl list runtimes | grep com.apple.CoreSimulator.SimRuntime.tvOS-17- | wc -l` -ge 1 ]; then
DEFAULT_TVOS_SIMULATOR=RxSwiftTest/Apple-TV-1080p/tvOS/17.0
else
echo "No tvOS 16.* Simulator found, available runtimes are:"
echo "No tvOS 17.* Simulator found, available runtimes are:"
xcrun simctl list runtimes
exit -1
fi
Expand Down Expand Up @@ -155,7 +155,7 @@ function action() {
echo "Running on ${DESTINATION}"
fi
else
DESTINATION='platform=macOS,arch=x86_64'
DESTINATION='platform=macOS'
fi

set -x
Expand All @@ -166,7 +166,7 @@ function action() {
-configuration "${CONFIGURATION}" \
-derivedDataPath "${BUILD_DIRECTORY}" \
-destination "$DESTINATION" \
$ACTION | tee build/last-build-output.txt | xcpretty -c
$ACTION | tee build/last-build-output.txt | xcbeautify
exitIfLastStatusWasUnsuccessful
set +x
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/validate-playgrounds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ do
PAGES_PATH=${BUILD_DIRECTORY}/Build/Products/${configuration}/all-playground-pages.swift
rx ${scheme} ${configuration} "" build
cat Rx.playground/Sources/*.swift Rx.playground/Pages/**/*.swift > ${PAGES_PATH}
swift -v -D NOT_IN_PLAYGROUND -target x86_64-apple-macosx10.10 -F ${BUILD_DIRECTORY}/Build/Products/${configuration} ${PAGES_PATH}
swift -v -D NOT_IN_PLAYGROUND -F ${BUILD_DIRECTORY}/Build/Products/${configuration} ${PAGES_PATH}
done
done

0 comments on commit 2c8061b

Please sign in to comment.