From 23780f8cb73a22ab32eb281ecea857ae461ed35a Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Sat, 4 Jan 2025 09:02:17 -0800 Subject: [PATCH] Use the app artifact in E2E tests (#48469) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48469 This change downloads the generated artifact and uses it in the E2E tests ## Context While looking at the recent failures of the E2E tests, I realized that the Hermes, NewArch, Debug variant often fails to build, not to test, for some misconfiguration. I also realized that we are already building that varaint successfully once, so why not reuse it? To reuse prebuilds, we need a few steps: 1. make sure we build all the variants we need 2. store the .app file as an artifact 3. download the artifact and use it in the E2E tests ## Changelog: [Internal] - Build release variant for RNTester Reviewed By: mdvacca Differential Revision: D67800932 fbshipit-source-id: 6f3c8bbc42ad95cabab85dafff00e233a936d136 --- .github/actions/maestro-ios/action.yml | 5 +++++ .github/workflows/test-all.yml | 20 ++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/actions/maestro-ios/action.yml b/.github/actions/maestro-ios/action.yml index 2a476fceeb3fcd..3d71c8d4ec65a1 100644 --- a/.github/actions/maestro-ios/action.yml +++ b/.github/actions/maestro-ios/action.yml @@ -46,6 +46,11 @@ runs: shell: bash if: ${{ inputs.flavor == 'Debug' }} run: | + yarn install + + # build codegen or we will see a redbox + ./packages/react-native-codegen/scripts/oss/build.sh + cd ${{ inputs.working-directory }} yarn start & sleep 5 # to give metro time to load diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 3a49ebea3a550b..fe6de2c89c6400 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -195,7 +195,7 @@ jobs: if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }} runs-on: macos-13-large needs: - [build_apple_slices_hermes, prepare_hermes_workspace, build_hermes_macos] + [test_ios_rntester] env: HERMES_WS_DIR: /tmp/hermes HERMES_TARBALL_ARTIFACTS_DIR: /tmp/hermes/hermes-runtime-darwin @@ -209,21 +209,17 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Run it - uses: ./.github/actions/test-ios-rntester + - name: Download App + uses: actions/download-artifact@v4 with: - jsengine: ${{ matrix.jsengine }} - architecture: ${{ matrix.architecture }} - run-unit-tests: "false" - use-frameworks: StaticLibraries - hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} - react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} - run-e2e-tests: "true" - flavor: ${{ matrix.flavor }} + name: RNTesterApp-${{ matrix.architecture }}-${{ matrix.jsengine }}-${{ matrix.flavor }} + path: /tmp/RNTesterBuild/RNTester.app + - name: Check downloaded folder content + run: ls -lR /tmp/RNTesterBuild - name: Run E2E Tests uses: ./.github/actions/maestro-ios with: - app-path: "/tmp/RNTesterBuild/Build/Products/${{ matrix.flavor }}-iphonesimulator/RNTester.app" + app-path: "/tmp/RNTesterBuild/RNTester.app" app-id: com.meta.RNTester.localDevelopment jsengine: ${{ matrix.jsengine }} maestro-flow: ./packages/rn-tester/.maestro/