Test Mobile E2E #388
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 Mobile E2E" | |
on: | |
schedule: | |
- cron: "0 3 * * 1-5" | |
workflow_call: | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: | | |
If you run this manually, and want to run on a PR, the correct ref should be refs/pull/{PR_NUMBER}/merge to | |
have the "normal" scenario involving checking out a merge commit between your branch and the base branch. | |
If you want to run only on a branch or specific commit, you can use either the sha or the branch name instead (prefer the first verion for PRs). | |
type: string | |
required: false | |
login: | |
description: The GitHub username that triggered the workflow | |
type: string | |
required: false | |
base_ref: | |
description: The base branch to merge the head into when checking out the code | |
type: string | |
required: false | |
export_to_xray: | |
description: Send tests results to Xray | |
required: false | |
type: boolean | |
default: false | |
test_execution_android: | |
description: "[Android] Test Execution ticket ID. Ex: 'B2CQA-2461'" | |
required: false | |
type: string | |
test_execution_ios: | |
description: "[iOS] Test Execution ticket ID. Ex: 'B2CQA-2461'" | |
required: false | |
type: string | |
speculos_tests: | |
description: Run Speculos tests | |
required: false | |
type: boolean | |
default: false | |
slack_notif: | |
description: "Send notification to Slack?" | |
required: false | |
type: boolean | |
default: false | |
enable_broadcast: | |
description: "Enable transaction broadcast" | |
required: false | |
type: boolean | |
default: false | |
production_firebase: | |
description: "Target Production Firebase environment" | |
required: false | |
type: boolean | |
default: false | |
# Uncomment to have log-level: trace on detox run and build | |
# (cf: apps/ledger-live-mobile/detox.config.js) | |
# env: | |
# DEBUG_DETOX: true | |
permissions: | |
id-token: write | |
contents: read | |
env: | |
SPECULOS_IMAGE_TAG: ghcr.io/ledgerhq/speculos:d3fc405353651d3f53d0ce162e26c732f5f6ee98@sha256:ea0af25fb7cdc1ed2e97210a244af243cc85194f732f10aaf65480a44a84d089 | |
COINAPPS: ${{ github.workspace }}/coin-apps | |
SPECULOS_RUN: ${{ inputs.speculos_tests || github.event_name == 'schedule' }} | |
jobs: | |
speculos-ios: | |
name: "LLM - iOS Detox Tests" | |
runs-on: [speculos, linux] | |
outputs: | |
coinapps_remote: ${{ env.COINAPPS }} | |
steps: | |
- name: Setup Speculos image and Coin Apps | |
if: ${{ env.SPECULOS_RUN == 'true' }} | |
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-speculos_image@support/qaa-201-speculos-mac-os | |
with: | |
coinapps_path: ${{ github.workspace }}/coin-apps | |
speculos_tag: ${{ env.SPECULOS_IMAGE_TAG }} | |
bot_id: ${{ secrets.GH_BOT_APP_ID }} | |
bot_key: ${{ secrets.GH_BOT_PRIVATE_KEY }} | |
detox-tests-ios: | |
name: "LLM - iOS Detox Tests" | |
runs-on: [macOS, speculos] | |
needs: [speculos-ios] | |
env: | |
NODE_OPTIONS: "--max-old-space-size=8192" | |
LANG: en_US.UTF-8 | |
LANGUAGE: en_US.UTF-8 | |
LC_ALL: en_US.UTF-8 | |
COINAPPS_REMOTE: ${{ needs.speculos-ios.outputs.coinapps_remote }} | |
DOCKER_API_ADDRESS: 10.102.97.71 | |
DOCKER_API_PORT: 2375 | |
outputs: | |
status: ${{ steps.detox.outcome }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.ref || github.sha }} | |
- name: setup caches | |
id: caches | |
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-caches@develop | |
with: | |
skip-pod-cache: "true" | |
skip-turbo-cache: "false" | |
accountId: ${{ secrets.AWS_ACCOUNT_ID_PROD }} | |
roleName: ${{ secrets.AWS_CACHE_ROLE_NAME }} | |
region: ${{ secrets.AWS_CACHE_REGION }} | |
turbo-server-token: ${{ secrets.TURBOREPO_SERVER_TOKEN }} | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
id: aws | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID_PROD }}:role/${{ secrets.AWS_CACHE_ROLE_NAME }} | |
aws-region: ${{ secrets.AWS_CACHE_REGION }} | |
- uses: nick-fields/retry@v3 | |
name: install dependencies | |
with: | |
max_attempts: 2 | |
timeout_minutes: 15 | |
command: pnpm i --filter="live-mobile..." --filter="ledger-live" --filter="@ledgerhq/dummy-*-app..." --no-frozen-lockfile --unsafe-perm | |
new_command_on_retry: rm -rf ~/.cocoapods/ && pnpm clean && pnpm i --filter="live-mobile..." --filter="ledger-live" --filter="@ledgerhq/dummy-*-app..." --no-frozen-lockfile --unsafe-perm | |
- name: cache detox build | |
uses: tespkg/actions-cache@v1 | |
if: steps.aws.conclusion == 'success' | |
id: detox-build | |
with: | |
path: ${{ github.workspace }}/apps/ledger-live-mobile/ios/build/Build/Products/Release-iphonesimulator | |
key: ${{ runner.os }}-detox-${{ hashFiles('apps/ledger-live-mobile/ios/Podfile.lock', 'apps/ledger-live-mobile/ios/ledgerlivemobile.xcodeproj/project.pbxproj', 'apps/ledger-live-mobile/detox.config.js', 'apps/ledger-live-mobile/.env.mock', 'apps/ledger-live-mobile/ios/ledgerlivemobile/AppDelegate.mm') }} | |
accessKey: ${{ env.AWS_ACCESS_KEY_ID }} | |
secretKey: ${{ env.AWS_SECRET_ACCESS_KEY }} | |
sessionToken: ${{ env.AWS_SESSION_TOKEN}} | |
bucket: ll-gha-s3-cache | |
region: ${{ secrets.AWS_CACHE_REGION }} | |
use-fallback: false | |
- name: Build dependencies | |
run: | | |
pnpm build:llm:deps --api="http://127.0.0.1:${{ steps.caches.outputs.port }}" --token="${{ secrets.TURBOREPO_SERVER_TOKEN }}" --team="foo" | |
- name: Build Dummy Live SDK and Dummy Wallet API apps for testing | |
run: | | |
pnpm build:dummy-apps | |
shell: bash | |
- name: Create iOS simulator | |
run: xcrun simctl create "iOS Simulator" "iPhone 15" | |
- name: Build iOS app for Detox test run | |
if: steps.detox-build.outputs.cache-hit != 'true' | |
run: pnpm mobile e2e:ci -p ios -b | |
- name: Build JS Bundle app for Detox test run | |
if: steps.detox-build.outputs.cache-hit == 'true' | |
run: pnpm mobile e2e:ci -p ios --bundle | |
- name: Setup Speculos image and Coin Apps | |
if: ${{ env.SPECULOS_RUN == 'true' }} | |
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-speculos_image@support/qaa-201-speculos-mac-os | |
with: | |
coinapps_path: ${{ env.COINAPPS }} | |
bot_id: ${{ secrets.GH_BOT_APP_ID }} | |
bot_key: ${{ secrets.GH_BOT_PRIVATE_KEY }} | |
- name: Test iOS app | |
id: detox | |
run: pnpm mobile e2e:ci -p ios -t $([[ "$INPUT_SPECULOS" == "true" ]] && printf %s '--speculos') | |
env: | |
SEED: ${{ secrets.SEED_QAA_B2C }} | |
INPUT_SPECULOS: ${{ env.SPECULOS_RUN }} | |
- name: Delete iOS simulator | |
if: ${{ always() }} | |
run: xcrun simctl delete all | |
- name: Upload test artifacts | |
uses: actions/upload-artifact@v4 | |
if: ${{ !cancelled() || steps.detox.outcome == 'cancelled' }} | |
with: | |
name: "ios-test-artifacts" | |
path: apps/ledger-live-mobile/artifacts | |
allure-report-ios: | |
name: "Allure Reports Export on Server" | |
runs-on: [ledger-live-medium] | |
if: ${{ !inputs.speculos_tests && (inputs.slack_notif || github.event_name == 'push') }} | |
needs: [detox-tests-ios] | |
outputs: | |
report-url: ${{ steps.upload.outputs.report-url }} | |
result: ${{ steps.summary.outputs.test_result }} | |
status: ${{ needs.detox-tests-ios.outputs.status }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ ((github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call' || github.event_name == 'pull_request') && (inputs.ref || github.ref_name)) || github.sha }} | |
- uses: LedgerHQ/ledger-live/tools/actions/composites/upload-allure-report@develop | |
id: upload | |
with: | |
platform: ios | |
login: ${{ vars.ALLURE_USERNAME }} | |
password: ${{ secrets.ALLURE_LEDGER_LIVE_PASSWORD }} | |
path: ios-test-artifacts | |
- name: Get summary | |
id: summary | |
if: ${{ !cancelled() }} | |
uses: LedgerHQ/ledger-live/tools/actions/composites/get-allure-summary@develop | |
with: | |
allure-results-path: ios-test-artifacts | |
platform: iOS |