Skip to content

Commit ea65ea7

Browse files
authored
Merge pull request #1391 from wordpress-mobile/tooling/fix-sync-pod-publication
Make `pod trunk push` be `--synchronous` — to fix issue when releasing both pods together
2 parents 0fd30b2 + c2a5686 commit ea65ea7

42 files changed

Lines changed: 393 additions & 276 deletions

Some content is hidden

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

.buildkite/pipeline.yml

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,72 @@
1-
# Nodes with values to reuse in the pipeline.
2-
common_params:
3-
plugins: &common_plugins
4-
- automattic/a8c-ci-toolkit#3.0.1
5-
# Common environment values to use with the `env` key.
6-
env: &common_env
7-
IMAGE_ID: xcode-15.0.1
1+
agents:
2+
queue: mac
3+
env:
4+
IMAGE_ID: $IMAGE_ID
85

96
# This is the default pipeline – it will build and test the app
107
steps:
118
#################
129
# Build and Test
1310
#################
14-
- label: "🧪 Build and Test"
15-
key: "test"
16-
command: |
17-
build_and_test_pod
18-
env: *common_env
19-
plugins: *common_plugins
11+
- label: 🧪 Build and Test
12+
key: test
13+
command: build_and_test_pod
14+
plugins: [$CI_TOOLKIT_PLUGIN]
15+
notify:
16+
- github_commit_status:
17+
context: Unit Tests
2018

2119
#################
2220
# Validate Podspecs
2321
#################
24-
- label: "🔬 Validate Podspecs"
25-
key: "validate"
26-
command: |
27-
validate_podspec --patch-cocoapods
28-
env: *common_env
29-
plugins: *common_plugins
30-
agents:
31-
queue: mac
22+
- label: 🔬 Validate Podspecs
23+
key: validate
24+
# Ideally, --allow-warnings should be removed once the warnings have been addressed
25+
command: validate_podspec --patch-cocoapods --allow-warnings
26+
plugins: [$CI_TOOLKIT_PLUGIN]
27+
notify:
28+
- github_commit_status:
29+
context: Validate Podspecs
3230

3331
#################
3432
# Lint
3533
#################
36-
- label: "🧹 Lint"
37-
key: "lint"
38-
command: |
39-
lint_pod
40-
env: *common_env
41-
plugins: *common_plugins
34+
- label: 🧹 Lint
35+
key: lint
36+
command: lint_pod
37+
plugins: [$CI_TOOLKIT_PLUGIN]
38+
notify:
39+
- github_commit_status:
40+
context: Lint Pod
4241

4342
#################
4443
# Publish the Podspec (if we're building a tag)
4544
#################
46-
- label: "⬆️ Publish Aztec Podspec"
47-
key: "publish-aztec"
45+
- label: ⬆️ Publish Aztec Podspec
46+
key: publish-aztec
4847
command: .buildkite/publish-aztec-pod.sh
49-
env: *common_env
50-
plugins: *common_plugins
48+
plugins: [$CI_TOOLKIT_PLUGIN]
5149
depends_on:
52-
- "test"
53-
- "validate"
54-
- "lint"
50+
- test
51+
- validate
52+
- lint
5553
if: build.tag != null
56-
agents:
57-
queue: "mac"
54+
notify:
55+
- github_commit_status:
56+
context: Publish Aztec Podspec
5857

5958
#################
6059
# Publish the Podspec (if we're building a tag)
6160
#################
62-
- label: "⬆️ Publish Editor Podspec"
63-
key: "publish-editor"
61+
- label: ⬆️ Publish Editor Podspec
62+
key: publish-editor
6463
command: .buildkite/publish-editor-pod.sh
65-
env: *common_env
66-
plugins: *common_plugins
64+
plugins: [$CI_TOOLKIT_PLUGIN]
6765
depends_on:
68-
- "test"
69-
- "validate"
70-
- "lint"
66+
- test
67+
- validate
68+
- lint
7169
if: build.tag != null
72-
agents:
73-
queue: "mac"
70+
notify:
71+
- github_commit_status:
72+
context: Publish WordPress-Editor Podspec

.buildkite/publish-aztec-pod.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ echo "--- :rubygems: Setting up Gems"
88
install_gems
99

1010
echo "--- :cocoapods: Publishing Pod to CocoaPods CDN"
11-
publish_pod $PODSPEC_PATH
11+
# Using `--synchronous` here because Editor depends on Aztec, and we need
12+
# to be able to `pod trunk push` the Editor pod immediately after the Aztec
13+
# pod has been published, without being hindered by the CDN propagation time.
14+
publish_pod --synchronous $PODSPEC_PATH
1215

1316
echo "--- :cocoapods: Publishing Pod to WP Specs Repo"
1417
publish_private_pod $PODSPEC_PATH $SPECS_REPO "$SPEC_REPO_PUBLIC_DEPLOY_KEY"

.buildkite/publish-editor.pod.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ echo "--- :rubygems: Setting up Gems"
88
install_gems
99

1010
echo "--- :cocoapods: Publishing Pod to CocoaPods CDN"
11-
publish_pod $PODSPEC_PATH
11+
# Using `--synchronous` here because Editor depends on Aztec, and we need
12+
# to be able to `pod trunk push` the Editor pod immediately after the Aztec
13+
# pod has been published, without being hindered by the CDN propagation time.
14+
publish_pod --synchronous $PODSPEC_PATH
1215

1316
echo "--- :cocoapods: Publishing Pod to WP Specs Repo"
1417
publish_private_pod $PODSPEC_PATH $SPECS_REPO "$SPEC_REPO_PUBLIC_DEPLOY_KEY"

.buildkite/shared-pipeline-vars

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
# This file is `source`'d before calling `buildkite-agent pipeline upload`, and can be used
4+
# to set up some variables that will be interpolated in the `.yml` pipeline before uploading it.
5+
6+
# The ~> modifier is not currently used, but we check for it just in case
7+
XCODE_VERSION=$(sed -E 's/^~> ?//' .xcode-version)
8+
CI_TOOLKIT_PLUGIN_VERSION="3.8.0"
9+
10+
export IMAGE_ID="xcode-$XCODE_VERSION-macos-14.7.1-v1"
11+
export CI_TOOLKIT_PLUGIN="automattic/a8c-ci-toolkit#$CI_TOOLKIT_PLUGIN_VERSION"

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.7.4
1+
3.2.2

.xcode-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
16.2

Aztec.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,7 +1920,6 @@
19201920
DYLIB_INSTALL_NAME_BASE = "@rpath";
19211921
INFOPLIST_FILE = Aztec/Info.plist;
19221922
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
1923-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
19241923
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
19251924
MARKETING_VERSION = 1.15.0;
19261925
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;
@@ -1947,7 +1946,6 @@
19471946
DYLIB_INSTALL_NAME_BASE = "@rpath";
19481947
INFOPLIST_FILE = Aztec/Info.plist;
19491948
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
1950-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
19511949
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
19521950
MARKETING_VERSION = 1.15.0;
19531951
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;
@@ -2064,7 +2062,6 @@
20642062
DYLIB_INSTALL_NAME_BASE = "@rpath";
20652063
INFOPLIST_FILE = Aztec/Info.plist;
20662064
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
2067-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
20682065
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
20692066
MARKETING_VERSION = 1.15.0;
20702067
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;
@@ -2172,7 +2169,6 @@
21722169
DYLIB_INSTALL_NAME_BASE = "@rpath";
21732170
INFOPLIST_FILE = Aztec/Info.plist;
21742171
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
2175-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
21762172
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
21772173
MARKETING_VERSION = 1.15.0;
21782174
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;

Aztec/Classes/EditorView/EditorView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ public class EditorView: UIView {
9999
// MARK: - Initializers
100100

101101
public required init?(coder aDecoder: NSCoder) {
102-
guard let htmlTextView = aDecoder.decodeObject(forKey: EditorView.htmlTextViewKey) as? UITextView,
103-
let richTextView = aDecoder.decodeObject(forKey: EditorView.richTextViewKey) as? TextView else {
102+
guard let htmlTextView = aDecoder.decodeObject(of: UITextView.self, forKey: EditorView.htmlTextViewKey),
103+
let richTextView = aDecoder.decodeObject(of: TextView.self, forKey: EditorView.richTextViewKey) else {
104104
return nil
105105
}
106106

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import Foundation
2+
import UIKit
23

34
// MARK: - NSAttributedString Archive methods
45
//
56
extension NSAttributedString
67
{
7-
static let pastesboardUTI = "com.wordpress.aztec.attributedString"
8+
static let pasteboardUTI = UIPasteboard.UTType(identifier: "com.wordpress.aztec.attributedString")
89

910
func archivedData() throws -> Data {
1011
return try NSKeyedArchiver.archivedData(withRootObject: self, requiringSecureCoding: false)
1112
}
1213

1314
static func unarchive(with data: Data) throws -> NSAttributedString? {
14-
return try NSKeyedUnarchiver.unarchivedObject(ofClass: NSAttributedString.self, from: data)
15+
return try NSKeyedUnarchiver.unarchivedObject(ofClasses: [NSAttributedString.self, HTMLRepresentation.self], from: data) as? NSAttributedString
1516
}
1617

1718
}

Aztec/Classes/Extensions/NSAttributedString+Attachments.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extension NSAttributedString
1111
static let lengthOfTextAttachment = NSAttributedString(attachment: NSTextAttachment()).length
1212

1313
// MARK: - Initializers
14-
14+
1515
/// Helper Initializer: returns an Attributed String, with the specified attachment, styled with a given
1616
/// collection of attributes.
1717
///
@@ -21,24 +21,24 @@ extension NSAttributedString
2121

2222
self.init(.textAttachment, attributes: attributesWithAttachment)
2323
}
24-
24+
2525
public convenience init(attachment: NSTextAttachment, caption: NSAttributedString, attributes: [NSAttributedString.Key: Any]) {
2626
let figure = Figure()
2727
let figcaption = Figcaption(defaultFont: UIFont.systemFont(ofSize: 14), storing: nil)
28-
28+
2929
let figureAttributes = attributes.appending(figure)
3030
let finalString = NSMutableAttributedString(attachment: attachment, attributes: figureAttributes)
31-
31+
3232
let mutableCaption = NSMutableAttributedString(attributedString: caption)
3333
mutableCaption.append(paragraphProperty: figure)
3434
mutableCaption.append(paragraphProperty: figcaption)
35-
35+
3636
let paragraphSeparator = NSAttributedString(.paragraphSeparator, attributes: [:])
37-
37+
3838
finalString.append(paragraphSeparator)
3939
finalString.append(mutableCaption)
4040
finalString.append(paragraphSeparator)
41-
41+
4242
self.init(attributedString: finalString)
4343
}
4444

@@ -103,47 +103,47 @@ extension NSAttributedString
103103
guard let captionRange = self.captionRange(for: attachment) else {
104104
return nil
105105
}
106-
106+
107107
let string = attributedSubstring(from: captionRange).mutableCopy() as! NSMutableAttributedString
108-
108+
109109
for character in Character.paragraphBreakingCharacters {
110110
string.replaceOcurrences(of: String(character), with: "")
111111
}
112-
112+
113113
return NSAttributedString(attributedString: string)
114114
}
115115

116116
public func captionRange(for attachment: NSTextAttachment) -> NSRange? {
117117
guard let figureRange = self.figureRange(for: attachment) else {
118118
return nil
119119
}
120-
120+
121121
return figcaptionRanges(within: figureRange).first
122122
}
123123

124124
// MARK: - Captions: Figure and Figcaption property ranges
125125

126126
private func figcaptionRanges(within range: NSRange) -> [NSRange] {
127127
var ranges = [NSRange]()
128-
128+
129129
enumerateParagraphRanges(spanning: range) { (_, enclosingRange) in
130130
guard let paragraphStyle = attribute(.paragraphStyle, at: enclosingRange.lowerBound, effectiveRange: nil) as? ParagraphStyle else {
131131
return
132132
}
133-
133+
134134
if paragraphStyle.hasProperty(where: { $0 is Figcaption }) {
135135
ranges.append(enclosingRange)
136136
}
137137
}
138-
138+
139139
return ranges
140140
}
141141

142142
private func figureRange(for attachment: NSTextAttachment) -> NSRange? {
143143
guard let attachmentRange = ranges(forAttachment: attachment).first else {
144144
return nil
145145
}
146-
146+
147147
let paragraphRange = self.paragraphRange(for: attachmentRange)
148148

149149
guard let paragraphStyle = self.attribute(.paragraphStyle, at: paragraphRange.lowerBound, effectiveRange: nil) as? ParagraphStyle,

0 commit comments

Comments
 (0)