From 703b1d9788a44116af32d44e43522a78d25e89c4 Mon Sep 17 00:00:00 2001 From: Morgan Pretty Date: Fri, 14 Jul 2023 16:48:53 +1000 Subject: [PATCH] CI tweaks and tweak for initial UX issue with 'blinded25' id Added parallelisation for the unit tests Added the SSH_KEY env variable for the 'Upload artifacts' step Disabled xcbeautify for the prod build (as I expect it's suppressing the build error) Disabled support for starting a conversation with a 'blinded25' id (would be invalid at this stage) Fixed a broken unit test --- .drone.jsonnet | 8 +++++--- Session/Conversations/ConversationVC+Interaction.swift | 4 +++- .../Message Cells/VisibleMessageCell.swift | 6 ++---- .../Open Groups/OpenGroupManagerSpec.swift | 10 +++++----- SessionUtilitiesKitTests/General/SessionIdSpec.swift | 2 +- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 1377b86f4..d1f21a6d6 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -71,7 +71,7 @@ local update_cocoapods_cache = { name: 'Run Unit Tests', commands: [ 'mkdir build', - 'NSUnbufferedIO=YES set -o pipefail && xcodebuild test -workspace Session.xcworkspace -scheme Session -destination "platform=iOS Simulator,name=iPhone 14 Pro" -maximum-test-execution-time-allowance 2 -collect-test-diagnostics never 2>&1 | ./Pods/xcbeautify/xcbeautify' + 'NSUnbufferedIO=YES set -o pipefail && xcodebuild test -workspace Session.xcworkspace -scheme Session -destination "platform=iOS Simulator,name=iPhone 14" -destination "platform=iOS Simulator,name=iPhone 14 Pro Max" -parallel-testing-enabled YES -test-timeouts-enabled YES -maximum-test-execution-time-allowance 2 -collect-test-diagnostics never 2>&1 | ./Pods/xcbeautify/xcbeautify --is-ci --report junit --report-path ./build/reports --junit-report-filename junit2.xml' ], }, update_cocoapods_cache @@ -91,12 +91,13 @@ local update_cocoapods_cache = { name: 'Build', commands: [ 'mkdir build', - 'xcodebuild archive -workspace Session.xcworkspace -scheme Session -configuration "App Store Release" -sdk iphonesimulator -archivePath ./build/Session_sim.xcarchive -destination "generic/platform=iOS Simulator" | ./Pods/xcbeautify/xcbeautify' + 'xcodebuild archive -workspace Session.xcworkspace -scheme Session -configuration "App Store Release" -sdk iphonesimulator -archivePath ./build/Session_sim.xcarchive -destination "generic/platform=iOS Simulator" | ./Pods/xcbeautify/xcbeautify --is-ci' ], }, update_cocoapods_cache, { name: 'Upload artifacts', + environment: { SSH_KEY: { from_secret: 'SSH_KEY' } }, commands: [ './Scripts/drone-static-upload.sh' ] @@ -117,12 +118,13 @@ local update_cocoapods_cache = { name: 'Build', commands: [ 'mkdir build', - 'xcodebuild archive -workspace Session.xcworkspace -scheme Session -configuration "App Store Release" -sdk iphoneos -archivePath ./build/Session.xcarchive -destination "generic/platform=iOS" -allowProvisioningUpdates | ./Pods/xcbeautify/xcbeautify' + 'xcodebuild archive -workspace Session.xcworkspace -scheme Session -configuration "App Store Release" -sdk iphoneos -archivePath ./build/Session.xcarchive -destination "generic/platform=iOS" -allowProvisioningUpdates' ], }, update_cocoapods_cache, { name: 'Upload artifacts', + environment: { SSH_KEY: { from_secret: 'SSH_KEY' } }, commands: [ './Scripts/drone-static-upload.sh' ] diff --git a/Session/Conversations/ConversationVC+Interaction.swift b/Session/Conversations/ConversationVC+Interaction.swift index 617d4ec6c..f597cc418 100644 --- a/Session/Conversations/ConversationVC+Interaction.swift +++ b/Session/Conversations/ConversationVC+Interaction.swift @@ -1019,7 +1019,9 @@ extension ConversationVC: func startThread(with sessionId: String, openGroupServer: String?, openGroupPublicKey: String?) { guard viewModel.threadData.canWrite else { return } - guard SessionId.Prefix(from: sessionId) == .blinded15 || SessionId.Prefix(from: sessionId) == .blinded25 else { + // FIXME: Add in support for starting a thread with a 'blinded25' id + guard SessionId.Prefix(from: sessionId) != .blinded25 else { return } + guard SessionId.Prefix(from: sessionId) == .blinded15 else { Storage.shared.write { db in try SessionThread .fetchOrCreate(db, id: sessionId, variant: .contact, shouldBeVisible: nil) diff --git a/Session/Conversations/Message Cells/VisibleMessageCell.swift b/Session/Conversations/Message Cells/VisibleMessageCell.swift index a15cccf37..6019d5a4d 100644 --- a/Session/Conversations/Message Cells/VisibleMessageCell.swift +++ b/Session/Conversations/Message Cells/VisibleMessageCell.swift @@ -869,10 +869,8 @@ final class VisibleMessageCell: MessageCell, TappableLabelDelegate { if profilePictureView.bounds.contains(profilePictureView.convert(location, from: self)), cellViewModel.shouldShowProfile { // For open groups only attempt to start a conversation if the author has a blinded id guard cellViewModel.threadVariant != .community else { - guard - SessionId.Prefix(from: cellViewModel.authorId) == .blinded15 || - SessionId.Prefix(from: cellViewModel.authorId) == .blinded25 - else { return } + // FIXME: Add in support for opening a conversation with a 'blinded25' id + guard SessionId.Prefix(from: cellViewModel.authorId) == .blinded15 else { return } delegate?.startThread( with: cellViewModel.authorId, diff --git a/SessionMessagingKitTests/Open Groups/OpenGroupManagerSpec.swift b/SessionMessagingKitTests/Open Groups/OpenGroupManagerSpec.swift index 5386c3207..1a0ab6ace 100644 --- a/SessionMessagingKitTests/Open Groups/OpenGroupManagerSpec.swift +++ b/SessionMessagingKitTests/Open Groups/OpenGroupManagerSpec.swift @@ -3335,7 +3335,7 @@ class OpenGroupManagerSpec: QuickSpec { }.thenReturn(()) } - it("caches the promise if there is no cached promise") { + it("caches the publisher if there is no cached publisher") { let publisher = OpenGroupManager.getDefaultRoomsIfNeeded(using: dependencies) expect(mockOGMCache) @@ -3344,7 +3344,7 @@ class OpenGroupManagerSpec: QuickSpec { }) } - it("returns the cached promise if there is one") { + it("returns the cached publisher if there is one") { let uniqueRoomInstance: OpenGroupAPI.Room = OpenGroupAPI.Room( token: "UniqueId", name: "", @@ -3484,7 +3484,7 @@ class OpenGroupManagerSpec: QuickSpec { expect(TestRoomsApi.callCounter).to(equal(9)) // First attempt + 8 retries } - it("removes the cache promise if all retries fail") { + it("removes the cache publisher if all retries fail") { class TestRoomsApi: TestOnionRequestAPI { override class var mockResponse: Data? { return nil } } @@ -3626,7 +3626,7 @@ class OpenGroupManagerSpec: QuickSpec { } } - it("retrieves the image retrieval promise from the cache if it exists") { + it("retrieves the image retrieval publisher from the cache if it exists") { let publisher = Future { resolver in resolver(Result.success(Data([5, 4, 3, 2, 1]))) } @@ -3705,7 +3705,7 @@ class OpenGroupManagerSpec: QuickSpec { ) } - it("adds the image retrieval promise to the cache") { + it("adds the image retrieval publisher to the cache") { class TestNeverReturningApi: OnionRequestAPIType { static func sendOnionRequest(_ request: URLRequest, to server: String, with x25519PublicKey: String, timeout: TimeInterval) -> AnyPublisher<(ResponseInfoType, Data?), Error> { return Future<(ResponseInfoType, Data?), Error> { _ in }.eraseToAnyPublisher() diff --git a/SessionUtilitiesKitTests/General/SessionIdSpec.swift b/SessionUtilitiesKitTests/General/SessionIdSpec.swift index 0c0429bd6..62a76e33c 100644 --- a/SessionUtilitiesKitTests/General/SessionIdSpec.swift +++ b/SessionUtilitiesKitTests/General/SessionIdSpec.swift @@ -59,7 +59,7 @@ class SessionIdSpec: QuickSpec { expect(SessionId.Prefix(from: "00")).to(equal(.unblinded)) expect(SessionId.Prefix(from: "05")).to(equal(.standard)) expect(SessionId.Prefix(from: "15")).to(equal(.blinded15)) - expect(SessionId.Prefix(from: "s5")).to(equal(.blinded25)) + expect(SessionId.Prefix(from: "25")).to(equal(.blinded25)) } it("fails when nil") {