Skip to content

Commit e9ba885

Browse files
authored
Merge pull request #1220 from mxcl/v7-merge
V7 merge
2 parents 9f494dd + 8e0dc32 commit e9ba885

37 files changed

Lines changed: 1423 additions & 1348 deletions

.github/FUNDING.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tidelift: "cocoapods/PromiseKit"
2+
patreon: "mxcl"
3+
github: mxcl

.github/workflows/cd.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: CD
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
required: true
7+
jobs:
8+
pods:
9+
runs-on: macos-latest
10+
steps:
11+
12+
- name: Start Deployment
13+
uses: bobheadxi/deployments@v0.5.2
14+
id: deployment
15+
with:
16+
step: start
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
env: pods
19+
20+
- uses: actions/checkout@v2
21+
with:
22+
submodules: true
23+
24+
- run: pod trunk push --allow-warnings --skip-tests --skip-import-validation
25+
env:
26+
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
27+
28+
- name: Seal Deployment
29+
uses: bobheadxi/deployments@v0.5.2
30+
if: always()
31+
with:
32+
step: finish
33+
token: ${{ secrets.GITHUB_TOKEN }}
34+
status: ${{ job.status }}
35+
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
36+
37+
docs:
38+
runs-on: macos-latest
39+
steps:
40+
41+
- name: Start Deployment
42+
uses: bobheadxi/deployments@v0.5.2
43+
id: deployment
44+
with:
45+
step: start
46+
token: ${{ secrets.GITHUB_TOKEN }}
47+
env: docs
48+
49+
- uses: actions/checkout@v2
50+
- run: gem install jazzy
51+
- run: |
52+
jazzy --config .github/jazzy.yml \
53+
--github_url 'https://github.com/mxcl/PromiseKit' \
54+
--module-version ${{ github.event.inputs.version }}
55+
- run: git remote update
56+
- run: git checkout gh-pages
57+
- run: rm -rf reference/v6
58+
- run: mv output reference/v6
59+
- run: git add reference/v6
60+
- run: git config user.name github-actions
61+
- run: git config user.email github-actions@github.com
62+
- run: git commit -m 'Updated docs for v${{ github.event.inputs.version }}'
63+
- run: git remote add secure-origin https://${{ secrets.JAZZY_PAT }}@github.com/mxcl/PromiseKit.git
64+
- run: git push secure-origin gh-pages
65+
66+
- name: Seal Deployment
67+
uses: bobheadxi/deployments@v0.5.2
68+
if: always()
69+
with:
70+
step: finish
71+
token: ${{ secrets.GITHUB_TOKEN }}
72+
status: ${{ job.status }}
73+
deployment_id: ${{ steps.deployment.outputs.deployment_id }}

.github/workflows/ci.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
paths:
5+
- Sources/**
6+
- Tests/**
7+
- .github/workflows/ci.yml
8+
workflow_dispatch:
9+
jobs:
10+
auto-cancel:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: technote-space/auto-cancel-redundant-job@v1
14+
15+
linux:
16+
name: linux
17+
runs-on: ubuntu-18.04
18+
strategy:
19+
matrix:
20+
swift:
21+
- 5.3
22+
- 5.4
23+
container:
24+
image: swift:${{ matrix.swift }}
25+
steps:
26+
- uses: actions/checkout@v2
27+
- run: swift test --enable-code-coverage --parallel --enable-test-discovery
28+
29+
- name: Generate Coverage Report
30+
if: ${{ matrix.swift == '5.3' }} # 5.4 and above needs llvm-cov-12
31+
run: |
32+
apt-get -qq update
33+
apt-get -qq install curl
34+
b=$(swift build --show-bin-path)
35+
llvm-cov export \
36+
-format lcov \
37+
-instr-profile="$b"/codecov/default.profdata \
38+
--ignore-filename-regex='\.build/' \
39+
"$b"/*.xctest \
40+
> info.lcov
41+
- uses: codecov/codecov-action@v1
42+
with:
43+
file: ./info.lcov
44+
45+
macOS:
46+
runs-on: macos-latest
47+
strategy:
48+
matrix:
49+
dst:
50+
- platform=macOS
51+
- platform=tvOS Simulator,OS=latest,name=Apple TV
52+
- platform=iOS Simulator,OS=latest,name=iPhone 12
53+
steps:
54+
- uses: maxim-lobanov/setup-xcode@v1
55+
with:
56+
xcode-version: ^12
57+
- uses: actions/checkout@v2
58+
- uses: sersoft-gmbh/xcodebuild-action@v1
59+
with:
60+
spm-package: ./
61+
scheme: PromiseKit
62+
destination: ${{ matrix.dst }}
63+
action: test
64+
enable-code-coverage: true
65+
- uses: codecov/codecov-action@v1

.github/workflows/publish.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Publish
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: Version to publish
7+
required: true
8+
jobs:
9+
ci:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: aurelien-baudet/workflow-dispatch@v2
13+
with:
14+
workflow: CI
15+
token: ${{ secrets.JAZZY_PAT }}
16+
wait-for-completion: true
17+
18+
lint:
19+
runs-on: macos-10.15
20+
strategy:
21+
matrix:
22+
xcode:
23+
- ^10
24+
- ^11
25+
- ^12
26+
steps:
27+
- uses: maxim-lobanov/setup-xcode@v1
28+
with:
29+
xcode-version: ${{ matrix.xcode }}
30+
- uses: actions/checkout@v2
31+
with:
32+
submodules: true
33+
- run: pod lib lint --fail-fast
34+
35+
create-release:
36+
runs-on: ubuntu-latest
37+
needs: [ci, lint]
38+
env:
39+
v: ${{ github.event.inputs.version }}
40+
steps:
41+
- 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
56+
- uses: softprops/action-gh-release@v1
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
with:
60+
tag_name: ${{ github.event.inputs.version }}
61+
name: ${{ github.event.inputs.version }}
62+
63+
cd:
64+
needs: create-release
65+
runs-on: ubuntu-latest
66+
steps:
67+
- uses: aurelien-baudet/workflow-dispatch@v2
68+
with:
69+
workflow: CD
70+
token: ${{ secrets.JAZZY_PAT }}
71+
inputs: "{\"version\": \"${{ github.event.inputs.version }}\"}"
72+
ref: master # or doesn’t use our new commit above
73+
wait-for-completion: true

.tidelift.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extra_ignore_directories: [ Tests ]

.travis.yml

Lines changed: 0 additions & 115 deletions
This file was deleted.

Documents/CommonPatterns.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ When you have a series of tasks to perform on an array of data:
175175
```swift
176176
// fade all visible table cells one by one in a “cascading” effect
177177

178-
let fade = Guarantee()
178+
var fade = Guarantee()
179179
for cell in tableView.visibleCells {
180180
fade = fade.then {
181181
UIView.animate(.promise, duration: 0.1) {
@@ -188,12 +188,14 @@ fade.done {
188188
}
189189
```
190190

191-
Or if you have an array of promises:
191+
Or if you have an array of closures that return promises:
192192

193193
```swift
194194
var foo = Promise()
195-
for nextPromise in arrayOfPromises {
196-
foo = foo.then { nextPromise }
195+
for nextPromise in arrayOfClosuresThatReturnPromises {
196+
foo = foo.then(nextPromise)
197+
// ^^ you rarely would want an array of promises instead, since then
198+
// they have all already started, you may as well use `when()`
197199
}
198200
foo.done {
199201
// finish
@@ -291,7 +293,7 @@ func attempt<T>(maximumRetryCount: Int = 3, delayBeforeRetry: DispatchTimeInterv
291293
attempts += 1
292294
return body().recover { error -> Promise<T> in
293295
guard attempts < maximumRetryCount else { throw error }
294-
return after(delayBeforeRetry).then(on: nil, attempt)
296+
return after(delayBeforeRetry).then(attempt)
295297
}
296298
}
297299
return attempt()

0 commit comments

Comments
 (0)