From def54fdd82a5bf67c063f61a48f29aa8a41d944b Mon Sep 17 00:00:00 2001 From: Ondrej Hajek Date: Wed, 18 Feb 2026 16:10:47 +0100 Subject: [PATCH] fix(ci): Optimized build and test run for Suite native e2e --- .../template-suite-native-e2e-android.yml | 3 +- ...-suite-native-prepare-test-app-android.yml | 3 +- .../workflows/test-suite-native-e2e-ios.yml | 49 +++++++++++++++---- 3 files changed, 44 insertions(+), 11 deletions(-) diff --git a/.github/workflows/template-suite-native-e2e-android.yml b/.github/workflows/template-suite-native-e2e-android.yml index 693b3a2fcc..3010760eea 100644 --- a/.github/workflows/template-suite-native-e2e-android.yml +++ b/.github/workflows/template-suite-native-e2e-android.yml @@ -64,7 +64,8 @@ jobs: uses: actions/cache/restore@v4 with: path: node_modules - key: node_modules/${{ github.ref }}/${{github.run_id}} + key: node_modules-${{ hashFiles('yarn.lock') }} + restore-keys: node_modules- - name: Install Yarn dependencies run: | diff --git a/.github/workflows/template-suite-native-prepare-test-app-android.yml b/.github/workflows/template-suite-native-prepare-test-app-android.yml index aff4f0a3cc..706247a93a 100644 --- a/.github/workflows/template-suite-native-prepare-test-app-android.yml +++ b/.github/workflows/template-suite-native-prepare-test-app-android.yml @@ -41,7 +41,8 @@ jobs: uses: actions/cache@v4 with: path: node_modules - key: node_modules/${{ github.ref }}/${{github.run_id}} + key: node_modules-${{ hashFiles('yarn.lock') }} + restore-keys: node_modules- - name: Install Yarn dependencies run: | diff --git a/.github/workflows/test-suite-native-e2e-ios.yml b/.github/workflows/test-suite-native-e2e-ios.yml index f96f3fc39c..5c1f3eaae0 100644 --- a/.github/workflows/test-suite-native-e2e-ios.yml +++ b/.github/workflows/test-suite-native-e2e-ios.yml @@ -18,6 +18,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: + contents: read + env: NODE_ENV: "test" DETOX_BINARY_PATH: ../../node_modules/.bin/detox @@ -44,7 +47,8 @@ jobs: uses: actions/cache@v4 with: path: node_modules - key: node_modules/${{ github.ref }}/${{github.run_id}} + key: node_modules-${{ hashFiles('yarn.lock') }} + restore-keys: node_modules- - name: Install Yarn dependencies run: | @@ -52,6 +56,11 @@ jobs: 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 @@ -61,10 +70,19 @@ jobs: working-directory: ./suite-common/message-system run: yarn sign-config - - name: Use latest stable Xcode - uses: maxim-lobanov/setup-xcode@v1 + - name: Cache CocoaPods + uses: actions/cache@v4 with: - xcode-version: "26.0.1" + 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 @@ -79,6 +97,10 @@ jobs: 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 @@ -96,7 +118,8 @@ jobs: uses: actions/cache@v4 with: path: node_modules - key: node_modules/${{ github.ref }}/${{github.run_id}} + key: node_modules-${{ hashFiles('yarn.lock') }} + restore-keys: node_modules- - name: Install Yarn dependencies run: | @@ -131,6 +154,16 @@ jobs: 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: @@ -152,15 +185,13 @@ jobs: CURRENTS_PROJECT_ID: LjEjiV CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }} CURRENTS_CI_BUILD_ID: pr-run-${{ github.run_id }}-${{ github.run_attempt }} - run: | - npx detox clean-framework-cache && npx detox build-framework-cache - yarn test:e2e --config=e2e/trezorDetoxRunner/config/runner-ios-release.config.js --headless + 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 + name: ios-tests-${{ matrix.TEST_GROUP }} path: suite-native/app/artifacts retention-days: 14