From a9168983fe93edf326e903650612ce496913c1c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Kwa=C5=9Bniewski?= Date: Mon, 5 Aug 2024 13:33:53 +0200 Subject: [PATCH] Move to GH Actions (#158) * Revert "feat: implement visionOS CI (#54)" This reverts commit ae6f903cc6ac3d9e94a8930fb9258fb6050a0c29. * fix: implement GH actions CI --- .../actions/test-ios-helloworld/action.yml | 2 +- .github/actions/test-ios-rntester/action.yml | 2 +- .../actions/test-visionos-rntester/action.yml | 66 +++++++++++++++++++ .github/workflows/test-all.yml | 53 +++++++++++---- .../src/commands/start/runServer.js | 1 + .../__snapshots__/public-api-test.js.snap | 4 +- yarn.lock | 58 ++++++++-------- 7 files changed, 142 insertions(+), 44 deletions(-) create mode 100644 .github/actions/test-visionos-rntester/action.yml diff --git a/.github/actions/test-ios-helloworld/action.yml b/.github/actions/test-ios-helloworld/action.yml index c3819ae95270c5..9ae0000d5145b5 100644 --- a/.github/actions/test-ios-helloworld/action.yml +++ b/.github/actions/test-ios-helloworld/action.yml @@ -43,7 +43,7 @@ runs: - name: Run yarn uses: ./.github/actions/yarn-install-with-cache - name: Setup ruby - uses: ruby/setup-ruby@v1.170.0 + uses: ruby/setup-ruby@v1.171.0 with: ruby-version: ${{ inputs.ruby-version }} - name: Install iOS dependencies - Configuration ${{ inputs.flavor }}; New Architecture ${{ inputs.architecture }}; JS Engine ${{ inputs.jsengine }} diff --git a/.github/actions/test-ios-rntester/action.yml b/.github/actions/test-ios-rntester/action.yml index 1ab333089d0901..84fa2e6021134b 100644 --- a/.github/actions/test-ios-rntester/action.yml +++ b/.github/actions/test-ios-rntester/action.yml @@ -48,7 +48,7 @@ runs: name: hermes-darwin-bin-${{ inputs.flavor }} path: ${{ inputs.hermes-tarball-artifacts-dir }} - name: Setup ruby - uses: ruby/setup-ruby@v1.170.0 + uses: ruby/setup-ruby@v1.171.0 with: ruby-version: ${{ inputs.ruby-version }} - name: Prepare IOS Tests diff --git a/.github/actions/test-visionos-rntester/action.yml b/.github/actions/test-visionos-rntester/action.yml new file mode 100644 index 00000000000000..dd35ffcdb78bc0 --- /dev/null +++ b/.github/actions/test-visionos-rntester/action.yml @@ -0,0 +1,66 @@ +name: test-visionos-rntester +description: Build visionOS RNTester using JSC +inputs: + use-frameworks: + description: The dependency building and linking strategy to use. Must be one of "StaticLibraries", "DynamicFrameworks" + default: StaticLibraries + architecture: + description: The React Native architecture to Test. RNTester has always Fabric enabled, but we want to run integration test with the old arch setup + default: NewArch + ruby-version: + description: The version of ruby that must be used + default: 2.6.10 + flavor: + description: The flavor of the build. Must be one of "Debug", "Release". + default: Debug + react-native-version: + description: The version of react-native + required: true + run-e2e-tests: + description: Whether we want to run E2E tests or not + required: false + default: false + +runs: + using: composite + steps: + - name: Setup xcode + uses: ./.github/actions/setup-xcode + with: + xcode-version: "15.4" + - name: Setup node.js + uses: ./.github/actions/setup-node + - name: Run yarn + uses: ./.github/actions/yarn-install-with-cache + - name: Setup ruby + uses: ruby/setup-ruby@v1.171.0 + with: + ruby-version: ${{ inputs.ruby-version }} + - name: Setup xcode build cache + uses: ./.github/actions/setup-xcode-build-cache + - name: Install CocoaPods dependencies + shell: bash + run: | + export USE_HERMES=0 + + if [[ ${{ inputs.use-frameworks }} == "DynamicFrameworks" ]]; then + export USE_FRAMEWORKS=dynamic + fi + + if [[ ${{ inputs.architecture }} == "NewArch" ]]; then + export RCT_NEW_ARCH_ENABLED=1 + fi + + cd packages/rn-tester + + bundle install + bundle exec pod install + - name: Build RNTester for visionOS + if: ${{ inputs.run-e2e-tests == 'false' }} + shell: bash + run: | + xcodebuild build \ + -workspace packages/rn-tester/RNTesterPods.xcworkspace \ + -scheme RNTester-visionOS \ + -sdk xrsimulator \ + -destination "platform=visionOS Simulator,name=Apple Vision Pro" diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index f458d36742f5ec..ec3562642c8038 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -1,17 +1,16 @@ name: Test All -# on: -# workflow_dispatch: -# pull_request: -# push: -# tags: -# - 'v*' -# # nightly build @ 2:15 AM UTC -# schedule: -# - cron: '15 2 * * *' +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + - "*-stable" jobs: set_release_type: + if: github.repository == 'facebook/react-native' runs-on: ubuntu-latest outputs: RELEASE_TYPE: ${{ steps.set_release_type.outputs.RELEASE_TYPE }} @@ -33,6 +32,7 @@ jobs: fi prepare_hermes_workspace: + if: github.repository == 'facebook/react-native' runs-on: ubuntu-latest env: HERMES_WS_DIR: /tmp/hermes @@ -51,6 +51,7 @@ jobs: hermes-version-file: ${{ env.HERMES_VERSION_FILE }} build_hermesc_apple: + if: github.repository == 'facebook/react-native' runs-on: macos-13 needs: prepare_hermes_workspace env: @@ -65,6 +66,7 @@ jobs: react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} build_apple_slices_hermes: + if: github.repository == 'facebook/react-native' runs-on: macos-14 needs: [build_hermesc_apple, prepare_hermes_workspace] env: @@ -91,6 +93,7 @@ jobs: react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} build_hermes_macos: + if: github.repository == 'facebook/react-native' runs-on: macos-13 needs: [build_apple_slices_hermes, prepare_hermes_workspace] env: @@ -112,6 +115,7 @@ jobs: flavor: ${{ matrix.flavor }} test_ios_rntester_ruby_3_2_0: + if: github.repository == 'facebook/react-native' runs-on: macos-13 needs: [build_apple_slices_hermes, prepare_hermes_workspace, build_hermes_macos] @@ -129,6 +133,7 @@ jobs: react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} test_ios_rntester_dynamic_frameworks: + if: github.repository == 'facebook/react-native' runs-on: macos-13 needs: [build_apple_slices_hermes, prepare_hermes_workspace, build_hermes_macos] @@ -152,6 +157,7 @@ jobs: react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} test_ios_rntester: + if: github.repository == 'facebook/react-native' runs-on: macos-13 needs: [build_apple_slices_hermes, prepare_hermes_workspace, build_hermes_macos] @@ -162,7 +168,6 @@ jobs: strategy: fail-fast: false matrix: - jsengine: [Hermes, JSC] architecture: [NewArch, OldArch] steps: - name: Checkout @@ -177,6 +182,26 @@ jobs: hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} + test_visionos_rntester: + runs-on: macos-14-xlarge + continue-on-error: true + strategy: + fail-fast: false + matrix: + architecture: [NewArch, OldArch] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Run it + uses: ./.github/actions/test-visionos-rntester + 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 }} + test_e2e_ios_rntester: if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') }} runs-on: macos-13 @@ -234,7 +259,7 @@ jobs: - name: Run yarn uses: ./.github/actions/yarn-install-with-cache - name: Setup ruby - uses: ruby/setup-ruby@v1.170.0 + uses: ruby/setup-ruby@v1.171.0 with: ruby-version: 2.6.10 - name: Download Hermes @@ -338,6 +363,7 @@ jobs: install-java: 'false' build_hermesc_linux: + if: github.repository == 'facebook/react-native' runs-on: ubuntu-latest needs: prepare_hermes_workspace env: @@ -353,6 +379,7 @@ jobs: react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} build_hermesc_windows: + if: github.repository == 'facebook/react-native' runs-on: windows-2019 needs: prepare_hermes_workspace env: @@ -372,6 +399,7 @@ jobs: react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} build_android: + if: github.repository == 'facebook/react-native' runs-on: 8-core-ubuntu needs: [set_release_type] container: @@ -512,6 +540,7 @@ jobs: compression-level: 0 test_ios_helloworld_with_ruby_3_2_0: + if: github.repository == 'facebook/react-native' runs-on: macos-13 needs: [prepare_hermes_workspace, build_hermes_macos] # prepare_hermes_workspace must be there because we need its reference to retrieve a couple of outputs env: @@ -530,6 +559,7 @@ jobs: react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} test_ios_helloworld: + if: github.repository == 'facebook/react-native' runs-on: macos-13 needs: [prepare_hermes_workspace, build_hermes_macos] # prepare_hermes_workspace must be there because we need its reference to retrieve a couple of outputs strategy: @@ -573,6 +603,7 @@ jobs: lint: runs-on: ubuntu-latest + if: github.repository == 'facebook/react-native' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: diff --git a/packages/community-cli-plugin/src/commands/start/runServer.js b/packages/community-cli-plugin/src/commands/start/runServer.js index 407800a72eadaa..a382594aefa3e0 100644 --- a/packages/community-cli-plugin/src/commands/start/runServer.js +++ b/packages/community-cli-plugin/src/commands/start/runServer.js @@ -117,6 +117,7 @@ async function runServer( let reportEvent: (event: TerminalReportableEvent) => void; const terminal = new Terminal(process.stdout); const ReporterImpl = getReporterImpl(args.customLogReporterPath); + // $FlowIgnore fix this const terminalReporter = new ReporterImpl(terminal); const reporter: Reporter = { update(event: TerminalReportableEvent) { diff --git a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap index 9604f1de23c4f5..50b8f724f82e87 100644 --- a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap +++ b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap @@ -9773,7 +9773,7 @@ exports[`public API should not change unintentionally Libraries/WebSocket/WebSoc exports[`public API should not change unintentionally Libraries/WebSocket/WebSocketInterceptor.js 1`] = `"UNTYPED MODULE"`; exports[`public API should not change unintentionally Libraries/WindowManager/NativeWindowManager.js 1`] = ` -"export * from \\"../../src/private/specs/visionos_modules/NativeWindowManager\\"; +"export * from \\"../../visionos_modules/NativeWindowManager\\"; declare export default typeof NativeWindowManager; " `; @@ -9795,7 +9795,7 @@ declare module.exports: WindowManager; `; exports[`public API should not change unintentionally Libraries/XR/NativeXRModule.js 1`] = ` -"export * from \\"../../src/private/specs/visionos_modules/NativeXRModule\\"; +"export * from \\"../../visionos_modules/NativeXRModule\\"; declare export default typeof NativeXRModule; " `; diff --git a/yarn.lock b/yarn.lock index 9d2c0e163c70e0..d383eb0b8bc6ee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2049,17 +2049,17 @@ resolved "https://registry.yarnpkg.com/@react-native/assets-registry/-/assets-registry-0.74.0.tgz#560bec29b2699c4d4cbfecfb4c2c5025397aac23" integrity sha512-I8Yy6bCKU5R4qZX4jfXsAPsHyuGHlulbnbG3NqO9JgZ3T2DJxJiZE39rHORP0trLnRh0rIeRcs4Mc14fAE6hrw== -"@react-native/babel-plugin-codegen@0.74.85": - version "0.74.85" - resolved "https://registry.yarnpkg.com/@react-native/babel-plugin-codegen/-/babel-plugin-codegen-0.74.85.tgz#067224bf5099ee2679babd700c7115822a747004" - integrity sha512-48TSDclRB5OMXiImiJkLxyCfRyLsqkCgI8buugCZzvXcYslfV7gCvcyFyQldtcOmerV+CK4RAj7QS4hmB5Mr8Q== +"@react-native/babel-plugin-codegen@0.74.86": + version "0.74.86" + resolved "https://registry.yarnpkg.com/@react-native/babel-plugin-codegen/-/babel-plugin-codegen-0.74.86.tgz#4edbb8887c5cedefd52e8fda973b1da97c779db4" + integrity sha512-fO7exk0pdsOSsK3fvDz4YKe5nMeAMrsIGi525pft/L+dedjdeiWYmEoQVc9NElxwwNCldwRY6eNMw6IhKyjzLA== dependencies: - "@react-native/codegen" "0.74.85" + "@react-native/codegen" "0.74.86" -"@react-native/babel-preset@0.74.85": - version "0.74.85" - resolved "https://registry.yarnpkg.com/@react-native/babel-preset/-/babel-preset-0.74.85.tgz#3ce6ca77a318dec226fd9e3fff9c2ef7b0aa66e3" - integrity sha512-yMHUlN8INbK5BBwiBuQMftdWkpm1IgCsoJTKcGD2OpSgZhwwm8RUSvGhdRMzB2w7bsqqBmaEMleGtW6aCR7B9w== +"@react-native/babel-preset@0.74.86": + version "0.74.86" + resolved "https://registry.yarnpkg.com/@react-native/babel-preset/-/babel-preset-0.74.86.tgz#8bb3fbd49ce11470eb8022dea2c1e51bfa8dedd4" + integrity sha512-6A+1NVAHugbBLFNU4iaYrq2lx8P7pINyqoyTtVAqd375PShRmLwu6GvuF3b/4avC97s6LmBljVTJ1xVHukA42g== dependencies: "@babel/core" "^7.20.0" "@babel/plugin-proposal-async-generator-functions" "^7.0.0" @@ -2101,7 +2101,7 @@ "@babel/plugin-transform-typescript" "^7.5.0" "@babel/plugin-transform-unicode-regex" "^7.0.0" "@babel/template" "^7.0.0" - "@react-native/babel-plugin-codegen" "0.74.85" + "@react-native/babel-plugin-codegen" "0.74.86" babel-plugin-transform-flow-enums "^0.0.2" react-refresh "^0.14.0" @@ -2115,10 +2115,10 @@ jscodeshift "^0.14.0" nullthrows "^1.1.1" -"@react-native/codegen@0.74.85": - version "0.74.85" - resolved "https://registry.yarnpkg.com/@react-native/codegen/-/codegen-0.74.85.tgz#568464071c0b9be741da1a1ab43b1df88180ca5d" - integrity sha512-N7QwoS4Hq/uQmoH83Ewedy6D0M7xbQsOU3OMcQf0eY3ltQ7S2hd9/R4UTalQWRn1OUJfXR6OG12QJ4FStKgV6Q== +"@react-native/codegen@0.74.86": + version "0.74.86" + resolved "https://registry.yarnpkg.com/@react-native/codegen/-/codegen-0.74.86.tgz#90933f5ee555ffb95ca27372ba1e836f698c3192" + integrity sha512-BOwABta9035GJ/zLMkxQfgPMr47u1/1HqNIMk10FqmTe0jmROOxKEAeP4FbeS5L1voO4ug3dqr+mcuHrG+HNhA== dependencies: "@babel/parser" "^7.20.0" glob "^7.1.1" @@ -2145,18 +2145,18 @@ node-fetch "^2.2.0" readline "^1.3.0" -"@react-native/debugger-frontend@0.74.85": - version "0.74.85" - resolved "https://registry.yarnpkg.com/@react-native/debugger-frontend/-/debugger-frontend-0.74.85.tgz#a7af94a7b81cb59f241fd1771d1b083445329700" - integrity sha512-gUIhhpsYLUTYWlWw4vGztyHaX/kNlgVspSvKe2XaPA7o3jYKUoNLc3Ov7u70u/MBWfKdcEffWq44eSe3j3s5JQ== +"@react-native/debugger-frontend@0.74.86": + version "0.74.86" + resolved "https://registry.yarnpkg.com/@react-native/debugger-frontend/-/debugger-frontend-0.74.86.tgz#87a3c7dfb12ee6e981165e304bbbe20e9b1fa009" + integrity sha512-Spq1kFX4qvPmT4HuTwpi1ALFtojlJ6s4GpWU2OnpevC/z7ks36lhD3J0rd0D9U5bkxtTYLcg31fPv7nGFC7XZg== "@react-native/dev-middleware@^0.74.0": - version "0.74.85" - resolved "https://registry.yarnpkg.com/@react-native/dev-middleware/-/dev-middleware-0.74.85.tgz#eca35aceb882b1111385f7c20f1aad7a33a2734e" - integrity sha512-BRmgCK5vnMmHaKRO+h8PKJmHHH3E6JFuerrcfE3wG2eZ1bcSr+QTu8DAlpxsDWvJvHpCi8tRJGauxd+Ssj/c7w== + version "0.74.86" + resolved "https://registry.yarnpkg.com/@react-native/dev-middleware/-/dev-middleware-0.74.86.tgz#b95f936c141dd44309a9ec558ed5ce034e270bc4" + integrity sha512-sc0tYxYt6dkUbNFI1IANzKO67M41BhjbJ6k/CHoFi/tGoNmHzg9IUZ89V4g3H8hn/VW9dETnPOFna1VO0sWrXg== dependencies: "@isaacs/ttlcache" "^1.4.1" - "@react-native/debugger-frontend" "0.74.85" + "@react-native/debugger-frontend" "0.74.86" "@rnx-kit/chromium-edge-launcher" "^1.0.0" chrome-launcher "^0.15.2" connect "^3.6.5" @@ -2180,12 +2180,12 @@ integrity sha512-DMpn5l1TVkIBFe9kE54pwOI2fQYbQNZ6cto0IuCUxQVUFJBcFMJ6Gbk8jhz8tvcWuDW3xVK9AWq9DJTkuchWsQ== "@react-native/metro-babel-transformer@^0.74.0": - version "0.74.85" - resolved "https://registry.yarnpkg.com/@react-native/metro-babel-transformer/-/metro-babel-transformer-0.74.85.tgz#d530d9a6bd319ece226a2d6aaa00b464a1928089" - integrity sha512-JIrXqEwhTvWPtGArgMptIPGstMdXQIkwSjKVYt+7VC4a9Pw1GurIWanIJheEW6ZuCVvTc0VZkwglFz9JVjzDjA== + version "0.74.86" + resolved "https://registry.yarnpkg.com/@react-native/metro-babel-transformer/-/metro-babel-transformer-0.74.86.tgz#d67d3bf1699fcf834a70155635b30ae9f667b6dd" + integrity sha512-/9qN5zcnTHGDkC4jWibnoGmRnzDXiurl5wmkvspgnsdrJINN6eGpK8sdIn6nrHFOuPlp3Metqw3HkxbuAfNUXw== dependencies: "@babel/core" "^7.20.0" - "@react-native/babel-preset" "0.74.85" + "@react-native/babel-preset" "0.74.86" hermes-parser "0.19.1" nullthrows "^1.1.1" @@ -2419,9 +2419,9 @@ integrity sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ== "@types/node@^18.0.0": - version "18.19.42" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.42.tgz#b54ed4752c85427906aab40917b0f7f3d724bf72" - integrity sha512-d2ZFc/3lnK2YCYhos8iaNIYu9Vfhr92nHiyJHRltXWjXUBjEE+A4I58Tdbnw4VhggSW+2j5y5gTrLs4biNnubg== + version "18.19.43" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.43.tgz#fe01bb599b60bb3279c26d0fdb751d2f3e299ae0" + integrity sha512-Mw/YlgXnyJdEwLoFv2dpuJaDFriX+Pc+0qOBJ57jC1H6cDxIj2xc5yUrdtArDVG0m+KV6622a4p2tenEqB3C/g== dependencies: undici-types "~5.26.4"