|
| 1 | +name: e2e-android |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 9 | + cancel-in-progress: true |
| 10 | + |
| 11 | +env: |
| 12 | + E2E_TESTS: 1 # build without transform-remove-console babel plugin |
| 13 | + DEBUG: 'lnurl* lnurl server' |
| 14 | + |
| 15 | +jobs: |
| 16 | + e2e: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + fetch-depth: 1 |
| 24 | + |
| 25 | + - name: Enable KVM group perms |
| 26 | + run: | |
| 27 | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules |
| 28 | + sudo udevadm control --reload-rules |
| 29 | + sudo udevadm trigger --name-match=kvm |
| 30 | +
|
| 31 | + - name: Free Disk Space |
| 32 | + uses: jlumbroso/free-disk-space@main |
| 33 | + with: |
| 34 | + # this might remove tools that are actually needed, |
| 35 | + # if set to "true" but frees about 6 GB |
| 36 | + tool-cache: false |
| 37 | + android: false |
| 38 | + dotnet: true |
| 39 | + haskell: true |
| 40 | + large-packages: true |
| 41 | + docker-images: true |
| 42 | + swap-storage: true |
| 43 | + |
| 44 | + - name: yarn and gradle caches in /mnt |
| 45 | + run: | |
| 46 | + rm -rf ~/.yarn |
| 47 | + rm -rf ~/.gradle |
| 48 | + sudo mkdir -p /mnt/.yarn |
| 49 | + sudo mkdir -p /mnt/.gradle |
| 50 | + sudo chown -R runner /mnt/.yarn |
| 51 | + sudo chown -R runner /mnt/.gradle |
| 52 | + ln -s /mnt/.yarn /home/runner/ |
| 53 | + ln -s /mnt/.gradle /home/runner/ |
| 54 | +
|
| 55 | + - name: Create artifacts directory on /mnt |
| 56 | + run: | |
| 57 | + sudo mkdir -p /mnt/artifacts |
| 58 | + sudo chown -R runner /mnt/artifacts |
| 59 | +
|
| 60 | + - name: Specify node version |
| 61 | + uses: actions/setup-node@v4 |
| 62 | + with: |
| 63 | + node-version: 20 |
| 64 | + |
| 65 | + - name: Use gradle caches |
| 66 | + uses: actions/cache@v4 |
| 67 | + with: |
| 68 | + path: | |
| 69 | + ~/.gradle/caches |
| 70 | + ~/.gradle/wrapper |
| 71 | + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} |
| 72 | + restore-keys: | |
| 73 | + ${{ runner.os }}-gradle- |
| 74 | +
|
| 75 | + - name: Use yarn caches |
| 76 | + uses: actions/cache@v4 |
| 77 | + with: |
| 78 | + path: ~/.yarn |
| 79 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/package-lock.json') }} |
| 80 | + restore-keys: | |
| 81 | + ${{ runner.os }}-yarn- |
| 82 | +
|
| 83 | + - name: Activate enviroment variables |
| 84 | + run: cp .env.test.template .env |
| 85 | + |
| 86 | + - name: Yarn Install |
| 87 | + run: yarn || yarn |
| 88 | + env: |
| 89 | + HUSKY: 0 |
| 90 | + |
| 91 | + - name: Activate Gradle variables |
| 92 | + run: | |
| 93 | + cp .github/workflows/gradle.properties ~/.gradle/gradle.properties |
| 94 | + patch -p1 -i ./.github/workflows/react-native-quick-crypto.patch |
| 95 | +
|
| 96 | + - name: Use specific Java version for sdkmanager to work |
| 97 | + uses: actions/setup-java@v4 |
| 98 | + with: |
| 99 | + distribution: 'temurin' |
| 100 | + java-version: '17' |
| 101 | + |
| 102 | + - name: Build |
| 103 | + run: yarn e2e:build:android-release || yarn e2e:build:android-release |
| 104 | + |
| 105 | + - name: Show build outputs |
| 106 | + run: tree android/app/build/outputs/ |
| 107 | + |
| 108 | + - name: Kill java processes |
| 109 | + run: pkill -9 -f java || true |
| 110 | + |
| 111 | + - name: Run regtest setup |
| 112 | + run: | |
| 113 | + cd docker |
| 114 | + mkdir lnd && chmod 777 lnd |
| 115 | + docker-compose pull --quiet |
| 116 | + docker compose up -d |
| 117 | +
|
| 118 | + - name: Wait for electrum server and LND |
| 119 | + timeout-minutes: 10 |
| 120 | + run: | |
| 121 | + while ! nc -z '127.0.0.1' 60001; do sleep 1; done |
| 122 | + while ! nc -z '127.0.0.1' 10009; do sleep 1; done |
| 123 | + sudo chmod -R 777 docker/lnd |
| 124 | +
|
| 125 | + - name: Test attempt 1 |
| 126 | + continue-on-error: true |
| 127 | + id: test1 |
| 128 | + uses: reactivecircus/android-emulator-runner@v2 |
| 129 | + with: |
| 130 | + profile: 5.4in FWVGA # devices list: avdmanager list device |
| 131 | + api-level: 31 |
| 132 | + avd-name: Pixel_API_31_AOSP |
| 133 | + force-avd-creation: false |
| 134 | + emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none -camera-front none -partition-size 2047 |
| 135 | + arch: x86_64 |
| 136 | + script: yarn e2e:test:android-release --record-videos all --record-logs all --take-screenshots all --headless -d 200000 --artifacts-location /mnt/artifacts |
| 137 | + |
| 138 | + - name: Test attempt 2 |
| 139 | + continue-on-error: true |
| 140 | + id: test2 |
| 141 | + if: steps.test1.outcome != 'success' |
| 142 | + uses: reactivecircus/android-emulator-runner@v2 |
| 143 | + with: |
| 144 | + profile: 5.4in FWVGA # devices list: avdmanager list device |
| 145 | + api-level: 31 |
| 146 | + avd-name: Pixel_API_31_AOSP |
| 147 | + force-avd-creation: false |
| 148 | + emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none -camera-front none -partition-size 2047 |
| 149 | + arch: x86_64 |
| 150 | + script: yarn e2e:test:android-release --record-videos all --record-logs all --take-screenshots all --headless -d 200000 --artifacts-location /mnt/artifacts |
| 151 | + |
| 152 | + - name: Test attempt 3 |
| 153 | + continue-on-error: true |
| 154 | + id: test3 |
| 155 | + if: steps.test1.outcome != 'success' && steps.test2.outcome != 'success' |
| 156 | + uses: reactivecircus/android-emulator-runner@v2 |
| 157 | + with: |
| 158 | + profile: 5.4in FWVGA # devices list: avdmanager list device |
| 159 | + api-level: 31 |
| 160 | + avd-name: Pixel_API_31_AOSP |
| 161 | + force-avd-creation: false |
| 162 | + emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none -camera-front none -partition-size 2047 |
| 163 | + arch: x86_64 |
| 164 | + script: yarn e2e:test:android-release --record-videos all --record-logs all --take-screenshots all --headless -d 200000 --artifacts-location /mnt/artifacts |
| 165 | + |
| 166 | + - name: Restart docker before last attempt |
| 167 | + if: steps.test1.outcome != 'success' && steps.test2.outcome != 'success' && steps.test3.outcome != 'success' |
| 168 | + run: | |
| 169 | + cd docker && docker compose down -t 60 && docker compose up --quiet-pull -d && cd .. |
| 170 | + while ! nc -z '127.0.0.1' 60001; do sleep 1; done |
| 171 | +
|
| 172 | + - name: Test attempt 4 |
| 173 | + if: steps.test1.outcome != 'success' && steps.test2.outcome != 'success' && steps.test3.outcome != 'success' |
| 174 | + uses: reactivecircus/android-emulator-runner@v2 |
| 175 | + with: |
| 176 | + profile: 5.4in FWVGA # devices list: avdmanager list device |
| 177 | + api-level: 31 |
| 178 | + avd-name: Pixel_API_31_AOSP |
| 179 | + force-avd-creation: false |
| 180 | + emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none -camera-front none -partition-size 2047 |
| 181 | + arch: x86_64 |
| 182 | + script: yarn e2e:test:android-release --record-videos all --record-logs all --take-screenshots all --headless -d 200000 --artifacts-location /mnt/artifacts |
| 183 | + |
| 184 | + - uses: actions/upload-artifact@v4 |
| 185 | + if: failure() |
| 186 | + with: |
| 187 | + name: e2e-test-videos |
| 188 | + path: /mnt/artifacts/ |
| 189 | + |
| 190 | + - name: Dump docker logs on failure |
| 191 | + if: failure() |
| 192 | + uses: jwalton/gh-docker-logs@v2 |
0 commit comments