From 9f4b4aba93f24f27a63c094914fe17a9c166cd26 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Thu, 12 Dec 2024 09:01:31 -0800 Subject: [PATCH] Test Old Arch with Maestro (#48244) Summary: This pr tests the Old Arch on the Template app using Maestro ## Changelog: [Internal] - Test old arch in CI with Maestro for template app Pull Request resolved: https://github.com/facebook/react-native/pull/48244 Test Plan: GHA Reviewed By: cortinico Differential Revision: D67141524 Pulled By: cipolleschi fbshipit-source-id: bef3a9b6fec9d7c91d858d534a2d00e91f1842b5 --- .github/actions/maestro-android/action.yml | 13 +++++++++---- .github/actions/maestro-ios/action.yml | 10 ++++++---- .github/workflow-scripts/maestro-android.js | 5 +++-- .github/workflows/test-all.yml | 16 +++++++++++++++- packages/rn-tester/Podfile.lock | 6 +++--- 5 files changed, 36 insertions(+), 14 deletions(-) diff --git a/.github/actions/maestro-android/action.yml b/.github/actions/maestro-android/action.yml index c8882c023b2..99a8c073309 100644 --- a/.github/actions/maestro-android/action.yml +++ b/.github/actions/maestro-android/action.yml @@ -25,6 +25,10 @@ inputs: required: false default: "." description: The directory from which metro should be started + architecture: + required: false + default: "NewArch" + description: The react native architecture to test runs: using: composite @@ -52,6 +56,7 @@ runs: if: ${{ inputs.flavor == 'debug' }} run: ./packages/react-native-codegen/scripts/oss/build.sh - name: Run e2e tests + id: run-tests uses: reactivecircus/android-emulator-runner@v2 with: api-level: 24 @@ -69,16 +74,16 @@ runs: NORM_APP_ID=$(echo "${{ inputs.app-id }}" | tr '.' '-') echo "app-id=$NORM_APP_ID" >> $GITHUB_OUTPUT - name: Store tests result - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4.3.4 if: always() with: - name: e2e_android_${{ steps.normalize-app-id.outputs.app-id }}_report_${{ inputs.jsengine }}_${{ inputs.flavor }} + name: e2e_android_${{ steps.normalize-app-id.outputs.app-id }}_report_${{ inputs.jsengine }}_${{ inputs.flavor }}_${{ inputs.architecture }} path: | report.xml screen.mp4 - name: Store Logs - if: failure() && steps.run-tests.outcome == 'failure' + if: steps.run-tests.outcome == 'failure' uses: actions/upload-artifact@v4.3.4 with: - name: maestro-logs-android-${{ steps.normalize-app-id.outputs.app-id }}-${{ inputs.jsengine }}-${{ inputs.flavor }} + name: maestro-logs-android-${{ steps.normalize-app-id.outputs.app-id }}-${{ inputs.jsengine }}-${{ inputs.flavor }}-${{ inputs.architecture }} path: /tmp/MaestroLogs diff --git a/.github/actions/maestro-ios/action.yml b/.github/actions/maestro-ios/action.yml index 34586168369..e5dd927bec3 100644 --- a/.github/actions/maestro-ios/action.yml +++ b/.github/actions/maestro-ios/action.yml @@ -21,6 +21,10 @@ inputs: required: false default: "." description: The directory from which metro should be started + architecture: + required: false + default: "NewArch" + description: The react native architecture to test runs: using: composite @@ -86,8 +90,6 @@ runs: CURR_ATTEMPT=$((CURR_ATTEMPT+1)) echo "Attempt number $CURR_ATTEMPT" - - echo "Start video record using pid: video_record_${{ inputs.jsengine }}_$CURR_ATTEMPT.pid" xcrun simctl io booted recordVideo video_record_$CURR_ATTEMPT.mov & echo $! > video_record_${{ inputs.jsengine }}_$CURR_ATTEMPT.pid @@ -105,7 +107,7 @@ runs: if: always() uses: actions/upload-artifact@v4.3.4 with: - name: e2e_ios_${{ inputs.app-id }}_report_${{ inputs.jsengine }}_${{ inputs.flavor }} + name: e2e_ios_${{ inputs.app-id }}_report_${{ inputs.jsengine }}_${{ inputs.flavor }}_${{ inputs.architecture }} path: | video_record_1.mov video_record_2.mov @@ -117,5 +119,5 @@ runs: if: failure() && steps.run-tests.outcome == 'failure' uses: actions/upload-artifact@v4.3.4 with: - name: maestro-logs-${{ inputs.app-id }}-${{ inputs.jsengine }}-${{ inputs.flavor }} + name: maestro-logs-${{ inputs.app-id }}-${{ inputs.jsengine }}-${{ inputs.flavor }}-${{ inputs.architecture }} path: /tmp/MaestroLogs diff --git a/.github/workflow-scripts/maestro-android.js b/.github/workflow-scripts/maestro-android.js index 462ce25ae42..f6533bd0933 100644 --- a/.github/workflow-scripts/maestro-android.js +++ b/.github/workflow-scripts/maestro-android.js @@ -55,6 +55,7 @@ async function main() { stdio: 'ignore', detached: true, }); + metroProcess.unref(); console.info(`- Metro PID: ${metroProcess.pid}`); } @@ -88,15 +89,15 @@ async function main() { if (IS_DEBUG && metroProcess != null) { const pid = metroProcess.pid; console.info(`Kill Metro. PID: ${pid}`); - process.kill(-pid); + process.kill(pid); console.info(`Metro Killed`); - process.exit(); } } if (error) { throw error; } + process.exit(); } function sleep(ms) { diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 6511d7dab53..b10d34c2323 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -233,6 +233,7 @@ jobs: matrix: jsengine: [Hermes, JSC] flavor: [Debug, Release] + architecture: [OldArch, NewArch] steps: - name: Checkout uses: actions/checkout@v4 @@ -277,7 +278,12 @@ jobs: cd /tmp/RNTestProject/ios bundle install - HERMES_ENGINE_TARBALL_PATH=$HERMES_PATH bundle exec pod install + NEW_ARCH_ENABLED=1 + if [[ ${{ matrix.architecture }} == "OldArch" ]]; then + echo "Disable the New Architecture" + NEW_ARCH_ENABLED=0 + fi + HERMES_ENGINE_TARBALL_PATH=$HERMES_PATH RCT_NEW_ARCH_ENABLED=$NEW_ARCH_ENABLED bundle exec pod install xcodebuild \ -scheme "RNTestProject" \ @@ -295,6 +301,7 @@ jobs: maestro-flow: ./scripts/e2e/.maestro/ flavor: ${{ matrix.flavor }} working-directory: /tmp/RNTestProject + architecture: ${{ matrix.architecture }} test_e2e_android_templateapp: if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }} @@ -306,6 +313,7 @@ jobs: matrix: jsengine: [Hermes, JSC] flavor: [debug, release] + architecture: [OldArch, NewArch] steps: - name: Checkout uses: actions/checkout@v4 @@ -351,6 +359,11 @@ jobs: cd /tmp/RNTestProject echo "react.internal.mavenLocalRepo=$MAVEN_LOCAL" >> android/gradle.properties + if [[ ${{matrix.architecture}} == "OldArch" ]]; then + echo "Disabling the New Architecture" + sed -i 's/newArchEnabled=true/newArchEnabled=false/' android/gradle.properties + fi + # Build cd android CAPITALIZED_FLAVOR=$(echo "${{ matrix.flavor }}" | awk '{print toupper(substr($0, 1, 1)) substr($0, 2)}') @@ -366,6 +379,7 @@ jobs: install-java: 'false' flavor: ${{ matrix.flavor }} working-directory: /tmp/RNTestProject + architecture: ${{ matrix.architecture }} build_hermesc_linux: runs-on: ubuntu-latest diff --git a/packages/rn-tester/Podfile.lock b/packages/rn-tester/Podfile.lock index 129991a72ef..29b9fea3dbf 100644 --- a/packages/rn-tester/Podfile.lock +++ b/packages/rn-tester/Podfile.lock @@ -1895,8 +1895,8 @@ EXTERNAL SOURCES: :path: "../react-native/ReactCommon/yoga" SPEC CHECKSUMS: - boost: 7e761d76ca2ce687f7cc98e698152abd03a18f90 - DoubleConversion: cb417026b2400c8f53ae97020b2be961b59470cb + boost: 1dca942403ed9342f98334bf4c3621f011aa7946 + DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953 fast_float: 06eeec4fe712a76acc9376682e4808b05ce978b6 FBLazyVector: d3c2dd739a63c1a124e775df075dc7c517a719cb fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd @@ -1973,4 +1973,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 8591f96a513620a2a83a0b9a125ad3fa32ea1369 -COCOAPODS: 1.14.3 +COCOAPODS: 1.15.2