From 44d38c9d4de932fef2d998808c9c757be857fd4e Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Fri, 26 Jul 2024 09:57:46 -0700 Subject: [PATCH] Run e2e tests only on main and on stable branches (#45706) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45706 ## Context Running manual tests when preparing a release, it's time consuming. We have to do the cherry picks, wait for CI to finish, and then manually test 8 configurations. Maestro is a tool that allow us to run E2E tests automatically, and we can wire it to CI. ## Change To avoid flakyness and costs, let's run E2E tests only on main and on stable branches Changelog: [Internal] - Exploration to integrate maestro Reviewed By: blakef Differential Revision: D60283204 fbshipit-source-id: 806cb8905cb269f18785158dcc5777ef10e0ef44 --- .github/actions/build-android/action.yml | 9 ++++++++- .github/workflows/test-all.yml | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/actions/build-android/action.yml b/.github/actions/build-android/action.yml index 6856221dc57..4e33472eb02 100644 --- a/.github/actions/build-android/action.yml +++ b/.github/actions/build-android/action.yml @@ -4,6 +4,9 @@ inputs: release-type: required: true description: The type of release we are building. It could be nightly, release or dry-run + run-e2e-tests: + default: 'false' + description: If we need to build to run E2E tests. If yes, we need to build also x86. runs: using: composite steps: @@ -34,7 +37,11 @@ runs: run: | if [[ "${{ inputs.release-type }}" == "dry-run" ]]; then # dry-run: we only build ARM64 to save time/resources. For release/nightlies the default is to build all archs. - export ORG_GRADLE_PROJECT_reactNativeArchitectures="arm64-v8a,x86" # x86 is required for E2E testing + if [[ "${{ inputs.run-e2e-tests }}" == 'true' ]]; then + export ORG_GRADLE_PROJECT_reactNativeArchitectures="arm64-v8a,x86" # x86 is required for E2E testing + else + export ORG_GRADLE_PROJECT_reactNativeArchitectures="arm64-v8a" + fi TASKS="publishAllToMavenTempLocal build" elif [[ "${{ inputs.release-type }}" == "nightly" ]]; then # nightly: we set isSnapshot to true so artifacts are sent to the right repository on Maven Central. diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index bf2a35d9446..3987ce6877b 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -180,6 +180,7 @@ jobs: react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} test_e2e_ios_rntester: + if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') }} runs-on: macos-13 needs: [build_apple_slices_hermes, prepare_hermes_workspace, build_hermes_macos] @@ -214,6 +215,7 @@ jobs: maestro-flow: ./packages/rn-tester/.maestro/ test_e2e_ios_templateapp: + if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') }} runs-on: macos-13 needs: build_npm_package env: @@ -280,6 +282,7 @@ jobs: maestro-flow: ./scripts/e2e/.maestro/ test_e2e_android_templateapp: + if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') }} runs-on: ubuntu-latest needs: build_npm_package continue-on-error: true @@ -389,8 +392,10 @@ jobs: uses: ./.github/actions/build-android with: release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }} + run-e2e-tests: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') }} test_e2e_android_rntester: + if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') }} runs-on: ubuntu-latest needs: [build_android] strategy: