Skip to content

Commit a360176

Browse files
author
Tigran Hambardzumyan
authored
Merge pull request #11 from hamtiko/master
Release 1.0.0
2 parents f450333 + 2787b4f commit a360176

23 files changed

+1485
-172
lines changed

.github/workflows/CI.yml

Lines changed: 61 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,75 @@ on:
77
branches: [ master ]
88

99
jobs:
10-
build:
10+
MacOS:
11+
name: macOS
1112
runs-on: macos-10.15
1213
env:
13-
WORKSPACE: Example/STDevRxExt.xcworkspace
14-
DEVELOPER_DIR: /Applications/Xcode_11.app/Contents/Developer
14+
PROJECT: STDevRxExt.xcodeproj
15+
SCHEME: STDevRxExt-Package
16+
DEVELOPER_DIR: /Applications/Xcode_11.5.app/Contents/Developer
1517

1618
steps:
17-
1819
- uses: actions/checkout@v2
19-
20+
21+
- name: Bundle Install
22+
run: bundle install
23+
2024
- name: CocoaPods
2125
run: |
2226
gem install cocoapods
2327
pod install --project-directory=Example --repo-update
24-
28+
29+
- name: Restore SPM Cache
30+
uses: actions/cache@v1
31+
with:
32+
path: .build
33+
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
34+
restore-keys: |
35+
${{ runner.os }}-spm-
36+
37+
- name: Build and test (SPM)
38+
run: |
39+
swift build
40+
swift test
41+
42+
- name: Generate Xcodeproj
43+
run: |
44+
swift package generate-xcodeproj
45+
2546
- name: Test iOS
26-
run: xcodebuild test -enableCodeCoverage YES -workspace $WORKSPACE -scheme $SCHEME -destination "$DESTINATION" ONLY_ACTIVE_ARCH=NO | xcpretty
47+
run: |
48+
xcodebuild clean build test -project $PROJECT -scheme $SCHEME -destination "$DESTINATION" | XCPRETTY_JSON_FILE_OUTPUT="xcodebuild-ios.json" xcpretty -f `xcpretty-json-formatter`
2749
env:
28-
SCHEME: STDevRxExt-Example
29-
DESTINATION: 'platform=iOS Simulator,name=iPhone 8,OS=13.0'
30-
31-
- name: Pod Lib Lint
32-
run: pod lib lint --allow-warnings
50+
DESTINATION: platform=iOS Simulator,name=iPhone 11
51+
52+
- name: Test MacOS
53+
run: |
54+
xcodebuild clean build test -project $PROJECT -scheme $SCHEME -destination "$DESTINATION" | XCPRETTY_JSON_FILE_OUTPUT="xcodebuild-macos.json" xcpretty -f `xcpretty-json-formatter`
55+
env:
56+
DESTINATION: platform=OS X
57+
58+
- name: Test TVOS
59+
run: |
60+
xcodebuild clean build test -project $PROJECT -scheme $SCHEME -destination "$DESTINATION" | XCPRETTY_JSON_FILE_OUTPUT="xcodebuild-tvos.json" xcpretty -f `xcpretty-json-formatter`
61+
env:
62+
DESTINATION: platform=tvOS Simulator,name=Apple TV 4K (at 1080p)
63+
64+
- name: Build WatchOS
65+
run: xcodebuild clean build -project $PROJECT -scheme $SCHEME -destination "$DESTINATION"
66+
env:
67+
DESTINATION: name=Apple Watch Series 5 - 40mm
68+
69+
CocoaPods:
70+
name: CocoaPods
71+
runs-on: macos-10.15
72+
strategy:
73+
matrix:
74+
platform: ['ios', 'macos', 'tvos', 'watchos']
75+
env:
76+
DEVELOPER_DIR: /Applications/Xcode_11.5.app/Contents/Developer
77+
steps:
78+
- uses: actions/checkout@v1
79+
80+
- name: CocoaPods ${{ matrix.platform }}
81+
run: pod lib lint --skip-tests --allow-warnings --verbose --platforms=${{ matrix.platform }}

.github/workflows/release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: '*'
6+
7+
jobs:
8+
push:
9+
runs-on: macos-10.15
10+
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Deploy to Cocoapods
15+
run: |
16+
set -eo pipefail
17+
pod lib lint --allow-warnings
18+
pod trunk push --allow-warnings
19+
env:
20+
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ Carthage/Build
3535
# `pod install` in .travis.yml
3636
#
3737
Pods/
38+
39+
# Swift Package Manager
40+
.build
41+
Package.resolved

.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Example.playground/Contents.swift

Lines changed: 12 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -8,57 +8,49 @@
88
----
99
*/
1010

11-
import UIKit
12-
import STDevRxExt
13-
import RxSwift
1411
import RxCocoa
12+
import RxSwift
13+
import STDevRxExt
14+
import UIKit
1515

1616
/*:
1717
## Filter Extensions
18-
*/
18+
*/
1919

2020
example("allowTrue") {
21-
2221
let disposeBag = DisposeBag()
2322

2423
Observable.of(true, false, false, true, true)
2524
.allowTrue()
2625
.subscribe(onNext: { dump($0) })
2726
.disposed(by: disposeBag)
28-
2927
}
3028

3129
example("allowTrue Optional") {
32-
3330
let disposeBag = DisposeBag()
3431

3532
Observable.of(true, false, nil, true, nil, true)
3633
.allowTrue()
3734
.subscribe(onNext: { dump($0) })
3835
.disposed(by: disposeBag)
39-
4036
}
4137

4238
example("allowFalse") {
43-
4439
let disposeBag = DisposeBag()
4540

4641
Observable.of(true, false, false, true, false)
4742
.allowFalse()
4843
.subscribe(onNext: { dump($0) })
4944
.disposed(by: disposeBag)
50-
5145
}
5246

5347
example("allowFalse Optional") {
54-
5548
let disposeBag = DisposeBag()
5649

5750
Observable.of(true, false, nil, true, nil, true, false)
5851
.allowFalse()
5952
.subscribe(onNext: { dump($0) })
6053
.disposed(by: disposeBag)
61-
6254
}
6355

6456
example("allowTrueOrNil") {
@@ -68,7 +60,6 @@ example("allowTrueOrNil") {
6860
.allowTrueOrNil()
6961
.subscribe(onNext: { dump($0) })
7062
.disposed(by: disposeBag)
71-
7263
}
7364

7465
example("allowFalseOrNil") {
@@ -78,57 +69,6 @@ example("allowFalseOrNil") {
7869
.allowFalseOrNil()
7970
.subscribe(onNext: { dump($0) })
8071
.disposed(by: disposeBag)
81-
82-
}
83-
84-
example("filterIfNil") {
85-
86-
let disposeBag = DisposeBag()
87-
88-
var optional: String? = nil
89-
90-
let subject = PublishSubject<String>()
91-
92-
subject
93-
.filterIfNil(optional)
94-
.subscribe(onNext: { dump($0, name: "Subscription1") })
95-
.disposed(by: disposeBag)
96-
97-
optional = "enable"
98-
99-
subject
100-
.filterIfNil(optional)
101-
.subscribe(onNext: { dump($0, name: "Subscription2") })
102-
.disposed(by: disposeBag)
103-
104-
subject.onNext("🐹")
105-
106-
subject.onNext("🐭")
107-
}
108-
109-
example("filterIfNotNil") {
110-
111-
let disposeBag = DisposeBag()
112-
113-
var optional: String? = nil
114-
115-
let subject = PublishSubject<String>()
116-
117-
subject
118-
.filterIfNotNil(optional)
119-
.subscribe(onNext: { dump($0, name: "Subscription1") })
120-
.disposed(by: disposeBag)
121-
122-
optional = "enable"
123-
124-
subject
125-
.filterIfNotNil(optional)
126-
.subscribe(onNext: { dump($0, name: "Subscription2") })
127-
.disposed(by: disposeBag)
128-
129-
subject.onNext("🐹")
130-
131-
subject.onNext("🐭")
13272
}
13373

13474
example("Allow nil") {
@@ -142,28 +82,25 @@ example("Allow nil") {
14282

14383
/*:
14484
## Map Extensions
145-
*/
85+
*/
14686

14787
example("map(to:)") {
148-
14988
let disposeBag = DisposeBag()
15089

15190
Observable.of(1, 5, 7, 8)
15291
.map(to: "ping")
15392
.subscribe(onNext: { dump($0 as String) })
15493
.disposed(by: disposeBag)
155-
15694
}
15795

15896
example("map(at:)") {
97+
let disposeBag = DisposeBag()
15998

160-
let disposeBag = DisposeBag()
161-
162-
let observable = Observable.of(
163-
Book(title: "Twenty Thousand Leagues Under the Sea", author: Author("Jules", "Verne")),
164-
Book(title: "Hamlet", author: Author("William", "Shakespeare")),
165-
Book(title: "Hearts of Three", author: Author("Jack", "London"))
166-
)
99+
let observable = Observable.of(
100+
Book(title: "Twenty Thousand Leagues Under the Sea", author: Author("Jules", "Verne")),
101+
Book(title: "Hamlet", author: Author("William", "Shakespeare")),
102+
Book(title: "Hearts of Three", author: Author("Jack", "London"))
103+
)
167104

168105
observable
169106
.map(at: \.title)
@@ -174,12 +111,10 @@ example("map(at:)") {
174111
.map(at: \.author.firstName)
175112
.subscribe(onNext: { dump($0) })
176113
.disposed(by: disposeBag)
177-
178114
}
179-
180115
/*:
181116
## Cast Extensions
182-
*/
117+
*/
183118

184119
example("cast(to:)") {
185120
let disposeBag = DisposeBag()
@@ -188,7 +123,6 @@ example("cast(to:)") {
188123
.cast(to: String.self)
189124
.subscribe(onNext: { dump($0) })
190125
.disposed(by: disposeBag)
191-
192126
}
193127

194128
example("forceCast(to:)") {
@@ -198,7 +132,6 @@ example("forceCast(to:)") {
198132
.forceCast(to: String.self)
199133
.subscribe(onNext: { dump($0) })
200134
.disposed(by: disposeBag)
201-
202135
}
203136

204137
/*:
@@ -218,6 +151,4 @@ example("update(_:with:)") {
218151
.update(subject, with: true)
219152
.subscribe(onNext: { dump($0) })
220153
.disposed(by: disposeBag)
221-
222-
223154
}

Example/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ SPEC CHECKSUMS:
2626
RxCocoa: 32065309a38d29b5b0db858819b5bf9ef038b601
2727
RxRelay: d77f7d771495f43c556cbc43eebd1bb54d01e8e9
2828
RxSwift: 81470a2074fa8780320ea5fe4102807cb7118178
29-
STDevRxExt: 2bd7d233a4990c8e227b6af52ac3cc51e7ecb333
29+
STDevRxExt: 57d7368115b81b92e06728276504ece2c52fda2b
3030

3131
PODFILE CHECKSUM: 83769abc0b7bdc83a928dcac34cf2b1154077760
3232

33-
COCOAPODS: 1.9.1
33+
COCOAPODS: 1.9.3

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'xcpretty'
4+
gem 'xcpretty-json-formatter'

Gemfile.lock

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
rouge (2.0.7)
5+
xcpretty (0.3.0)
6+
rouge (~> 2.0.7)
7+
xcpretty-json-formatter (0.1.1)
8+
xcpretty (~> 0.2, >= 0.0.7)
9+
10+
PLATFORMS
11+
ruby
12+
13+
DEPENDENCIES
14+
xcpretty
15+
xcpretty-json-formatter
16+
17+
BUNDLED WITH
18+
2.1.4

Package.swift

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// swift-tools-version:5.0
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "STDevRxExt",
7+
platforms: [
8+
.macOS(.v10_10), .iOS(.v8), .tvOS(.v9), .watchOS(.v3),
9+
],
10+
products: [
11+
.library(
12+
name: "STDevRxExt",
13+
targets: ["STDevRxExt"]
14+
),
15+
],
16+
dependencies: [
17+
.package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "5.1.0")),
18+
],
19+
targets: [
20+
.target(
21+
name: "STDevRxExt",
22+
dependencies: [
23+
.product(name: "RxSwift", package: "RxSwift"),
24+
.product(name: "RxCocoa", package: "RxSwift"),
25+
]
26+
),
27+
.testTarget(
28+
name: "STDevRxExtTests",
29+
dependencies: [
30+
"STDevRxExt",
31+
.product(name: "RxTest", package: "RxSwift")
32+
]
33+
),
34+
],
35+
swiftLanguageVersions: [.v5]
36+
)

0 commit comments

Comments
 (0)