Skip to content

Commit

Permalink
Merge pull request #492 from WalletConnect/feature/host-url-from-ci
Browse files Browse the repository at this point in the history
[CI] Host URL arg
  • Loading branch information
llbartekll authored Sep 8, 2022
2 parents ab92a3c + d66b399 commit 294d8bf
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 14 deletions.
4 changes: 3 additions & 1 deletion .github/actions/ci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ runs:
-project Example/ExampleApp.xcodeproj \
-scheme IntegrationTests \
-clonedSourcePackagesDirPath SourcePackagesCache \
-destination 'platform=iOS Simulator,name=iPhone 13' test"
-destination 'platform=iOS Simulator,name=iPhone 13' \
RELAY_HOST='relay.walletconnect.com' \
test"

# Wallet build
- name: Build Example Wallet
Expand Down
11 changes: 11 additions & 0 deletions Example/ExampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
84F568C2279582D200D0A289 /* Signer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F568C1279582D200D0A289 /* Signer.swift */; };
84F568C42795832A00D0A289 /* EthereumTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F568C32795832A00D0A289 /* EthereumTransaction.swift */; };
84FE684628ACDB4700C893FF /* RequestParams.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84FE684528ACDB4700C893FF /* RequestParams.swift */; };
A501AC2728C8E59800CEAA42 /* URLConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = A501AC2628C8E59800CEAA42 /* URLConfig.swift */; };
A50C036528AAD32200FE72D3 /* ClientDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50C036428AAD32200FE72D3 /* ClientDelegate.swift */; };
A50F3946288005B200064555 /* Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50F3945288005B200064555 /* Types.swift */; };
A55CAAB028B92AFF00844382 /* ScanModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = A55CAAAB28B92AFF00844382 /* ScanModule.swift */; };
Expand Down Expand Up @@ -236,6 +237,7 @@
84F568C1279582D200D0A289 /* Signer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Signer.swift; sourceTree = "<group>"; };
84F568C32795832A00D0A289 /* EthereumTransaction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EthereumTransaction.swift; sourceTree = "<group>"; };
84FE684528ACDB4700C893FF /* RequestParams.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestParams.swift; sourceTree = "<group>"; };
A501AC2628C8E59800CEAA42 /* URLConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLConfig.swift; sourceTree = "<group>"; };
A50C036428AAD32200FE72D3 /* ClientDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClientDelegate.swift; sourceTree = "<group>"; };
A50F3945288005B200064555 /* Types.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Types.swift; sourceTree = "<group>"; };
A55CAAAB28B92AFF00844382 /* ScanModule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScanModule.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1048,6 +1050,7 @@
A5E03E0E28646D8A00888481 /* WebSocketFactory.swift */,
A5E03DFC286465D100888481 /* Stubs.swift */,
84FE684528ACDB4700C893FF /* RequestParams.swift */,
A501AC2628C8E59800CEAA42 /* URLConfig.swift */,
);
path = Stubs;
sourceTree = "<group>";
Expand Down Expand Up @@ -1456,6 +1459,7 @@
7694A5262874296A0001257E /* RegistryTests.swift in Sources */,
A50C036528AAD32200FE72D3 /* ClientDelegate.swift in Sources */,
A5E03E0D28646AD200888481 /* RelayClientEndToEndTests.swift in Sources */,
A501AC2728C8E59800CEAA42 /* URLConfig.swift in Sources */,
A5E03DFA286465C700888481 /* SignClientTests.swift in Sources */,
A5E03E0F28646D8A00888481 /* WebSocketFactory.swift in Sources */,
A5E03E1128646F8000888481 /* KeychainStorageMock.swift in Sources */,
Expand Down Expand Up @@ -1846,11 +1850,17 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = W5R8AG9K22;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
"RELAY_HOST=$(RELAY_HOST)",
);
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.walletconnect.IntegrationTests;
PRODUCT_NAME = "$(TARGET_NAME)";
RELAY_HOST = relay.walletconnect.com;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -1869,6 +1879,7 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.walletconnect.IntegrationTests;
PRODUCT_NAME = "$(TARGET_NAME)";
RELAY_HOST = relay.walletconnect.com;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,23 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "NO">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A5E03DEC286464DB00888481"
BuildableName = "IntegrationTests.xctest"
BlueprintName = "IntegrationTests"
ReferencedContainer = "container:ExampleApp.xcodeproj">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "RELAY_HOST"
value = "$(RELAY_HOST)"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<Testables>
<TestableReference
skipped = "NO">
Expand Down
3 changes: 1 addition & 2 deletions Example/IntegrationTests/Auth/AuthTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ final class AuthTests: XCTestCase {

func makeClient(prefix: String, account: Account? = nil) -> AuthClient {
let logger = ConsoleLogger(suffix: prefix, loggingLevel: .debug)
let relayHost = "relay.walletconnect.com"
let projectId = "8ba9ee138960775e5231b70cc5ef1c3a"
let keychain = KeychainStorageMock()
let relayClient = RelayClient(relayHost: relayHost, projectId: projectId, keychainStorage: keychain, socketFactory: SocketFactory(), logger: logger)
let relayClient = RelayClient(relayHost: URLConfig.relayHost, projectId: projectId, keychainStorage: keychain, socketFactory: SocketFactory(), logger: logger)

return AuthClientFactory.create(
metadata: AppMetadata(name: name, description: "", url: "", icons: [""]),
Expand Down
3 changes: 1 addition & 2 deletions Example/IntegrationTests/Chat/ChatTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ final class ChatTests: XCTestCase {

func makeClient(prefix: String) -> ChatClient {
let logger = ConsoleLogger(suffix: prefix, loggingLevel: .debug)
let relayHost = "relay.walletconnect.com"
let projectId = "8ba9ee138960775e5231b70cc5ef1c3a"
let keychain = KeychainStorageMock()
let relayClient = RelayClient(relayHost: relayHost, projectId: projectId, keychainStorage: keychain, socketFactory: SocketFactory(), logger: logger)
let relayClient = RelayClient(relayHost: URLConfig.relayHost, projectId: projectId, keychainStorage: keychain, socketFactory: SocketFactory(), logger: logger)
return ChatClientFactory.create(registry: registry, relayClient: relayClient, kms: KeyManagementService(keychain: keychain), logger: logger, keyValueStorage: RuntimeKeyValueStorage())
}

Expand Down
5 changes: 2 additions & 3 deletions Example/IntegrationTests/Relay/RelayClientEndToEndTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ final class RelayClientEndToEndTests: XCTestCase {

let defaultTimeout: TimeInterval = 10

let relayHost = "relay.walletconnect.com"
let projectId = "8ba9ee138960775e5231b70cc5ef1c3a"
private var publishers = Set<AnyCancellable>()

Expand All @@ -18,10 +17,10 @@ final class RelayClientEndToEndTests: XCTestCase {
let socketAuthenticator = SocketAuthenticator(
clientIdStorage: clientIdStorage,
didKeyFactory: ED25519DIDKeyFactory(),
relayHost: relayHost
relayHost: URLConfig.relayHost
)
let urlFactory = RelayUrlFactory(socketAuthenticator: socketAuthenticator)
let socket = WebSocket(url: urlFactory.create(host: relayHost, projectId: projectId))
let socket = WebSocket(url: urlFactory.create(host: URLConfig.relayHost, projectId: projectId))

let logger = ConsoleLogger()
let dispatcher = Dispatcher(socket: socket, socketConnectionHandler: ManualSocketConnectionHandler(socket: socket), logger: logger)
Expand Down
3 changes: 1 addition & 2 deletions Example/IntegrationTests/Sign/SignClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ final class SignClientTests: XCTestCase {

static private func makeClientDelegate(
name: String,
relayHost: String = "relay.walletconnect.com",
projectId: String = "8ba9ee138960775e5231b70cc5ef1c3a"
) -> ClientDelegate {
let logger = ConsoleLogger(suffix: name, loggingLevel: .debug)
let keychain = KeychainStorageMock()
let relayClient = RelayClient(
relayHost: relayHost,
relayHost: URLConfig.relayHost,
projectId: projectId,
keyValueStorage: RuntimeKeyValueStorage(),
keychainStorage: keychain,
Expand Down
8 changes: 8 additions & 0 deletions Example/IntegrationTests/Stubs/URLConfig.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Foundation

struct URLConfig {

static var relayHost: String {
return ProcessInfo.processInfo.environment["RELAY_HOST"]!
}
}
4 changes: 1 addition & 3 deletions Tests/IntegrationTests/AuthChallengeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ import WalletConnectKMS

final class AuthChallengeTests: XCTestCase {

let relayHost: String = "dev.relay.walletconnect.com"

var httpClient: HTTPClient!
var provider: AuthChallengeProvider!

override func setUp() {
httpClient = HTTPClient(host: relayHost)
httpClient = HTTPClient(host: URLConfig.relayHost)
provider = AuthChallengeProvider(client: httpClient)
}

Expand Down

0 comments on commit 294d8bf

Please sign in to comment.