T3T1 in Suite and Connect #226
Workflow file for this run
This file contains 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: "[Test] suite-native Android E2E" | |
on: | |
pull_request: | |
paths: | |
- "suite-native/**" | |
- "suite-common/**" | |
- "packages/connect/**" | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build_android_test_app: | |
runs-on: ubuntu-latest | |
env: | |
EXPO_PUBLIC_ENVIRONMENT: "debug" | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
- name: Install node and yarn | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: yarn | |
- name: Setup node_modules cache | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: node_modules-${{ github.ref }} | |
- name: Install Yarn dependencies | |
run: yarn install | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: Sign message system config | |
working-directory: ./suite-common/message-system | |
run: yarn sign-config | |
- name: Prebuild native expo project | |
working-directory: ./suite-native/app | |
run: yarn prebuild --platform android --clean | |
- name: Build Detox test .apk | |
run: yarn build:e2e android.emu.release | |
working-directory: ./suite-native/app | |
- name: Save build to cache | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
suite-native/app/android/app/build/ | |
key: android_test_build-${{ github.ref }} | |
run_android_e2e_tests: | |
runs-on: ubuntu-latest | |
needs: build_android_test_app | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
- name: Free Disk Space | |
uses: jlumbroso/free-disk-space@main | |
with: | |
# Combination of android emulator and trezor-user-env is using a too much disk space | |
# of a free tier GH action runner, some preinstalled packages have to be removed. | |
dotnet: true | |
haskell: true | |
tool-cache: false | |
android: false | |
swap-storage: false | |
large-packages: false | |
- name: Install node and yarn | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: yarn | |
- name: Load node modules cache | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: node_modules-${{ github.ref }} | |
- name: Get device name from detox config file | |
id: device | |
run: node -e "console.log('AVD_NAME=' + require('./suite-native/app/.detoxrc').devices.emulator.device.avdName)" >> $GITHUB_OUTPUT | |
- name: Run trezor-user-env | |
env: | |
COMPOSE_FILE: ./docker/docker-compose.suite-native-ci.yml | |
run: | | |
docker compose pull trezor-user-env-unix | |
docker compose up -d trezor-user-env-unix | |
- name: Read test .apk from cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
suite-native/app/android/app/build/ | |
key: android_test_build-${{ github.ref }} | |
- name: Enable Android emulator KVM optimalization | |
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: Run Detox E2E Android tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
env: | |
RUNNER_TEMP: /tmp | |
with: | |
api-level: 31 | |
profile: pixel_3a | |
arch: x86_64 | |
working-directory: suite-native/app | |
ram-size: 4096M | |
force-avd-creation: true | |
avd-name: ${{ steps.device.outputs.AVD_NAME }} | |
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -grpc 8554 | |
script: yarn test:e2e android.emu.release --headless --take-screenshots failing --record-videos failing --retries 5 | |
- name: "Store failed test screenshot artifacts" | |
if: ${{failure()}} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: failed-android-tests-screenshots | |
path: suite-native/app/artifacts |