Skip to content

Commit

Permalink
Merge branch 'develop' into verify-api
Browse files Browse the repository at this point in the history
# Conflicts:
#	Sources/WalletConnectNetworking/NetworkingInteractor.swift
  • Loading branch information
alexander-lsvk committed May 15, 2023
2 parents 8929f5e + 742a501 commit 127ec1e
Show file tree
Hide file tree
Showing 94 changed files with 2,843 additions and 319 deletions.
38 changes: 38 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: 'build'
description: 'Compiles and stores artifacts for further use'
inputs:
relay-endpoint:
description: 'The endpoint of the relay e.g. relay.walletconnect.com'
required: false
default: 'relay.walletconnect.com'
project-id:
description: 'WalletConnect project id'
required: true

runs:
using: "composite"
steps:
- uses: actions/checkout@v3

- uses: actions/cache@v3
with:
path: |
**/SourcePackagesCache
DerivedDataCache
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Build for testing
shell: bash
run: make build_all RELAY_HOST=${{ inputs.relay-endpoint }} PROJECT_ID=${{ inputs.project-id }}

- name: Tar DerivedDataCache
shell: bash
run: test -d "DerivedDataCache" && tar cfPp products.tar --format posix DerivedDataCache/Build

- uses: actions/cache/save@v3
with:
path: |
products.tar
key: ${{ runner.os }}-deriveddata-${{ github.ref }}-${{ github.sha }}
69 changes: 0 additions & 69 deletions .github/actions/ci/action.yml

This file was deleted.

73 changes: 73 additions & 0 deletions .github/actions/run_tests_without_building/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: 'run_tests_without_building'
description: 'Executes specific Swift tests using prebuilt artifacts from build_artifacts.yml workflow from main branch'
inputs:
type:
description: 'The type of CI step to run'
required: true
relay-endpoint:
description: 'The endpoint of the relay e.g. relay.walletconnect.com'
required: false
default: 'relay.walletconnect.com'
project-id:
description: 'WalletConnect project id'
required: true

runs:
using: "composite"
steps:
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
name: main-derivedData
workflow: build_artifacts.yml
repo: 'WalletConnect/WalletConnectSwiftV2'
if_no_artifact_found: warn

- 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: inputs.type == 'unit-tests'
shell: bash
run: make unit_tests

# Integration tests
- name: Run integration tests
if: inputs.type == 'integration-tests'
shell: bash
run: make integration_tests RELAY_HOST=${{ inputs.relay-endpoint }} PROJECT_ID=${{ inputs.project-id }}

# Relay Integration tests
- name: Run Relay integration tests
if: inputs.type == 'relay-tests'
shell: bash
run: make relay_tests RELAY_HOST=${{ inputs.relay-endpoint }} PROJECT_ID=${{ inputs.project-id }}

# Smoke tests
- name: Run smoke tests
if: inputs.type == 'smoke-tests'
shell: bash
run: make smoke_tests RELAY_HOST=${{ inputs.relay-endpoint }} PROJECT_ID=${{ inputs.project-id }}

- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: success() || failure()
with:
check_name: ${{ inputs.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: ${{ inputs.type }} test_results
path: ./artifacts.zip
if-no-files-found: warn
50 changes: 50 additions & 0 deletions .github/workflows/build_artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: build_artifacts

on:
workflow_dispatch:
inputs:
relay-endpoint:
description: 'The endpoint of the relay e.g. relay.walletconnect.com'
required: false
default: 'relay.walletconnect.com'
project-id:
description: 'WalletConnect project id'
required: true
push:
branches: [ main ]

jobs:
build:
runs-on: macos-12
timeout-minutes: 15

steps:
- uses: actions/checkout@v3

- uses: actions/cache@v3
with:
path: |
**/SourcePackagesCache
DerivedDataCache
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Build for testing on workflow_dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
shell: bash
run: make build_all RELAY_HOST=${{ inputs.relay-endpoint }} PROJECT_ID=${{ inputs.project-id }}

- name: Build for testing on push
if: ${{ github.event_name == 'push' }}
shell: bash
run: make build_all RELAY_HOST=relay.walletconnect.com PROJECT_ID=${{ secrets.PROJECT_ID }}

- name: Tar DerivedDataCache
shell: bash
run: test -d "DerivedDataCache" && tar cfPp products.tar --format posix DerivedDataCache/Build

- uses: actions/upload-artifact@v3
with:
name: main-derivedData
path: products.tar
88 changes: 64 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,84 @@ on:
branches: [ main, develop ]

concurrency:
# Support push/pr as event types with different behaviors each:
# 1. push: queue up builds by branch
# 2. pr: only allow one run per PR
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref_name }}
# If there is already a workflow running for the same pull request, cancel it
# For non-PR triggers queue up builds
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
build:
prepare:
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:
test-type: [unit-tests, integration-tests, build-example-wallet, build-example-dapp, relay-tests]
type: [integration-tests, relay-tests, unit-tests]

steps:
- uses: actions/checkout@v2

- name: Setup Xcode Version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 14.1
- uses: actions/checkout@v3

- uses: actions/cache@v2
- uses: actions/cache/restore@v3
with:
path: |
.build
SourcePackagesCache
DerivedDataCache
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
products.tar
key: ${{ runner.os }}-deriveddata-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-spm-
${{ 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

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

- uses: ./.github/actions/ci
# 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:
type: ${{ matrix.test-type }}
project-id: ${{ secrets.PROJECT_ID }}
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

9 changes: 2 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,9 @@ jobs:
runs-on: macos-12

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup Xcode Version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 14.1

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
.build
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ DerivedDataCache

# Artifacts
*.ipa
*.zip
*.zip
test_results/
Loading

0 comments on commit 127ec1e

Please sign in to comment.