Skip to content

Commit d2a9021

Browse files
authored
Merge pull request #1224 from mxcl/prerelease-prep
prerelease prep
2 parents 6e3d236 + d79bba7 commit d2a9021

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+354
-367
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
- Sources/**
66
- Tests/**
77
- .github/workflows/ci.yml
8-
workflow_dispatch:
98
jobs:
109
auto-cancel:
1110
runs-on: ubuntu-latest
@@ -14,23 +13,22 @@ jobs:
1413

1514
linux:
1615
name: linux
17-
runs-on: ubuntu-18.04
16+
runs-on: ubuntu-latest
1817
strategy:
1918
matrix:
2019
swift:
2120
- 5.3
22-
- 5.4
21+
- 5.4-focal # Swift 5.4 requires llvm-cov v11
2322
container:
2423
image: swift:${{ matrix.swift }}
2524
steps:
2625
- uses: actions/checkout@v2
2726
- run: swift test --enable-code-coverage --parallel --enable-test-discovery
2827

2928
- name: Generate Coverage Report
30-
if: ${{ matrix.swift == '5.3' }} # 5.4 and above needs llvm-cov-12
3129
run: |
3230
apt-get -qq update
33-
apt-get -qq install curl
31+
apt-get -qq install curl # for codecov action 🙄
3432
b=$(swift build --show-bin-path)
3533
llvm-cov export \
3634
-format lcov \

.github/workflows/publish.yml

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,41 @@ on:
33
workflow_dispatch:
44
inputs:
55
version:
6-
description: Version to publish
6+
description: Version 🚀
77
required: true
88
jobs:
9-
ci:
9+
build:
1010
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
swift:
14+
- 5.3
15+
- 5.4
16+
container:
17+
image: swift:${{ matrix.swift }}
1118
steps:
12-
- uses: aurelien-baudet/workflow-dispatch@v2
13-
with:
14-
workflow: CI
15-
token: ${{ secrets.JAZZY_PAT }}
16-
wait-for-completion: true
19+
- uses: actions/checkout@v2
20+
- run: swift build
1721

1822
lint:
19-
runs-on: macos-10.15
23+
runs-on: macos-latest
2024
strategy:
2125
matrix:
2226
xcode:
23-
- ^10
24-
- ^11
25-
- ^12
27+
- '12.0'
28+
- '12.4'
2629
steps:
2730
- uses: maxim-lobanov/setup-xcode@v1
2831
with:
2932
xcode-version: ${{ matrix.xcode }}
3033
- uses: actions/checkout@v2
31-
with:
32-
submodules: true
3334
- run: pod lib lint --fail-fast
3435

3536
create-release:
3637
runs-on: ubuntu-latest
37-
needs: [ci, lint]
38-
env:
39-
v: ${{ github.event.inputs.version }}
38+
needs: [lint, build]
4039
steps:
4140
- uses: actions/checkout@v2
42-
with:
43-
fetch-depth: 0 # zero means “all” (or push fails)
44-
- name: Update committed versions
45-
run: |
46-
ruby -i -pe "sub(/CURRENT_PROJECT_VERSION = [0-9.]+/, 'CURRENT_PROJECT_VERSION = $v')" PromiseKit.xcodeproj/project.pbxproj
47-
ruby -i -pe "sub(/s.version = '[0-9.]+'/, 's.version = \'$v\'')" PromiseKit.podspec
48-
- run: |
49-
! (git diff --quiet)
50-
- name: Commit
51-
run: |
52-
git config user.name github-actions
53-
git config user.email github-actions@github.com
54-
git commit -am "PromiseKit $v"
55-
git push
5641
- uses: softprops/action-gh-release@v1
5742
env:
5843
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -69,5 +54,4 @@ jobs:
6954
workflow: CD
7055
token: ${{ secrets.JAZZY_PAT }}
7156
inputs: "{\"version\": \"${{ github.event.inputs.version }}\"}"
72-
ref: master # or doesn’t use our new commit above
73-
wait-for-completion: true
57+
wait-for-completion: false

Documents/Cancel.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ PromiseKit 7 adds clear and concise cancellation abilities to promises and to th
55
```swift
66
UIApplication.shared.isNetworkActivityIndicatorVisible = true
77

8-
let fetchImage = URLSession.shared.dataTask(.promise, with: url).cancellize().compactMap{ UIImage(data: $0.data) }
8+
let fetchImage = URLSession.shared.dataTask(.promise, with: url)
9+
.cancellize()
10+
.compactMap{ UIImage(data: $0.data) }
911
let fetchLocation = CLLocationManager.requestLocation().cancellize().lastValue
1012

1113
let finalizer = firstly {
@@ -16,20 +18,23 @@ let finalizer = firstly {
1618
}.ensure {
1719
UIApplication.shared.isNetworkActivityIndicatorVisible = false
1820
}.catch(policy: .allErrors) { error in
19-
/* 'catch' will be invoked with 'PMKError.cancelled' when cancel is called on the context.
20-
Use the default policy of '.allErrorsExceptCancellation' to ignore cancellation errors. */
21+
// `catch` will be invoked with `PMKError.cancelled` when cancel is called
22+
// on the context. Use the default policy of `.allErrorsExceptCancellation`
23+
// to ignore cancellation errors.
2124
self.show(UIAlertController(for: error), sender: self)
2225
}
2326

2427
//
2528

26-
// Cancel currently active tasks and reject all cancellable promises with 'PMKError.cancelled'.
27-
// 'cancel()' can be called from any thread at any time.
29+
// Cancel currently active tasks and reject all cancellable promises
30+
// with 'PMKError.cancelled'. `cancel()` can be called from any thread
31+
// at any time.
2832
finalizer.cancel()
2933

30-
/* 'finalizer' here refers to the 'CancellableFinalizer' for the chain. Calling 'cancel' on
31-
any promise in the chain or on the finalizer cancels the entire chain. Therefore
32-
calling 'cancel' on the finalizer cancels everything. */
34+
// `finalizer` here refers to the `CancellableFinalizer` for the chain.
35+
// Calling 'cancel' on any promise in the chain or on the finalizer
36+
// cancels the entire chain. Therefore calling `cancel` on the finalizer
37+
// cancels everything.
3338
```
3439

3540
# Cancel Chains

Tests/Cancel/AfterTests.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,36 @@ class AfterTests: XCTestCase {
1515
let ex2 = expectation(description: "")
1616
let cc2 = after(seconds: 0).cancellize().done(fail).catch(policy: .allErrors, ex2.fulfill)
1717
cc2.cancel()
18-
waitForExpectations(timeout: 2, handler: nil)
18+
waitForExpectations(timeout: 5, handler: nil)
1919

2020
let ex3 = expectation(description: "")
2121
let cc3 = after(.seconds(0)).cancellize().done(fail).catch(policy: .allErrors, ex3.fulfill)
2222
cc3.cancel()
23-
waitForExpectations(timeout: 2, handler: nil)
23+
waitForExpectations(timeout: 5, handler: nil)
2424
}
2525

2626
func testNegative() {
2727
let ex2 = expectation(description: "")
2828
let cc2 = after(seconds: -1).cancellize().done(fail).catch(policy: .allErrors, ex2.fulfill)
2929
cc2.cancel()
30-
waitForExpectations(timeout: 2, handler: nil)
30+
waitForExpectations(timeout: 5, handler: nil)
3131

3232
let ex3 = expectation(description: "")
3333
let cc3 = after(.seconds(-1)).cancellize().done(fail).catch(policy: .allErrors, ex3.fulfill)
3434
cc3.cancel()
35-
waitForExpectations(timeout: 2, handler: nil)
35+
waitForExpectations(timeout: 5, handler: nil)
3636
}
3737

3838
func testPositive() {
3939
let ex2 = expectation(description: "")
4040
let cc2 = after(seconds: 1).cancellize().done(fail).catch(policy: .allErrors, ex2.fulfill)
4141
cc2.cancel()
42-
waitForExpectations(timeout: 2, handler: nil)
42+
waitForExpectations(timeout: 5, handler: nil)
4343

4444
let ex3 = expectation(description: "")
4545
let cc3 = after(.seconds(1)).cancellize().done(fail).catch(policy: .allErrors, ex3.fulfill)
4646
cc3.cancel()
47-
waitForExpectations(timeout: 2, handler: nil)
47+
waitForExpectations(timeout: 5, handler: nil)
4848
}
4949

5050
func testCancellableAfter() {
@@ -87,7 +87,7 @@ class AfterTests: XCTestCase {
8787
error.isCancelled ? exCancel.fulfill() : XCTFail("unexpected error \(error)")
8888
}.cancel()
8989

90-
wait(for: [exComplete, exCancelComplete, exCancel], timeout: 1)
90+
wait(for: [exComplete, exCancelComplete, exCancel], timeout: 5)
9191
}
9292

9393
func testCancelForPromise_Done() {
@@ -104,7 +104,7 @@ class AfterTests: XCTestCase {
104104

105105
promise.cancel()
106106

107-
wait(for: [exComplete], timeout: 1)
107+
wait(for: [exComplete], timeout: 5)
108108
}
109109

110110
func testCancelForGuarantee_Done() {
@@ -116,6 +116,6 @@ class AfterTests: XCTestCase {
116116
error.isCancelled ? exComplete.fulfill() : XCTFail("error: \(error)")
117117
}.cancel()
118118

119-
wait(for: [exComplete], timeout: 1)
119+
wait(for: [exComplete], timeout: 5)
120120
}
121121
}

Tests/Cancel/CancelChain.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class CancelChain: XCTestCase {
154154
self.trace("SETUP COMPLETE")
155155

156156
let expectations = [ex.a, ex.b, ex.c, ex.d, ex.e, ex.cancelled].compactMap { $0 }
157-
wait(for: expectations, timeout: 1)
157+
wait(for: expectations, timeout: 5)
158158

159159
XCTAssert(c.pA.cancelContext.cancelAttempted)
160160
XCTAssert(ex.a == nil || isFulfilled(c.pB) || c.pB.cancelContext.cancelAttempted)

Tests/Cancel/CancellableErrorTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class CancellationTests: XCTestCase {
1919

2020
p.cancel(with: LocalError.cancel)
2121

22-
waitForExpectations(timeout: 1)
22+
waitForExpectations(timeout: 5)
2323
}
2424

2525
func testThrowCancellableErrorThatIsNotCancelled() {
@@ -34,7 +34,7 @@ class CancellationTests: XCTestCase {
3434

3535
cc.cancel(with: LocalError.notCancel)
3636

37-
waitForExpectations(timeout: 1)
37+
waitForExpectations(timeout: 5)
3838
}
3939

4040
func testRecoverWithCancellation() {
@@ -60,7 +60,7 @@ class CancellationTests: XCTestCase {
6060

6161
p.cancel(with: CocoaError.cancelled)
6262

63-
waitForExpectations(timeout: 1)
63+
waitForExpectations(timeout: 5)
6464
}
6565

6666
func testFoundationBridging1() {
@@ -79,7 +79,7 @@ class CancellationTests: XCTestCase {
7979

8080
p.cancel(with: CocoaError.cancelled)
8181

82-
waitForExpectations(timeout: 1)
82+
waitForExpectations(timeout: 5)
8383
}
8484

8585
func testFoundationBridging2() {
@@ -98,7 +98,7 @@ class CancellationTests: XCTestCase {
9898

9999
p.cancel(with: URLError.cancelled)
100100

101-
waitForExpectations(timeout: 1)
101+
waitForExpectations(timeout: 5)
102102
}
103103

104104
func testIsCancelled() {

Tests/Cancel/CancellablePromiseTests.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class CancellablePromiseTests: XCTestCase {
3737

3838
promise.cancel()
3939

40-
waitForExpectations(timeout: 1)
40+
waitForExpectations(timeout: 5)
4141
}
4242

4343
func testReturnTypeForAMultiLineClosureIsNotExplicitlyStated() {
@@ -56,7 +56,7 @@ class CancellablePromiseTests: XCTestCase {
5656
XCTFail()
5757
}
5858

59-
waitForExpectations(timeout: 1)
59+
waitForExpectations(timeout: 5)
6060
}
6161

6262
func testTryingToCancelAStandardPromiseChain() {
@@ -83,7 +83,7 @@ class CancellablePromiseTests: XCTestCase {
8383

8484
promise.cancel() /// <-- ERROR: Value of type 'PMKFinalizer' has no member 'cancel'
8585

86-
waitForExpectations(timeout: 1)
86+
waitForExpectations(timeout: 5)
8787
}
8888

8989
func testCancel() {
@@ -100,7 +100,7 @@ class CancellablePromiseTests: XCTestCase {
100100
p.resolver.fulfill(3)
101101
p.promise.cancel()
102102

103-
wait(for: [ex], timeout: 1)
103+
wait(for: [ex], timeout: 5)
104104
}
105105

106106
func testFirstly() {
@@ -116,7 +116,7 @@ class CancellablePromiseTests: XCTestCase {
116116
$0.isCancelled ? ex.fulfill() : XCTFail()
117117
}.cancel()
118118

119-
wait(for: [ex], timeout: 1)
119+
wait(for: [ex], timeout: 5)
120120
}
121121

122122
func testFirstlyWithPromise() {
@@ -132,7 +132,7 @@ class CancellablePromiseTests: XCTestCase {
132132
$0.isCancelled ? ex.fulfill() : XCTFail("\($0)")
133133
}.cancel()
134134

135-
wait(for: [ex], timeout: 1)
135+
wait(for: [ex], timeout: 5)
136136
}
137137

138138
func testThenMapSuccess() {
@@ -147,7 +147,7 @@ class CancellablePromiseTests: XCTestCase {
147147
}.catch(policy: .allErrors) { _ in
148148
XCTFail()
149149
}
150-
waitForExpectations(timeout: 1)
150+
waitForExpectations(timeout: 5)
151151
}
152152

153153
func testThenMapCancel() {
@@ -163,7 +163,7 @@ class CancellablePromiseTests: XCTestCase {
163163
}.catch(policy: .allErrors) {
164164
$0.isCancelled ? ex.fulfill() : XCTFail()
165165
}.cancel()
166-
waitForExpectations(timeout: 1)
166+
waitForExpectations(timeout: 5)
167167
}
168168

169169
func testChain() {
@@ -178,7 +178,7 @@ class CancellablePromiseTests: XCTestCase {
178178
}.catch(policy: .allErrors) {
179179
$0.isCancelled ? ex.fulfill() : XCTFail()
180180
}.cancel()
181-
waitForExpectations(timeout: 1)
181+
waitForExpectations(timeout: 5)
182182
}
183183

184184
func testBridge() {
@@ -200,6 +200,6 @@ class CancellablePromiseTests: XCTestCase {
200200
XCTFail()
201201
}
202202

203-
waitForExpectations(timeout: 1)
203+
waitForExpectations(timeout: 5)
204204
}
205205
}

0 commit comments

Comments
 (0)