|
| 1 | +name: E2E Migration (iOS) |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + e2e_branch: |
| 7 | + description: "Branch of synonymdev/bitkit-e2e-tests to use (main | default-feature-branch | custom branch name)" |
| 8 | + required: false |
| 9 | + default: "default-feature-branch" |
| 10 | + # schedule: |
| 11 | + # - cron: "0 2 * * *" |
| 12 | + |
| 13 | +env: |
| 14 | + TERM: xterm-256color |
| 15 | + FORCE_COLOR: 1 |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 19 | + cancel-in-progress: true |
| 20 | + |
| 21 | +jobs: |
| 22 | + build: |
| 23 | + if: github.event.pull_request.draft == false |
| 24 | + runs-on: macos-latest |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Checkout |
| 28 | + uses: actions/checkout@v4 |
| 29 | + |
| 30 | + - name: System Information |
| 31 | + run: | |
| 32 | + echo "=== System Information ===" |
| 33 | + echo "macOS Version:" |
| 34 | + sw_vers |
| 35 | + echo "" |
| 36 | + echo "Xcode Version:" |
| 37 | + xcodebuild -version |
| 38 | +
|
| 39 | + - name: Build iOS app (regtest) |
| 40 | + env: |
| 41 | + GITHUB_ACTOR: ${{ github.actor }} |
| 42 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 43 | + CHATWOOT_API: ${{ secrets.CHATWOOT_API }} |
| 44 | + SIMULATOR_NAME: "iPhone 17" |
| 45 | + OS_VERSION: "latest" |
| 46 | + GEO: false |
| 47 | + E2E_BACKEND: network |
| 48 | + E2E_NETWORK: regtest |
| 49 | + run: | |
| 50 | + echo "=== Building iOS app ===" |
| 51 | + echo "Using simulator: $SIMULATOR_NAME (iOS $OS_VERSION)" |
| 52 | +
|
| 53 | + if xcodebuild -showsdks | grep -q "iOS Simulator"; then |
| 54 | + echo "✅ iOS Simulator platform already installed" |
| 55 | + else |
| 56 | + echo "⚙️ iOS Simulator platform not found — downloading..." |
| 57 | + xcodebuild -downloadPlatform iOS |
| 58 | + fi |
| 59 | +
|
| 60 | + xcodebuild -workspace Bitkit.xcodeproj/project.xcworkspace \ |
| 61 | + -scheme Bitkit \ |
| 62 | + -configuration Debug \ |
| 63 | + -destination "platform=iOS Simulator,name=$SIMULATOR_NAME,OS=$OS_VERSION" \ |
| 64 | + -derivedDataPath DerivedData \ |
| 65 | + SWIFT_ACTIVE_COMPILATION_CONDITIONS='$(inherited) E2E_BUILD' \ |
| 66 | + -allowProvisioningUpdates \ |
| 67 | + build |
| 68 | +
|
| 69 | + - name: Prepare app for E2E tests |
| 70 | + run: | |
| 71 | + mkdir -p e2e-app |
| 72 | + cp -r DerivedData/Build/Products/Debug-iphonesimulator/Bitkit.app e2e-app/bitkit.app |
| 73 | +
|
| 74 | + - name: Upload iOS app |
| 75 | + uses: actions/upload-artifact@v4 |
| 76 | + with: |
| 77 | + name: bitkit-e2e-ios_${{ github.run_number }} |
| 78 | + path: e2e-app/ |
| 79 | + |
| 80 | + e2e-branch: |
| 81 | + if: github.event.pull_request.draft == false |
| 82 | + uses: synonymdev/bitkit-e2e-tests/.github/workflows/determine-e2e-branch.yml@main |
| 83 | + with: |
| 84 | + app_branch: ${{ github.head_ref || github.ref_name }} |
| 85 | + e2e_branch_input: ${{ github.event.inputs.e2e_branch || 'default-feature-branch' }} |
| 86 | + |
| 87 | + prepare-wallets: |
| 88 | + if: github.event.pull_request.draft == false |
| 89 | + uses: synonymdev/bitkit-e2e-tests/.github/workflows/migration-wallet-setup.yml@main |
| 90 | + needs: [e2e-branch] |
| 91 | + strategy: |
| 92 | + fail-fast: false |
| 93 | + matrix: |
| 94 | + rn_version: |
| 95 | + - v1.1.6 |
| 96 | + - v1.1.4 |
| 97 | + - v1.1.3 |
| 98 | + scenario: |
| 99 | + - { name: migration_1-restore, setup_type: standard } |
| 100 | + - { name: migration_2-migration, setup_type: standard } |
| 101 | + - { name: migration_3-with-passphrase, setup_type: standard } |
| 102 | + - { name: migration_4-with-sweep, setup_type: sweep } |
| 103 | + with: |
| 104 | + e2e_branch: ${{ needs.e2e-branch.outputs.branch }} |
| 105 | + rn_version: ${{ matrix.rn_version }} |
| 106 | + setup_type: ${{ matrix.scenario.setup_type }} |
| 107 | + scenario_name: ${{ matrix.scenario.name }} |
| 108 | + |
| 109 | + e2e-tests: |
| 110 | + if: github.event.pull_request.draft == false |
| 111 | + runs-on: macos-latest |
| 112 | + needs: [build, e2e-branch, prepare-wallets] |
| 113 | + |
| 114 | + strategy: |
| 115 | + fail-fast: false |
| 116 | + matrix: |
| 117 | + rn_version: |
| 118 | + - v1.1.6 |
| 119 | + - v1.1.4 |
| 120 | + - v1.1.3 |
| 121 | + scenario: |
| 122 | + - { name: migration_1-restore, grep: "@migration_1" } |
| 123 | + - { name: migration_2-migration, grep: "@migration_2" } |
| 124 | + - { name: migration_3-with-passphrase, grep: "@migration_3" } |
| 125 | + - { name: migration_4-with-sweep, grep: "@migration_4" } |
| 126 | + |
| 127 | + name: e2e-tests - ${{ matrix.rn_version }} - ${{ matrix.scenario.name }} |
| 128 | + |
| 129 | + env: |
| 130 | + BACKEND: regtest |
| 131 | + RN_APK_PATH: bitkit-e2e-tests/aut/bitkit_rn_regtest_ios_${{ matrix.rn_version }}.app |
| 132 | + |
| 133 | + steps: |
| 134 | + - name: Show selected E2E branch |
| 135 | + env: |
| 136 | + E2E_BRANCH: ${{ needs.e2e-branch.outputs.branch }} |
| 137 | + run: echo $E2E_BRANCH |
| 138 | + |
| 139 | + - name: Clone E2E tests |
| 140 | + uses: actions/checkout@v4 |
| 141 | + with: |
| 142 | + repository: synonymdev/bitkit-e2e-tests |
| 143 | + path: bitkit-e2e-tests |
| 144 | + ref: ${{ needs.e2e-branch.outputs.branch }} |
| 145 | + |
| 146 | + - name: Download iOS app |
| 147 | + uses: actions/download-artifact@v4 |
| 148 | + with: |
| 149 | + name: bitkit-e2e-ios_${{ github.run_number }} |
| 150 | + path: bitkit-e2e-tests/aut |
| 151 | + |
| 152 | + - name: Download migration env |
| 153 | + uses: actions/download-artifact@v4 |
| 154 | + with: |
| 155 | + name: migration-env_${{ matrix.rn_version }}_${{ matrix.scenario.name }} |
| 156 | + path: bitkit-e2e-tests/artifacts |
| 157 | + |
| 158 | + - name: Export migration env |
| 159 | + working-directory: bitkit-e2e-tests |
| 160 | + run: | |
| 161 | + set -euo pipefail |
| 162 | + if [[ "${{ matrix.scenario.name }}" == "migration_4-with-sweep" ]]; then |
| 163 | + env_file="artifacts/migration_setup_sweep.env" |
| 164 | + else |
| 165 | + env_file="artifacts/migration_setup_standard.env" |
| 166 | + fi |
| 167 | + cat "$env_file" >> "$GITHUB_ENV" |
| 168 | +
|
| 169 | + - name: Download RN app for migration |
| 170 | + run: | |
| 171 | + mkdir -p bitkit-e2e-tests/aut |
| 172 | + curl -L -o bitkit-e2e-tests/aut/bitkit_rn_regtest_ios_${{ matrix.rn_version }}.zip \ |
| 173 | + https://github.com/synonymdev/bitkit-e2e-tests/releases/download/migration-rn-regtest/bitkit_rn_regtest_ios_${{ matrix.rn_version }}.zip |
| 174 | + unzip -o bitkit-e2e-tests/aut/bitkit_rn_regtest_ios_${{ matrix.rn_version }}.zip -d bitkit-e2e-tests/aut |
| 175 | +
|
| 176 | + - name: List app directory contents |
| 177 | + run: ls -l bitkit-e2e-tests/aut |
| 178 | + |
| 179 | + - name: Setup Node.js |
| 180 | + uses: actions/setup-node@v4 |
| 181 | + with: |
| 182 | + node-version: 22 |
| 183 | + |
| 184 | + - name: Cache npm cache |
| 185 | + uses: actions/cache@v3 |
| 186 | + with: |
| 187 | + path: ~/.npm |
| 188 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 189 | + restore-keys: | |
| 190 | + ${{ runner.os }}-node- |
| 191 | +
|
| 192 | + - name: Install dependencies |
| 193 | + working-directory: bitkit-e2e-tests |
| 194 | + run: npm ci |
| 195 | + |
| 196 | + - name: Clear previous E2E artifacts |
| 197 | + working-directory: bitkit-e2e-tests |
| 198 | + run: | |
| 199 | + rm -rf artifacts/ |
| 200 | + rm -rf /tmp/lock/ |
| 201 | +
|
| 202 | + - name: Clear iOS Simulator environment |
| 203 | + run: | |
| 204 | + echo "🔧 Shutting down all running iOS simulators..." |
| 205 | + xcrun simctl shutdown all || true |
| 206 | + echo "🔧 Erasing target simulator: iPhone 17..." |
| 207 | + xcrun simctl erase "iPhone 17" || true |
| 208 | + echo "🔧 Disabling iOS Simulator notifications..." |
| 209 | + defaults write com.apple.iphonesimulator DisableAllNotifications -bool true |
| 210 | +
|
| 211 | + - name: Run E2E Tests 1 (${{ matrix.scenario.name }}) |
| 212 | + continue-on-error: true |
| 213 | + id: test1 |
| 214 | + working-directory: bitkit-e2e-tests |
| 215 | + run: ./ci_run_ios.sh --mochaOpts.grep '${{ matrix.scenario.grep }}' |
| 216 | + env: |
| 217 | + RECORD_VIDEO: true |
| 218 | + ATTEMPT: 1 |
| 219 | + |
| 220 | + - name: Run E2E Tests 2 (${{ matrix.scenario.name }}) |
| 221 | + continue-on-error: true |
| 222 | + if: steps.test1.outcome != 'success' |
| 223 | + id: test2 |
| 224 | + working-directory: bitkit-e2e-tests |
| 225 | + run: ./ci_run_ios.sh --mochaOpts.grep "${{ matrix.scenario.grep }}" |
| 226 | + env: |
| 227 | + RECORD_VIDEO: true |
| 228 | + ATTEMPT: 2 |
| 229 | + |
| 230 | + - name: Run E2E Tests 3 (${{ matrix.scenario.name }}) |
| 231 | + if: steps.test1.outcome != 'success' && steps.test2.outcome != 'success' |
| 232 | + id: test3 |
| 233 | + working-directory: bitkit-e2e-tests |
| 234 | + run: ./ci_run_ios.sh --mochaOpts.grep "${{ matrix.scenario.grep }}" |
| 235 | + env: |
| 236 | + RECORD_VIDEO: true |
| 237 | + ATTEMPT: 3 |
| 238 | + |
| 239 | + - name: Upload E2E Artifacts (${{ matrix.scenario.name }}) |
| 240 | + if: failure() |
| 241 | + uses: actions/upload-artifact@v4 |
| 242 | + with: |
| 243 | + name: e2e-artifacts_${{ matrix.scenario.name }}_${{ matrix.rn_version }}_${{ github.run_number }} |
| 244 | + path: bitkit-e2e-tests/artifacts/ |
0 commit comments