Files
trezor-suite/.github/workflows/test-suite-native-e2e-ios.yml
2026-02-11 18:28:40 +01:00

168 lines
5.3 KiB
YAML

name: "[Test] suite-native iOS E2E"
on:
schedule:
- cron: "0 0 * * 1-5"
push:
branches:
- release-native/*
workflow_dispatch:
inputs:
publish_results_to_github:
description: "Publish test report to GitHub Project"
required: false
default: false
type: boolean
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NODE_ENV: "test"
DETOX_BINARY_PATH: ../../node_modules/.bin/detox
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
RN_SRC_EXT: "e2e.ts,e2e.tsx"
jobs:
prepare_ios_test_app:
if: github.repository == 'trezor/trezor-suite'
runs-on: macos-latest
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 }}/${{github.run_id}}
- name: Install Yarn dependencies
run: |
echo -e "\nenableScripts: false" >> .yarnrc.yml
echo -e "\nenableHardenedMode: false" >> .yarnrc.yml
yarn install
- name: Prebuild native expo project
working-directory: ./suite-native/app
run: yarn prebuild --platform ios --clean
# Detox runtime may indirectly import the built config, and that would crash if message-system is not built
- name: Sign message system config
working-directory: ./suite-common/message-system
run: yarn sign-config
- name: Use latest stable Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "26.0.1"
- name: Build a Detox test app
working-directory: ./suite-native/app
run: npx detox build --configuration ios.sim.release
- name: Store build artifact
uses: actions/upload-artifact@v4
with:
name: ios-test-build
path: |
suite-native/app/ios/build/Build/Products/Release-iphonesimulator/TrezorSuiteDebug.app
run_ios_e2e_tests:
runs-on: macos-latest
needs: prepare_ios_test_app
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: Load 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: Generate GitHub App token
id: trezor-bot-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.TREZOR_BOT_APP_ID }}
private-key: ${{ secrets.TREZOR_BOT_PRIVATE_KEY }}
# Used by github reporter when publishing results of release run
- name: Extract Release Build
id: extract_branch
shell: bash
run: |
echo "release_build=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}-${GITHUB_SHA:0:7}" >> $GITHUB_ENV
- name: Install macOS dependencies
run: |
brew tap wix/brew
brew install wix/brew/applesimutils
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
- name: Download app build artifact
uses: actions/download-artifact@v4
with:
name: ios-test-build
path: |
suite-native/app/ios/build/Build/Products/Release-iphonesimulator/TrezorSuiteDebug.app
- name: Prepare iPhone 11 Simulator
run: xcrun simctl create "iPhone 11" com.apple.CoreSimulator.SimDeviceType.iPhone-11
- name: Run Detox E2E iOS tests
working-directory: ./suite-native/app
env:
PUBLISH_RESULTS_TO_GITHUB: ${{ inputs.publish_results_to_github == true }}
GITHUB_TOKEN: ${{ steps.trezor-bot-token.outputs.token }}
GITHUB_REPORTER_VERBOSE: false
RELEASE_BUILD: ${{ env.release_build }}
GITHUB_ACTION: true
CURRENTS_PROJECT_ID: LjEjiV
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}
run: |
npx detox clean-framework-cache && npx detox build-framework-cache
yarn test:e2e --config=e2e/trezorDetoxRunner/config/runner-ios-release.config.js --headless
- name: "Store test artifacts"
uses: actions/upload-artifact@v4
with:
name: ios-tests
path: suite-native/app/artifacts
retention-days: 14
notify_scheduled_failure_to_slack:
runs-on: ubuntu-latest
if: ${{ failure() && github.event_name == 'schedule' }}
needs: run_ios_e2e_tests
steps:
- name: Notify scheduled job failure to Slack
run: |
curl -X POST -H 'Content-type: application/json' --data '{"text":"Nightly iOS :ios: E2E tests failed :7952-pepeyikes: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} "}' "${{ secrets.SLACK_MOBILE_E2E_WEBHOOK }}"