[Test] suite-native Android E2E #5037
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: | |
schedule: | |
- cron: "0 0 * * *" | |
pull_request: | |
paths: | |
- "suite-native/**" | |
- "suite-common/**" | |
- "packages/connect/**" | |
- ".github/workflows/test-suite-native-e2e-android.yml" | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
NODE_ENV: "test" | |
jobs: | |
# build_android_test_app: | |
# if: github.repository == 'trezor/trezor-suite' | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout project | |
# uses: actions/checkout@v4 | |
# with: | |
# submodules: "true" | |
# - name: Free Disk Space | |
# uses: jlumbroso/free-disk-space@main | |
# with: | |
# # The free GH runner has limited disk space, so we need to uninstall some preinstalled tools. | |
# 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: Setup node_modules cache | |
# uses: actions/cache@v4 | |
# with: | |
# path: node_modules | |
# key: node_modules/${{ github.ref }}/${{github.run_id}} | |
# - name: Install Yarn dependencies | |
# run: | | |
# echo -e "\nenableScripts: false" >> .yarnrc.yml | |
# echo -e "\nenableHardenedMode: false" >> .yarnrc.yml | |
# yarn install | |
# - name: Setup Java | |
# uses: actions/setup-java@v4 | |
# 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: ../../node_modules/.bin/detox build -PreactNativeArchitectures=x86_64 --configuration 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 }}/${{github.run_id}} | |
run_android_e2e_tests: | |
if: github.repository == 'trezor/trezor-suite' | |
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/refs/heads/currents-suite-lite/12231436913 | |
- name: Install Yarn dependencies | |
run: | | |
echo -e "\nenableScripts: false" >> .yarnrc.yml | |
echo -e "\nenableHardenedMode: false" >> .yarnrc.yml | |
yarn install | |
- 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 trezor-user-env-regtest | |
docker compose up --detach trezor-user-env-unix trezor-user-env-regtest | |
- 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 }}/${{github.run_id}} | |
- 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 | |
- name: Upload results to Currents.dev | |
if: ${{ ! cancelled() }} | |
env: | |
CURRENTS_PROJECT_ID: 4ytF0E | |
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }} | |
working-directory: ./suite-native/app | |
run: | | |
npx currents convert \ | |
--input-format=junit \ | |
--input-file=./reports/junit-report.xml \ | |
--output-dir=./currents \ | |
--framework=postman \ | |
--framework-version=v11.2.0 | |
npx currents upload --project-id=${CURRENTS_PROJECT_ID} --key=${CURRENTS_RECORD_KEY} --report-dir ./currents | |
- name: "Store junit reports" | |
if: ${{failure()}} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: junit-report | |
path: suite-native/app/reports | |
- name: "Store currents reports" | |
if: ${{failure()}} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: currents-report | |
path: suite-native/app/currents | |
- name: "Store failed test screenshot artifacts" | |
if: ${{failure()}} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: failed-android-tests | |
path: suite-native/app/artifacts |