E2E Migration #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: E2E Migration | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| e2e_branch: | |
| description: "Branch of synonymdev/bitkit-e2e-tests to use (main | default-feature-branch | custom branch name)" | |
| required: false | |
| default: "default-feature-branch" | |
| schedule: | |
| - cron: "0 2 * * *" | |
| env: | |
| TERM: xterm-256color | |
| FORCE_COLOR: 1 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| if: github.event.pull_request.draft == false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "17" | |
| distribution: "adopt" | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Decode google-services.json | |
| run: echo "$GOOGLE_SERVICES_JSON_BASE64" | base64 -d > app/google-services.json | |
| env: | |
| GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }} | |
| - name: Build debug app (regtest) | |
| env: | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| CHATWOOT_API: ${{ secrets.CHATWOOT_API }} | |
| E2E: true | |
| E2E_BACKEND: network | |
| GEO: false | |
| run: ./gradlew assembleDevDebug | |
| - name: Rename APK | |
| run: | | |
| apk=$(find app/build/outputs/apk/dev/debug -name 'bitkit-dev-debug-*-universal.apk') | |
| mv "$apk" app/build/outputs/apk/dev/debug/bitkit_e2e.apk | |
| - name: Upload APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bitkit-e2e-apk_${{ github.run_number }} | |
| path: app/build/outputs/apk/dev/debug/bitkit_e2e.apk | |
| e2e-branch: | |
| if: github.event.pull_request.draft == false | |
| uses: synonymdev/bitkit-e2e-tests/.github/workflows/determine-e2e-branch.yml@main | |
| with: | |
| app_branch: ${{ github.head_ref || github.ref_name }} | |
| e2e_branch_input: ${{ github.event.inputs.e2e_branch || 'default-feature-branch' }} | |
| e2e-tests: | |
| if: github.event.pull_request.draft == false | |
| runs-on: ubuntu-latest | |
| needs: [build, e2e-branch] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| rn_version: | |
| - v1.1.6 | |
| - v1.1.4 | |
| - v1.1.3 | |
| scenario: | |
| - { name: migration_1-restore, grep: "@migration_1" } | |
| - { name: migration_2-migration, grep: "@migration_2" } | |
| - { name: migration_3-with-passphrase, grep: "@migration_3" } | |
| - { name: migration_4-with-sweep, grep: "@migration_4" } | |
| name: e2e-tests - ${{ matrix.rn_version }} - ${{ matrix.scenario.name }} | |
| steps: | |
| - name: Show selected E2E branch | |
| env: | |
| E2E_BRANCH: ${{ needs.e2e-branch.outputs.branch }} | |
| run: echo $E2E_BRANCH | |
| - name: Clone E2E tests | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: synonymdev/bitkit-e2e-tests | |
| path: bitkit-e2e-tests | |
| ref: ${{ needs.e2e-branch.outputs.branch }} | |
| - name: Enable KVM | |
| run: | | |
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
| sudo udevadm control --reload-rules | |
| sudo udevadm trigger --name-match=kvm | |
| - name: AVD cache | |
| uses: actions/cache@v4 | |
| id: avd-cache | |
| with: | |
| path: | | |
| ~/.android/avd/* | |
| ~/.android/adb* | |
| key: avd-33-x86_64-pixel_6 | |
| - name: Create AVD and generate snapshot for caching | |
| if: steps.avd-cache.outputs.cache-hit != 'true' | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| profile: pixel_6 | |
| api-level: 33 | |
| arch: x86_64 | |
| avd-name: Pixel_6 | |
| force-avd-creation: false | |
| emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front none | |
| disable-animations: false | |
| script: echo "Generated AVD snapshot for caching." | |
| - name: Download APK | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: bitkit-e2e-apk_${{ github.run_number }} | |
| path: bitkit-e2e-tests/aut | |
| - name: Download RN app for migration | |
| run: | | |
| curl -L -o bitkit-e2e-tests/aut/bitkit_rn_regtest.apk \ | |
| https://github.com/synonymdev/bitkit-e2e-tests/releases/download/migration-rn-regtest/bitkit_rn_regtest_${{ matrix.rn_version }}.apk | |
| - name: List APK directory contents | |
| run: ls -l bitkit-e2e-tests/aut | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Cache npm cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| - name: Install dependencies | |
| working-directory: bitkit-e2e-tests | |
| run: npm ci | |
| - name: Run E2E Tests 1 (${{ matrix.scenario.name }}) | |
| continue-on-error: true | |
| id: test1 | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| profile: pixel_6 | |
| api-level: 33 | |
| arch: x86_64 | |
| avd-name: Pixel_6 | |
| force-avd-creation: false | |
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front none | |
| script: cd bitkit-e2e-tests && ./ci_run_android.sh --mochaOpts.grep "${{ matrix.scenario.grep }}" | |
| env: | |
| BACKEND: regtest | |
| RECORD_VIDEO: true | |
| ATTEMPT: 1 | |
| - name: Run E2E Tests 2 (${{ matrix.scenario.name }}) | |
| continue-on-error: true | |
| id: test2 | |
| if: steps.test1.outcome != 'success' | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| profile: pixel_6 | |
| api-level: 33 | |
| arch: x86_64 | |
| avd-name: Pixel_6 | |
| force-avd-creation: false | |
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front none | |
| script: cd bitkit-e2e-tests && ./ci_run_android.sh --mochaOpts.grep "${{ matrix.scenario.grep }}" | |
| env: | |
| BACKEND: regtest | |
| RECORD_VIDEO: true | |
| ATTEMPT: 2 | |
| - name: Run E2E Tests 3 (${{ matrix.scenario.name }}) | |
| id: test3 | |
| if: steps.test1.outcome != 'success' && steps.test2.outcome != 'success' | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| profile: pixel_6 | |
| api-level: 33 | |
| arch: x86_64 | |
| avd-name: Pixel_6 | |
| force-avd-creation: false | |
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front none | |
| script: cd bitkit-e2e-tests && ./ci_run_android.sh --mochaOpts.grep "${{ matrix.scenario.grep }}" | |
| env: | |
| BACKEND: regtest | |
| RECORD_VIDEO: true | |
| ATTEMPT: 3 | |
| - name: Upload E2E Artifacts (${{ matrix.scenario.name }}) | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: e2e-artifacts_${{ matrix.scenario.name }}_${{ matrix.rn_version }}_${{ github.run_number }} | |
| path: bitkit-e2e-tests/artifacts/ |