Skip to content

Commit

Permalink
Merge pull request #879 from WalletConnect/develop
Browse files Browse the repository at this point in the history
1.6.6
  • Loading branch information
llbartekll committed May 30, 2023
2 parents 545ae2b + 9316bdc commit 49b2975
Show file tree
Hide file tree
Showing 54 changed files with 977 additions and 644 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/ci_v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: ci_v2

on:
pull_request_target:
branches:
- develop
- main

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.event.pull_request.number || github.ref_name }}
cancel-in-progress: ${{ github.event_name == 'pull_request_target' }}

jobs:
authorize:
environment:
${{ (github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository) &&
'external' || 'internal' }}
runs-on: ubuntu-latest
steps:
- run: echo ✓

prepare:
needs: authorize
runs-on: macos-12
steps:
- uses: actions/checkout@v3

- uses: ./.github/actions/build
with:
project-id: ${{ secrets.PROJECT_ID }}

test:
needs: prepare
runs-on: macos-12
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
type: [relay-tests] # Put this back when verified it is working [integration-tests, relay-tests, unit-tests]

steps:
- uses: actions/checkout@v3

- uses: actions/cache/restore@v3
with:
path: |
products.tar
key: ${{ runner.os }}-deriveddata-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-deriveddata-${{ github.ref }}-
- name: Untar DerivedDataCache
shell: bash
run: test -f products.tar && tar xPpf products.tar || echo "No artifacts to untar"

# Package Unit tests
- name: Run tests
if: matrix.type == 'unit-tests'
shell: bash
run: make unit_tests

# Integration tests
- name: Run integration tests
if: matrix.type == 'integration-tests'
shell: bash
run: make integration_tests RELAY_HOST=relay.walletconnect.com PROJECT_ID=${{ secrets.PROJECT_ID }}

# Relay Integration tests
- name: Run Relay integration tests
if: matrix.type == 'relay-tests'
shell: bash
run: make relay_tests RELAY_HOST=relay.walletconnect.com PROJECT_ID=${{ secrets.PROJECT_ID }}

# Smoke tests
- name: Run smoke tests
if: matrix.type == 'smoke-tests'
shell: bash
run: make smoke_tests RELAY_HOST=relay.walletconnect.com PROJECT_ID=${{ secrets.PROJECT_ID }}

- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: success() || failure()
with:
check_name: ${{ matrix.type }} junit report
report_paths: 'test_results/report.junit'

- name: Zip test artifacts
if: always()
shell: bash
run: test -d "test_results" && zip artifacts.zip -r ./test_results || echo "Nothing to zip"

- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.type }} test_results
path: ./artifacts.zip
if-no-files-found: warn

66 changes: 66 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/Web3Modal.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Web3Modal"
BuildableName = "Web3Modal"
BlueprintName = "Web3Modal"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Web3Modal"
BuildableName = "Web3Modal"
BlueprintName = "Web3Modal"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
22 changes: 4 additions & 18 deletions Example/DApp/Sign/Accounts/AccountsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ final class AccountsViewController: UIViewController, UITableViewDataSource, UIT
action: #selector(disconnect)
)

navigationItem.leftBarButtonItem = UIBarButtonItem(
title: "Push Test",
style: .plain,
target: self,
action: #selector(pushTest)
)

accountsView.tableView.dataSource = self
accountsView.tableView.delegate = self
session.namespaces.values.forEach { namespace in
Expand All @@ -65,24 +58,17 @@ final class AccountsViewController: UIViewController, UITableViewDataSource, UIT
func proposePushSubscription() {
let account = session.namespaces.values.first!.accounts.first!

Task(priority: .high){ try! await Push.dapp.request(account: account, topic: session.pairingTopic)}
Push.dapp.responsePublisher.sink { (id: RPCID, result: Result<PushSubscriptionResult, PushError>) in
Task(priority: .high){ try! await Push.dapp.propose(account: account, topic: session.pairingTopic)}
Push.dapp.proposalResponsePublisher.sink { result in
switch result {
case .success(let subscriptionResult):
self.pushSubscription = subscriptionResult.pushSubscription
case .success(let subscription):
self.pushSubscription = subscription
case .failure(let error):
print(error)
}
}.store(in: &publishers)
}

@objc
private func pushTest() {
guard let pushTopic = pushSubscription?.topic else {return}
let message = PushMessage(title: "Push Message", body: "He,y this is a message from the swift client", icon: "", url: "")
Task(priority: .userInitiated) { try! await Push.dapp.notify(topic: pushTopic, message: message) }
}

@objc
private func disconnect() {
Task {
Expand Down
1 change: 1 addition & 0 deletions Example/ExampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2638,6 +2638,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 7;
Expand Down
6 changes: 3 additions & 3 deletions Example/IntegrationTests/Pairing/PairingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ final class PairingTests: XCTestCase {

try! await walletPairingClient.pair(uri: uri)

try! await appPushClient.request(account: Account.stub(), topic: uri.topic)
try! await appPushClient.propose(account: Account.stub(), topic: uri.topic)

wait(for: [expectation], timeout: InputConfig.defaultTimeout)
}
Expand All @@ -129,7 +129,7 @@ final class PairingTests: XCTestCase {
makeWalletPairingClient()
let expectation = expectation(description: "wallet responds unsupported method for unregistered method")

appPushClient.responsePublisher.sink { (_, response) in
appPushClient.proposalResponsePublisher.sink { (response) in
XCTAssertEqual(response, .failure(PushError(code: 10001)!))
expectation.fulfill()
}.store(in: &publishers)
Expand All @@ -138,7 +138,7 @@ final class PairingTests: XCTestCase {

try! await walletPairingClient.pair(uri: uri)

try! await appPushClient.request(account: Account.stub(), topic: uri.topic)
try! await appPushClient.propose(account: Account.stub(), topic: uri.topic)

wait(for: [expectation], timeout: InputConfig.defaultTimeout)
}
Expand Down
Loading

0 comments on commit 49b2975

Please sign in to comment.