|
| 1 | +name: E2E Migration |
| 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 | + |
| 11 | +env: |
| 12 | + TERM: xterm-256color |
| 13 | + FORCE_COLOR: 1 |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +jobs: |
| 20 | + build: |
| 21 | + if: github.event.pull_request.draft == false |
| 22 | + runs-on: ubuntu-latest |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Checkout |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Setup Java |
| 29 | + uses: actions/setup-java@v4 |
| 30 | + with: |
| 31 | + java-version: "17" |
| 32 | + distribution: "adopt" |
| 33 | + |
| 34 | + - name: Setup Gradle |
| 35 | + uses: gradle/actions/setup-gradle@v4 |
| 36 | + |
| 37 | + - name: Decode google-services.json |
| 38 | + run: echo "$GOOGLE_SERVICES_JSON_BASE64" | base64 -d > app/google-services.json |
| 39 | + env: |
| 40 | + GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }} |
| 41 | + |
| 42 | + - name: Build debug app (regtest) |
| 43 | + env: |
| 44 | + GITHUB_ACTOR: ${{ github.actor }} |
| 45 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + CHATWOOT_API: ${{ secrets.CHATWOOT_API }} |
| 47 | + E2E: true |
| 48 | + E2E_BACKEND: network |
| 49 | + GEO: false |
| 50 | + run: ./gradlew assembleDevDebug |
| 51 | + |
| 52 | + - name: Rename APK |
| 53 | + run: | |
| 54 | + apk=$(find app/build/outputs/apk/dev/debug -name 'bitkit-android-*-devDebug.apk') |
| 55 | + mv "$apk" app/build/outputs/apk/dev/debug/bitkit_e2e.apk |
| 56 | +
|
| 57 | + - name: Upload APK |
| 58 | + uses: actions/upload-artifact@v4 |
| 59 | + with: |
| 60 | + name: bitkit-e2e-apk_${{ github.run_number }} |
| 61 | + path: app/build/outputs/apk/dev/debug/bitkit_e2e.apk |
| 62 | + |
| 63 | + e2e-branch: |
| 64 | + if: github.event.pull_request.draft == false |
| 65 | + uses: synonymdev/bitkit-e2e-tests/.github/workflows/determine-e2e-branch.yml@main |
| 66 | + with: |
| 67 | + app_branch: ${{ github.head_ref || github.ref_name }} |
| 68 | + e2e_branch_input: ${{ github.event.inputs.e2e_branch || 'default-feature-branch' }} |
| 69 | + |
| 70 | + e2e-tests: |
| 71 | + if: github.event.pull_request.draft == false |
| 72 | + runs-on: ubuntu-latest |
| 73 | + needs: [build, e2e-branch] |
| 74 | + |
| 75 | + strategy: |
| 76 | + fail-fast: false |
| 77 | + matrix: |
| 78 | + scenario: |
| 79 | + - { name: migration_1, grep: "@migration_1" } |
| 80 | + - { name: migration_2, grep: "@migration_2" } |
| 81 | + - { name: migration_3, grep: "@migration_3" } |
| 82 | + - { name: migration_4, grep: "@migration_4" } |
| 83 | + |
| 84 | + name: e2e-tests - ${{ matrix.scenario.name }} |
| 85 | + |
| 86 | + steps: |
| 87 | + - name: Show selected E2E branch |
| 88 | + env: |
| 89 | + E2E_BRANCH: ${{ needs.e2e-branch.outputs.branch }} |
| 90 | + run: echo $E2E_BRANCH |
| 91 | + |
| 92 | + - name: Clone E2E tests |
| 93 | + uses: actions/checkout@v4 |
| 94 | + with: |
| 95 | + repository: synonymdev/bitkit-e2e-tests |
| 96 | + path: bitkit-e2e-tests |
| 97 | + ref: ${{ needs.e2e-branch.outputs.branch }} |
| 98 | + |
| 99 | + - name: Enable KVM |
| 100 | + run: | |
| 101 | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules |
| 102 | + sudo udevadm control --reload-rules |
| 103 | + sudo udevadm trigger --name-match=kvm |
| 104 | +
|
| 105 | + - name: Download APK |
| 106 | + uses: actions/download-artifact@v4 |
| 107 | + with: |
| 108 | + name: bitkit-e2e-apk_${{ github.run_number }} |
| 109 | + path: bitkit-e2e-tests/aut |
| 110 | + |
| 111 | + - name: Download RN app for migration |
| 112 | + run: | |
| 113 | + curl -L -o bitkit-e2e-tests/aut/bitkit_rn_regtest.apk \ |
| 114 | + https://github.com/synonymdev/bitkit-e2e-tests/releases/download/migration-rn-regtest/bitkit_rn_regtest.apk |
| 115 | +
|
| 116 | + - name: List APK directory contents |
| 117 | + run: ls -l bitkit-e2e-tests/aut |
| 118 | + |
| 119 | + - name: Setup Node.js |
| 120 | + uses: actions/setup-node@v4 |
| 121 | + with: |
| 122 | + node-version: 22 |
| 123 | + |
| 124 | + - name: Cache npm cache |
| 125 | + uses: actions/cache@v3 |
| 126 | + with: |
| 127 | + path: ~/.npm |
| 128 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 129 | + restore-keys: | |
| 130 | + ${{ runner.os }}-node- |
| 131 | +
|
| 132 | + - name: Install dependencies |
| 133 | + working-directory: bitkit-e2e-tests |
| 134 | + run: npm ci |
| 135 | + |
| 136 | + - name: Run E2E Tests 1 (${{ matrix.scenario.name }}) |
| 137 | + continue-on-error: true |
| 138 | + id: test1 |
| 139 | + uses: reactivecircus/android-emulator-runner@v2 |
| 140 | + with: |
| 141 | + profile: pixel_6 |
| 142 | + api-level: 33 |
| 143 | + arch: x86_64 |
| 144 | + avd-name: Pixel_6 |
| 145 | + force-avd-creation: false |
| 146 | + emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-front none |
| 147 | + script: cd bitkit-e2e-tests && ./ci_run_android.sh --mochaOpts.grep "${{ matrix.scenario.grep }}" |
| 148 | + env: |
| 149 | + BACKEND: regtest |
| 150 | + RECORD_VIDEO: true |
| 151 | + ATTEMPT: 1 |
| 152 | + |
| 153 | + - name: Run E2E Tests 2 (${{ matrix.scenario.name }}) |
| 154 | + continue-on-error: true |
| 155 | + id: test2 |
| 156 | + if: steps.test1.outcome != 'success' |
| 157 | + uses: reactivecircus/android-emulator-runner@v2 |
| 158 | + with: |
| 159 | + profile: pixel_6 |
| 160 | + api-level: 33 |
| 161 | + arch: x86_64 |
| 162 | + avd-name: Pixel_6 |
| 163 | + force-avd-creation: false |
| 164 | + emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-front none |
| 165 | + script: cd bitkit-e2e-tests && ./ci_run_android.sh --mochaOpts.grep "${{ matrix.scenario.grep }}" |
| 166 | + env: |
| 167 | + BACKEND: regtest |
| 168 | + RECORD_VIDEO: true |
| 169 | + ATTEMPT: 2 |
| 170 | + |
| 171 | + - name: Run E2E Tests 3 (${{ matrix.scenario.name }}) |
| 172 | + id: test3 |
| 173 | + if: steps.test1.outcome != 'success' && steps.test2.outcome != 'success' |
| 174 | + uses: reactivecircus/android-emulator-runner@v2 |
| 175 | + with: |
| 176 | + profile: pixel_6 |
| 177 | + api-level: 33 |
| 178 | + arch: x86_64 |
| 179 | + avd-name: Pixel_6 |
| 180 | + force-avd-creation: false |
| 181 | + emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-front none |
| 182 | + script: cd bitkit-e2e-tests && ./ci_run_android.sh --mochaOpts.grep "${{ matrix.scenario.grep }}" |
| 183 | + env: |
| 184 | + BACKEND: regtest |
| 185 | + RECORD_VIDEO: true |
| 186 | + ATTEMPT: 3 |
| 187 | + |
| 188 | + - name: Upload E2E Artifacts (${{ matrix.scenario.name }}) |
| 189 | + if: failure() |
| 190 | + uses: actions/upload-artifact@v4 |
| 191 | + with: |
| 192 | + name: e2e-artifacts_${{ matrix.scenario.name }}_${{ github.run_number }} |
| 193 | + path: bitkit-e2e-tests/artifacts/ |
0 commit comments