Files
trezor-suite/.github/workflows/test-suite-native-e2e-ios.yml

206 lines
6.7 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
permissions:
contents: read
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-${{ hashFiles('yarn.lock') }}
restore-keys: node_modules-
- name: Install Yarn dependencies
run: |
echo -e "\nenableScripts: false" >> .yarnrc.yml
echo -e "\nenableHardenedMode: false" >> .yarnrc.yml
yarn install
- name: Use latest stable Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "26.0.1"
- 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: Cache CocoaPods
uses: actions/cache@v4
with:
path: suite-native/app/ios/Pods
key: pods-${{ hashFiles('suite-native/app/ios/Podfile.lock') }}
restore-keys: pods-
- name: Cache Xcode DerivedData
uses: actions/cache@v4
with:
path: suite-native/app/ios/build
key: xcode-derived-${{ hashFiles('suite-native/app/ios/Podfile.lock') }}-${{ github.sha }}
restore-keys: xcode-derived-${{ hashFiles('suite-native/app/ios/Podfile.lock') }}-
- 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
strategy:
fail-fast: false
matrix:
TEST_GROUP: [0, 1]
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-${{ hashFiles('yarn.lock') }}
restore-keys: node_modules-
- name: Install Yarn dependencies
run: |
echo -e "\nenableScripts: false" >> .yarnrc.yml
echo -e "\nenableHardenedMode: false" >> .yarnrc.yml
yarn install
# 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: 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: Cache Detox framework
uses: actions/cache@v4
with:
path: ~/Library/Detox
key: detox-framework-${{ hashFiles('**/node_modules/detox/package.json') }}
- name: Build Detox framework cache
run: npx detox clean-framework-cache && npx detox build-framework-cache
working-directory: ./suite-native/app
- 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 }}
CURRENTS_CI_BUILD_ID: pr-run-${{ github.run_id }}-${{ github.run_attempt }}
run: yarn test:e2e --config=e2e/trezorDetoxRunner/config/runner-ios-release.config.js --shard=${{ matrix.TEST_GROUP }} --totalShards=2 --headless
- name: "Store test artifacts"
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ios-tests-${{ matrix.TEST_GROUP }}
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 }}"