diff --git a/.ado/Brewfile b/.ado/Brewfile deleted file mode 100644 index bfe131072dcace..00000000000000 --- a/.ado/Brewfile +++ /dev/null @@ -1,2 +0,0 @@ -brew "xcbeautify" -brew "ccache" diff --git a/.ado/ReactApple.nuspec b/.ado/ReactApple.nuspec deleted file mode 100644 index 2cb5901b6f6099..00000000000000 --- a/.ado/ReactApple.nuspec +++ /dev/null @@ -1,356 +0,0 @@ - - - - OfficeReact.Apple - $buildNumber$ - Contains Mac and iOS Implementations of React Native - Microsoft - https://github.com/microsoft/react-native - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.ado/apple-pr.yml b/.ado/apple-pr.yml deleted file mode 100644 index c8671f8441ea63..00000000000000 --- a/.ado/apple-pr.yml +++ /dev/null @@ -1,36 +0,0 @@ -# This file defines the Apple PR build steps used during the CI loop -name: $(Date:yyyyMMdd).$(Rev:.r) - -variables: - - template: /.ado/variables/vars.yml@self - -trigger: none # will disable CI builds entirely - -pr: - branches: - include: - - main - - '*-stable' - paths: - exclude: - - '*.md' - -stages: - - stage: Build_And_Test - displayName: 'Build and Test' - dependsOn: [] - jobs: - - template: /.ado/jobs/build-test-rntester.yml@self - - - stage: JSOnly - dependsOn: [] - jobs: - - template: /.ado/jobs/test-javascript.yml@self - - # https://github.com/microsoft/react-native-macos/issues/2344 - # The Verdaccio server consistently hangs on creation, which is required for the integration tests - # - stage: Integration - # dependsOn: [] - # jobs: - # - template: /.ado/jobs/test-react-native-macos-init.yml@self - # - template: /.ado/jobs/react-native-test-app-integration.yml@self diff --git a/.ado/get-next-semver-version.js b/.ado/get-next-semver-version.js deleted file mode 100644 index f45b99b04a1ca1..00000000000000 --- a/.ado/get-next-semver-version.js +++ /dev/null @@ -1,33 +0,0 @@ -// @ts-check -const fs = require("fs"); -const path = require("path"); -const semver = require('semver'); -const {gatherVersionInfo} = require('./versionUtils'); - -function getNextVersion(patchVersionPrefix) { - - let {pkgJson, releaseVersion, branchVersionSuffix} = gatherVersionInfo(); - - const prerelease = semver.prerelease(releaseVersion); - - if (!prerelease || prerelease[0] === 'ready') { - if (patchVersionPrefix) { - releaseVersion = semver.inc(releaseVersion, 'prerelease', patchVersionPrefix); - } - else { - releaseVersion = semver.inc(releaseVersion, 'patch'); - } - } else { - releaseVersion = semver.inc(releaseVersion, 'prerelease'); - if (patchVersionPrefix) { - releaseVersion = releaseVersion.replace(`-${prerelease[0]}.`, `-${prerelease[0]}-${patchVersionPrefix}.`); - } - } - - pkgJson.version = releaseVersion; - - return {releaseVersion, branchVersionSuffix}; -} - -const nextVersion = getNextVersion().releaseVersion; -console.log(nextVersion); \ No newline at end of file diff --git a/.ado/gitTagRelease.js b/.ado/gitTagRelease.js deleted file mode 100644 index c314a7e5c1fb29..00000000000000 --- a/.ado/gitTagRelease.js +++ /dev/null @@ -1,44 +0,0 @@ -// @ts-check -// Used to apply the package updates: the git tag for the published release. - -const execSync = require("child_process").execSync; -const {publishBranchName, gatherVersionInfo} = require('./versionUtils'); - -function exec(command) { - try { - console.log(`Running command: ${command}`); - return execSync(command, { - stdio: "inherit" - }); - } catch (err) { - process.exitCode = 1; - console.log(`Failure running: ${command}`); - throw err; - } -} - -function doPublish() { - console.log(`Target branch to publish to: ${publishBranchName}`); - - const {releaseVersion} = gatherVersionInfo() - - const tempPublishBranch = `publish-temp-${Date.now()}`; - exec(`git checkout -b ${tempPublishBranch}`); - - exec(`git add .`); - exec(`git commit -m "Applying package update to ${releaseVersion} ***NO_CI***"`); - exec(`git tag v${releaseVersion}`); - exec(`git push origin HEAD:${tempPublishBranch} --follow-tags --verbose`); - exec(`git push origin tag v${releaseVersion}`); - - exec(`git checkout ${publishBranchName}`); - exec(`git pull origin ${publishBranchName}`); - exec(`git merge ${tempPublishBranch} --no-edit`); - exec( - `git push origin HEAD:${publishBranchName} --follow-tags --verbose` - ); - exec(`git branch -d ${tempPublishBranch}`); - exec(`git push origin --delete -d ${tempPublishBranch}`); -} - -doPublish(); \ No newline at end of file diff --git a/.ado/jobs/build-test-rntester.yml b/.ado/jobs/build-test-rntester.yml deleted file mode 100644 index f72e2869ae22cb..00000000000000 --- a/.ado/jobs/build-test-rntester.yml +++ /dev/null @@ -1,132 +0,0 @@ -parameters: - - name: appleBuildMatrix - type: object - default: - - name: macos_debug_oldarch_jsc - friendly_name: 'macOS, Old Arch, JSC' - sdk: macosx - configuration: Debug - scheme: RNTester-macOS - packager_platform: 'macos' - new_arch_enabled: '0' - use_hermes: '0' - - name: macos_debug_newarch_jsc - friendly_name: 'macOS, New Arch, JSC' - sdk: macosx - configuration: Debug - scheme: RNTester-macOS - packager_platform: 'macos' - new_arch_enabled: '1' - use_hermes: '0' - - name: ios_debug_oldarch_jsc - friendly_name: 'iOS, Old Arch, JSC' - sdk: iphonesimulator - configuration: Debug - scheme: RNTester - packager_platform: 'ios' - new_arch_enabled: '0' - use_hermes: '0' - - name: ios_debug_newarch_jsc - friendly_name: 'iOS, New Arch, JSC' - sdk: iphonesimulator - configuration: Debug - scheme: RNTester - packager_platform: 'ios' - new_arch_enabled: '1' - use_hermes: '0' - - name: xros_debug_oldarch_jsc - friendly_name: 'xrOS, Old Arch, JSC' - sdk: xrsimulator - configuration: Debug - scheme: RNTester-visionOS - packager_platform: 'ios' - new_arch_enabled: '0' - use_hermes: '0' - - name: xros_debug_newarch_jsc - friendly_name: 'xrOS, New Arch, JSC' - sdk: xrsimulator - configuration: Debug - scheme: RNTester-visionOS - packager_platform: 'ios' - new_arch_enabled: '1' - use_hermes: '0' - - name: macos_debug_oldarch_hermes - friendly_name: 'macOS, Old Arch, Hermes' - sdk: macosx - configuration: Debug - scheme: RNTester-macOS - packager_platform: 'macos' - new_arch_enabled: '0' - use_hermes: '1' - - name: macos_debug_newarch_hermes - friendly_name: 'macOS, New Arch, Hermes' - sdk: macosx - configuration: Debug - scheme: RNTester-macOS - packager_platform: 'macos' - new_arch_enabled: '1' - use_hermes: '1' - - name: ios_debug_oldarch_hermes - friendly_name: 'iOS, Old Arch, Hermes' - sdk: iphonesimulator - configuration: Debug - scheme: RNTester - packager_platform: 'ios' - new_arch_enabled: '0' - use_hermes: '1' - - name: ios_debug_newarch_hermes - friendly_name: 'iOS, New Arch, Hermes' - sdk: iphonesimulator - configuration: Debug - scheme: RNTester - packager_platform: 'ios' - new_arch_enabled: '1' - use_hermes: '1' - - name: xros_debug_oldarch_hermes - friendly_name: 'xrOS, Old Arch, Hermes' - sdk: xrsimulator - configuration: Debug - scheme: RNTester-visionOS - packager_platform: 'ios' - new_arch_enabled: '0' - use_hermes: '1' - - name: xros_debug_newarch_hermes - friendly_name: 'xrOS, New Arch, Hermes' - sdk: xrsimulator - configuration: Debug - scheme: RNTester-visionOS - packager_platform: 'ios' - new_arch_enabled: '1' - use_hermes: '1' - -jobs: - - ${{ each slice in parameters.appleBuildMatrix }}: - - job: ${{ slice.name }} - displayName: ${{ slice.friendly_name }} - pool: - vmImage: $(vmImageApple) - timeoutInMinutes: 90 - cancelTimeoutInMinutes: 5 - steps: - - template: /.ado/templates/apple-tools-setup.yml@self - - - script: | - yarn install - displayName: yarn install - - - template: /.ado/templates/build-rntester-steps.yml@self - parameters: - sdk: ${{ slice.sdk }} - configuration: ${{ slice.configuration }} - scheme: ${{ slice.scheme }} - new_arch_enabled: ${{ slice.new_arch_enabled }} - use_hermes: ${{ slice.use_hermes }} - - # https://github.com/microsoft/react-native-macos/issues/2297 - # Skip native tests as they tend to be flaky - # - template: /.ado/templates/test-rntester-steps.yml@self - # parameters: - # sdk: ${{ slice.sdk }} - # configuration: ${{ slice.configuration }} - # scheme: ${{ slice.scheme }} - # packager_platform: ${{ slice.packager_platform }} \ No newline at end of file diff --git a/.ado/jobs/react-native-test-app-integration.yml b/.ado/jobs/react-native-test-app-integration.yml deleted file mode 100644 index fdb8f0226804ff..00000000000000 --- a/.ado/jobs/react-native-test-app-integration.yml +++ /dev/null @@ -1,59 +0,0 @@ -jobs: - - job: react_native_test_app - displayName: react-native-test-app - pool: - vmImage: $(VmImageApple) - workspace: - clean: all - timeoutInMinutes: 60 - cancelTimeoutInMinutes: 5 - steps: - - template: /.ado/templates/apple-tools-setup.yml@self - - - template: /.ado/templates/verdaccio-publish.yml@self - - - script: | - git clone --filter=blob:none --progress https://github.com/microsoft/react-native-test-app.git - displayName: Clone react-native-test-app - - - script: | - node .ado/scripts/export-versions.mjs - displayName: Determine react-native version - - - script: | - npm run set-react-version $(react_native_version) -- --overrides '{ "react-native-macos": "1000.0.0" }' - displayName: Configure react-native-test-app dependencies - workingDirectory: react-native-test-app - - - script: | - set -eo pipefail - $(Build.Repository.LocalPath)/.ado/scripts/verdaccio.sh configure - yarn --no-immutable - displayName: Install npm dependencies - workingDirectory: react-native-test-app - - - script: | - yarn build:macos || yarn build:macos - displayName: Bundle JavaScript - workingDirectory: react-native-test-app/example - - - script: | - rm macos/Podfile.lock - pod install --project-directory=macos - displayName: Install Pods - workingDirectory: react-native-test-app/example - - - script: | - ../scripts/build/xcodebuild.sh macos/Example.xcworkspace build - displayName: Build x86 - workingDirectory: react-native-test-app/example - env: - CCACHE_DISABLE: 1 - - - script: | - ../scripts/build/xcodebuild.sh macos/Example.xcworkspace clean - ../scripts/build/xcodebuild.sh macos/Example.xcworkspace build ARCHS=arm64 - displayName: Build ARM - workingDirectory: react-native-test-app/example - env: - CCACHE_DISABLE: 1 diff --git a/.ado/jobs/test-javascript.yml b/.ado/jobs/test-javascript.yml deleted file mode 100644 index cf13945d7be4f0..00000000000000 --- a/.ado/jobs/test-javascript.yml +++ /dev/null @@ -1,22 +0,0 @@ -jobs: - - job: JavaScriptPR - displayName: Javascript PR - pool: - vmImage: $(VmImageApple) - steps: - - template: /.ado/templates/apple-tools-setup.yml@self - - - script: yarn install - displayName: Install npm dependencies - - - script: yarn test-ci - displayName: Test - - - script: yarn flow-check - displayName: Flow type check - - - script: yarn lint - displayName: Lint - - - script: yarn format-check - displayName: Format diff --git a/.ado/jobs/test-react-native-macos-init.yml b/.ado/jobs/test-react-native-macos-init.yml deleted file mode 100644 index 5a7031689b84b1..00000000000000 --- a/.ado/jobs/test-react-native-macos-init.yml +++ /dev/null @@ -1,55 +0,0 @@ -jobs: - - job: CliInit - displayName: Verify react-native-macos in a new project - pool: - vmImage: $(VmImageApple) - steps: - - checkout: self # self represents the repo where the initial Pipelines YAML file was found - clean: true # whether to fetch clean each time - # fetchDepth: 2 # the depth of commits to ask Git to fetch - lfs: false # whether to download Git-LFS files - submodules: false # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules - persistCredentials: false # set to 'true' to leave the OAuth token in the Git config after the initial fetch - - - template: /.ado/templates/apple-tools-setup.yml@self - - - template: /.ado/templates/verdaccio-publish.yml@self - - - script: | - node .ado/scripts/export-versions.mjs - displayName: Determine react-native version - - - script: | - set -eox pipefail - npx --yes @react-native-community/cli init testcli --version $(react_native_version) --skip-install - workingDirectory: $(Agent.BuildDirectory) - displayName: Initialize a new project - - - script: | - set -eox pipefail - yarn install --mode=update-lockfile - # `update-lockfile` skips the linking step, so we need to run `yarn install` again - yarn install - workingDirectory: $(Agent.BuildDirectory)/testcli - displayName: Install npm dependencies (new project) - - - script: | - set -eox pipefail - # We need to set the npm registry here otherwise it won't stick - $(Build.Repository.LocalPath)/.ado/scripts/verdaccio.sh configure - node $(Build.Repository.LocalPath)/packages/react-native-macos-init/bin.js --verbose --version latest --overwrite --prerelease - pod install --project-directory=macos - workingDirectory: $(Agent.BuildDirectory)/testcli - displayName: Apply macOS template (new project) - - - script: | - set -eox pipefail - npx react-native build-macos - workingDirectory: $(Agent.BuildDirectory)/testcli - displayName: Build macOS app (new project) - - - script: | - set -eox pipefail - npx react-native run-macos - workingDirectory: $(Agent.BuildDirectory)/testcli - displayName: Run macOS app (new project) diff --git a/.ado/scripts/ado-test-cleanup.sh b/.ado/scripts/ado-test-cleanup.sh deleted file mode 100755 index d3c01cd6d86ba7..00000000000000 --- a/.ado/scripts/ado-test-cleanup.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -set -ex - -# Script used by the Azure DevOps build agent to cleanup the packager and web socket server -# after the Xcode test step has completed - -# kill whatever is occupying port 8081 (packager) -lsof -i tcp:8081 | awk 'NR!=1 {print $2}' | xargs kill -# kill whatever is occupying port 5555 (web socket server) -lsof -i tcp:5555 | awk 'NR!=1 {print $2}' | xargs kill - -# AppleScript can't be invoked from Azure DevOps Mojave agents until the following ticket is resolved: https://dev.azure.com/mseng/AzureDevOps/_workitems/edit/1513729 -# osascript <<'EOF' -# tell application "Terminal" -# set winlist to windows where name contains "React Packager" or name contains "Metro Bundler" or name contains "Web Socket Test Server" -# repeat with win in winlist -# tell application "Terminal" to close win -# end repeat -# end tell -# EOF - -# clear packager cache -rm -fr "$TMPDIR/react-*" - -# dump the log files created by launchPackager.command and launchWebSocketServer.command -THIS_DIR=$(dirname "$0") -PACKAGER_LOG="${THIS_DIR}/launchPackager.log" -WEBSOCKET_LOG="${THIS_DIR}/../IntegrationTests/launchWebSocketServer.log" -if [ -f "$PACKAGER_LOG" ]; then - cat "$PACKAGER_LOG" -fi -if [ -f "$WEBSOCKET_LOG" ]; then - cat "$WEBSOCKET_LOG" -fi diff --git a/.ado/scripts/ado-test-setup.sh b/.ado/scripts/ado-test-setup.sh deleted file mode 100755 index dd8a9b13fdaa16..00000000000000 --- a/.ado/scripts/ado-test-setup.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -set -ex - -# Script used by the Azure DevOps build agent to start the packager and web socket server - -# Wait for the package to start -waitForPackager() { - local -i max_attempts=60 - local -i attempt_num=1 - - until curl -s http://localhost:8081/status | grep "packager-status:running" -q; do - if (( attempt_num == max_attempts )); then - echo "Packager did not respond in time. No more attempts left." - exit 1 - else - (( attempt_num++ )) - echo "Packager did not respond. Retrying for attempt number $attempt_num..." - sleep 1 - fi - done - - echo "Packager is ready!" -} - -waitForWebSocketServer() { - local -i max_attempts=60 - local -i attempt_num=1 - - until curl -s http://localhost:5555 | grep "Upgrade Required" -q; do - if (( attempt_num == max_attempts )); then - echo "WebSocket Server did not respond in time. No more attempts left." - exit 1 - else - (( attempt_num++ )) - echo "WebSocket Server did not respond. Retrying for attempt number $attempt_num..." - sleep 1 - fi - done - - echo "WebSocket Server is ready!" -} - -THIS_DIR=$PWD - -# AppleScript can't be invoked from Azure DevOps Mojave agents until the following ticket is resolved: https://dev.azure.com/mseng/AzureDevOps/_workitems/edit/1513729 - -# Start the packager -# osascript -e "tell application \"Terminal\" to do script \"cd ${THIS_DIR}; export SERVERS_NO_WAIT=1; ./scripts/launchPackager.command" - -# Start the WebSocket test server -# osascript -e "tell application \"Terminal\" to do script \"cd ${THIS_DIR}; export SERVERS_NO_WAIT=1; ./IntegrationTests/launchWebSocketServer.command\"" - -COMMAND="$TMPDIR/launchPackager.command" -echo "cd ${THIS_DIR}; export SERVERS_NO_WAIT=1; PROJECT_ROOT=packages/rn-tester ./packages/react-native/scripts/launchPackager.command" > "$COMMAND" -chmod +x "$COMMAND" -open "$COMMAND" -waitForPackager - -COMMAND="$TMPDIR/launchWebSocketServer.command" -echo "cd ${THIS_DIR}; export SERVERS_NO_WAIT=1; ./packages/rn-tester/IntegrationTests/launchWebSocketServer.command" > "$COMMAND" -chmod +x "$COMMAND" -open "$COMMAND" -waitForWebSocketServer diff --git a/.ado/scripts/xcodebuild.sh b/.ado/scripts/xcodebuild.sh index 178ec14cd3c2cd..29da04b74c511f 100755 --- a/.ado/scripts/xcodebuild.sh +++ b/.ado/scripts/xcodebuild.sh @@ -23,7 +23,7 @@ build_cmd=$( ) -if [[ "$CCACHE_DISABLE" != "1" ]]; then +if [[ "$USE_CCACHE" == "1" ]]; then if ! command -v ccache 1> /dev/null; then brew install ccache fi @@ -45,6 +45,6 @@ fi eval "$build_cmd" | xcbeautify --report junit -if [[ "$CCACHE_DISABLE" != "1" ]]; then +if [[ "$USE_CCACHE" == "1" ]]; then ccache --show-stats --verbose fi diff --git a/.ado/templates/apple-tools-setup.yml b/.ado/templates/apple-tools-setup.yml deleted file mode 100644 index 5ceec73192883f..00000000000000 --- a/.ado/templates/apple-tools-setup.yml +++ /dev/null @@ -1,17 +0,0 @@ -steps: - - task: UseNode@1 - inputs: - version: '23.x' - - - script: | - brew bundle --file .ado/Brewfile - displayName: 'Install Homebrew dependencies' - - - script: | - sudo xcode-select --switch $(xcode_version) - displayName: Use $(xcode_friendly_name) - - - script: | - xcodebuild -downloadAllPlatforms - sudo xcodebuild -runFirstLaunch - displayName: 'Download Xcode Platforms' diff --git a/.ado/templates/build-rntester-steps.yml b/.ado/templates/build-rntester-steps.yml deleted file mode 100644 index 9165999c854af0..00000000000000 --- a/.ado/templates/build-rntester-steps.yml +++ /dev/null @@ -1,35 +0,0 @@ -parameters: - - name: sdk - type: string - - name: configuration - type: string - - name: scheme - type: string - - name: new_arch_enabled - type: string - - name: use_hermes - type: string - -steps: - - template: /.ado/templates/apple-tools-setup.yml@self - - - script: | - yarn install - displayName: Install npm dependencies - - - script: | - set -eox pipefail - bundle install - bundle exec pod install --verbose - env: - RCT_NEW_ARCH_ENABLED: ${{ parameters.new_arch_enabled }} - USE_HERMES: ${{ parameters.use_hermes }} - workingDirectory: packages/rn-tester - displayName: Install Pods - - - script: | - set -eox pipefail - .ado/scripts/xcodebuild.sh packages/rn-tester/RNTesterPods.xcworkspace ${{ parameters.sdk }} ${{ parameters.configuration }} ${{ parameters.scheme }} build - env: - CCACHE_DISABLE: 1 - displayName: Build ${{ parameters.scheme }} diff --git a/.ado/templates/test-rntester-steps.yml b/.ado/templates/test-rntester-steps.yml deleted file mode 100644 index fd38169396938c..00000000000000 --- a/.ado/templates/test-rntester-steps.yml +++ /dev/null @@ -1,47 +0,0 @@ -parameters: - - name: sdk - type: string - - name: configuration - type: string - - name: scheme - type: string - - name: packager_platform - type: string - - - - # https://github.com/microsoft/react-native-macos/issues/2297 - # Skip native tests as they tend to be flaky -steps: - - ${{ if ne(parameters.scheme, 'RNTester-visionOS') }}: - - task: ShellScript@2 - displayName: Setup packager and WebSocket test server - inputs: - scriptPath: .ado/scripts/ado-test-setup.sh - disableAutoCwd: true - cwd: '' - - - script: | - echo Preparing the packager for platform $PLATFORM - curl --retry-connrefused --connect-timeout 5 --max-time 10 --retry 10 --retry-delay 5 --retry-max-time 120 "http://localhost:8081/packages/rn-tester/js/RNTesterApp.${PLATFORM}.bundle?platform=${PLATFORM}&dev=true" -o /dev/null - curl --retry-connrefused --connect-timeout 5 --max-time 10 --retry 10 --retry-delay 5 --retry-max-time 120 "http://localhost:8081/packages/rn-tester/js/RNTesterApp.${PLATFORM}.bundle?platform=${PLATFORM}&dev=true&minify=false" -o /dev/null - curl --retry-connrefused --connect-timeout 5 --max-time 10 --retry 10 --retry-delay 5 --retry-max-time 120 "http://localhost:8081/IntegrationTests/IntegrationTestsApp.bundle?platform=${PLATFORM}&dev=true" -o /dev/null - curl --retry-connrefused --connect-timeout 5 --max-time 10 --retry 10 --retry-delay 5 --retry-max-time 120 "http://localhost:8081/IntegrationTests/RCTRootViewIntegrationTestApp.bundle?platform=${PLATFORM}&dev=true" -o /dev/null - env: - PLATFORM: ${{ parameters.packager_platform }} - displayName: Fetch JS bundles from dev server - - - script: | - set -eox pipefail - .ado/scripts/xcodebuild.sh packages/rn-tester/RNTesterPods.xcworkspace ${{ parameters.sdk }} ${{ parameters.configuration }} ${{ parameters.scheme }} test - env: - CCACHE_DISABLE: 1 - displayName: Test ${{ parameters.scheme }} - - - task: ShellScript@2 - displayName: Cleanup packager and WebSocket test server - inputs: - scriptPath: .ado/scripts/ado-test-cleanup.sh - disableAutoCwd: true - cwd: '' - condition: always() diff --git a/.ado/templates/verdaccio-publish.yml b/.ado/templates/verdaccio-publish.yml deleted file mode 100644 index 4ec7d058ccf958..00000000000000 --- a/.ado/templates/verdaccio-publish.yml +++ /dev/null @@ -1,25 +0,0 @@ -steps: - - script: | - yarn install - displayName: Install npm dependencies - - - script: | - yarn build - displayName: Build @react-native/community-cli-plugin - - - script: | - yarn build - workingDirectory: packages/react-native-macos-init - displayName: Build react-native-macos-init - - - script: | - npx verdaccio --config .ado/verdaccio/config.yaml & - displayName: Start Verdaccio server - - - script: | - .ado/scripts/verdaccio.sh init - displayName: Configure npm for Verdaccio server - - - script: | - .ado/scripts/verdaccio.sh publish --branch origin/$(System.PullRequest.TargetBranch) - displayName: Publish react-native-macos to Verdaccio diff --git a/.ado/variables/vars.yml b/.ado/variables/vars.yml deleted file mode 100644 index 2b2001707a9f64..00000000000000 --- a/.ado/variables/vars.yml +++ /dev/null @@ -1,6 +0,0 @@ -variables: - VmImageApple: macos-latest-internal - xcode_friendly_name: 'Xcode 16.2' - xcode_version: '/Applications/Xcode_16.2.app' - ios_version: '18.0' - ios_simulator: 'iPhone 16' diff --git a/.ado/versionUtils.js b/.ado/versionUtils.js deleted file mode 100644 index 1511df7b3e9608..00000000000000 --- a/.ado/versionUtils.js +++ /dev/null @@ -1,26 +0,0 @@ -// @ts-check -const fs = require("fs"); -const path = require("path"); -const semver = require('semver'); -const {execSync} = require('child_process'); - -const pkgJsonPath = path.resolve(__dirname, "../packages/react-native/package.json"); -let publishBranchName = ''; -try { - publishBranchName = process.env.BUILD_SOURCEBRANCH.match(/refs\/heads\/(.*)/)[1]; -} catch (error) {} - -function gatherVersionInfo() { - let pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8")); - - let releaseVersion = pkgJson.version; - const branchVersionSuffix = (publishBranchName.match(/(fb.*merge)|(fabric)/) ? `-${publishBranchName}` : ''); - - return {pkgJson, releaseVersion, branchVersionSuffix}; -} - -module.exports = { - gatherVersionInfo, - publishBranchName, - pkgJsonPath, -} \ No newline at end of file diff --git a/.ado/xcconfig/debug_overrides.xcconfig b/.ado/xcconfig/debug_overrides.xcconfig deleted file mode 100644 index 4d2cc29c3d83bf..00000000000000 --- a/.ado/xcconfig/debug_overrides.xcconfig +++ /dev/null @@ -1,3 +0,0 @@ -// Turn on Sanitizers for Release Builds -CLANG_ADDRESS_SANITIZER = YES -CLANG_UNDEFINED_BEHAVIOR_SANITIZER = YES diff --git a/.ado/xcconfig/release_overrides.xcconfig b/.ado/xcconfig/release_overrides.xcconfig deleted file mode 100644 index 48d2466f2a49d5..00000000000000 --- a/.ado/xcconfig/release_overrides.xcconfig +++ /dev/null @@ -1,21 +0,0 @@ -#include "release_staticanalysis.xcconfig" -// For publish builds, only provide line tables for symbolizing crashes -CLANG_DEBUG_INFORMATION_LEVEL[config=Release]=line-tables-only -// The following build setting caused build errors, so it is commented out and placed in every podspec instead -// OTHER_SWIFT_FLAGS=-gline-tables-only - -// Optimize for size in publish builds -SWIFT_OPTIMIZATION_LEVEL[config=Release]=-Osize - -// Build for all architectures, not just the active one -ONLY_ACTIVE_ARCH=NO - -// react-native/react_native_pods.rb sometimes makes our lives difficult -EXCLUDED_ARCHS = - -// Specify the exact Swift version used for reproducibility -SWIFT_VERSION = 5.0 - -// Turn off Sanitizers for Release Builds -CLANG_ADDRESS_SANITIZER = NO -CLANG_UNDEFINED_BEHAVIOR_SANITIZER = NO diff --git a/.ado/xcconfig/release_staticanalysis.xcconfig b/.ado/xcconfig/release_staticanalysis.xcconfig deleted file mode 100644 index c87887e0251ce9..00000000000000 --- a/.ado/xcconfig/release_staticanalysis.xcconfig +++ /dev/null @@ -1,13 +0,0 @@ -RUN_CLANG_STATIC_ANALYZER = YES -CLANG_STATIC_ANALYZER_MODE = deep - -// Required security settings for production code (do not override at target/project level, with the possible -// exception of legacy test code) -CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES -CLANG_ANALYZER_SECURITY_KEYCHAIN_API = YES -CLANG_ANALYZER_SECURITY_INSECUREAPI_UNCHECKEDRETURN = YES -CLANG_ANALYZER_SECURITY_INSECUREAPI_GETPW_GETS = YES -CLANG_ANALYZER_SECURITY_INSECUREAPI_MKSTEMP = YES -CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES -CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES -CLANG_ANALYZER_SECURITY_INSECUREAPI_VFORK = YES diff --git a/.github/actions/microsoft-setup-toolchain/action.yml b/.github/actions/microsoft-setup-toolchain/action.yml new file mode 100644 index 00000000000000..e8e05e1c776533 --- /dev/null +++ b/.github/actions/microsoft-setup-toolchain/action.yml @@ -0,0 +1,82 @@ +name: Setup toolchain +description: Sets up the toolchain for the project +inputs: + platform: + description: The target platform to set up toolchain for + project-root: + description: Root of the project + cache-key-prefix: + description: Prefix to add to the cache key + cache-npm-dependencies: + description: Caches npm dependencies (supports npm, yarn, pnpm v6.10+) + default: yarn + java-version: + description: Desired Java version + default: "17" + node-version: + description: Desired Node version + default: "22" + xcode-developer-dir: + description: Set the path for the active Xcode developer directory + default: "/Applications/Xcode_16.4.0.app" +runs: + using: composite + steps: + - name: Set up Ccache + id: setup-ccache + if: ${{ inputs.platform == 'ios' || inputs.platform == 'macos' || inputs.platform == 'visionos' }} + run: | + podfile_lock="${{ inputs.project-root }}/${{ inputs.platform }}/Podfile.lock" + if [[ -f $(git rev-parse --show-toplevel)/.ccache/ccache.conf ]] && [[ -f "$podfile_lock" ]]; then + if ! command -v ccache 1> /dev/null; then + brew install ccache + fi + + CCACHE_HOME=$(dirname $(dirname $(which ccache)))/opt/ccache + + echo "CCACHE_DIR=$(git rev-parse --show-toplevel)/.ccache" >> $GITHUB_ENV + + echo "CC=${CCACHE_HOME}/libexec/clang" >> $GITHUB_ENV + echo "CXX=${CCACHE_HOME}/libexec/clang++" >> $GITHUB_ENV + echo "CMAKE_C_COMPILER_LAUNCHER=$(which ccache)" >> $GITHUB_ENV + echo "CMAKE_CXX_COMPILER_LAUNCHER=$(which ccache)" >> $GITHUB_ENV + + ccache --zero-stats 1> /dev/null + + clang --version > .clang-version + input=$(find . -maxdepth 1 -name .clang-version -o -name .yarnrc.yml | sort) + echo "cache-key=$(cat "$podfile_lock" $input | shasum -a 256 | awk '{ print $1 }')" >> $GITHUB_OUTPUT + fi + shell: bash + - name: Set up JDK + if: ${{ inputs.platform == 'android' || inputs.platform == 'node' }} + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: ${{ inputs.java-version }} + - name: Set up Node.js + uses: actions/setup-node@v4.4.0 + with: + node-version: ${{ inputs.node-version }} + cache: ${{ inputs.cache-npm-dependencies }} + registry-url: https://registry.npmjs.org + - name: Set up Xcode + if: ${{ inputs.platform == 'ios' || inputs.platform == 'macos' || inputs.platform == 'visionos' }} + run: | + sudo xcode-select --switch ${{ inputs.xcode-developer-dir }} + shell: bash + - name: Download visionOS SDK + if: ${{ inputs.platform == 'visionos' }} + run: | + # https://github.com/actions/runner-images/issues/10559 + sudo xcodebuild -runFirstLaunch + sudo xcrun simctl list + sudo xcodebuild -downloadPlatform visionOS + sudo xcodebuild -runFirstLaunch + shell: bash + - name: Cache /.ccache + if: ${{ steps.setup-ccache.outputs.cache-key }} + uses: actions/cache@v4 + with: + path: .ccache + key: ${{ runner.os }}-${{ inputs.cache-key-prefix }}-ccache-${{ steps.setup-ccache.outputs.cache-key }} \ No newline at end of file diff --git a/.github/workflows/microsoft-build-rntester.yml b/.github/workflows/microsoft-build-rntester.yml new file mode 100644 index 00000000000000..746fd235ca0267 --- /dev/null +++ b/.github/workflows/microsoft-build-rntester.yml @@ -0,0 +1,72 @@ +name: Build RNTester + +on: + workflow_call: + +jobs: + build-rntester: + name: "${{ matrix.platform }}, ${{ matrix.arch }}, ${{ matrix.engine }}" + runs-on: macos-15 + timeout-minutes: 90 + strategy: + fail-fast: false + matrix: + platform: [macos, ios, visionos] + arch: [oldarch, newarch] + engine: [jsc, hermes] + include: + # Platform-specific properties + - platform: macos + sdk: macosx + scheme: RNTester-macOS + packager_platform: macos + - platform: ios + sdk: iphonesimulator + scheme: RNTester + packager_platform: ios + - platform: visionos + sdk: xrsimulator + scheme: RNTester-visionOS + packager_platform: ios + # Architecture-specific properties + - arch: oldarch + new_arch_enabled: '0' + - arch: newarch + new_arch_enabled: '1' + - engine: jsc + use_hermes: '0' + - engine: hermes + use_hermes: '1' + + steps: + - uses: actions/checkout@v4 + with: + filter: blob:none + fetch-depth: 0 + + - name: Setup toolchain + uses: ./.github/actions/microsoft-setup-toolchain + with: + node-version: '22' + platform: ${{ matrix.platform }} + project-root: 'packages/rn-tester' + + - name: Install npm dependencies + run: yarn install + + - name: Install Pods + working-directory: packages/rn-tester + env: + RCT_NEW_ARCH_ENABLED: ${{ matrix.new_arch_enabled }} + USE_HERMES: ${{ matrix.use_hermes }} + run: | + set -eox pipefail + bundle install + bundle exec pod install --verbose + + - name: Build ${{ matrix.scheme }} + env: + USE_CCACHE: 0 + run: | + set -eox pipefail + .ado/scripts/xcodebuild.sh packages/rn-tester/RNTesterPods.xcworkspace ${{ matrix.sdk }} Debug ${{ matrix.scheme }} build diff --git a/.github/workflows/microsoft-pr.yml b/.github/workflows/microsoft-pr.yml index 4049f66997f0a0..8af4285316f13e 100644 --- a/.github/workflows/microsoft-pr.yml +++ b/.github/workflows/microsoft-pr.yml @@ -20,7 +20,8 @@ jobs: with: filter: blob:none fetch-depth: 0 - - uses: actions/setup-node@v4 + - name: Setup toolchain + uses: ./.github/actions/microsoft-setup-toolchain with: node-version: '22' # We lint the PR title instead of the commit message to avoid script injection attacks. @@ -31,11 +32,13 @@ jobs: PR_TITLE: ${{ github.event.pull_request.title }} run: | echo "$PR_TITLE" | npx @rnx-kit/commitlint-lite@2.0.0 + build-website: name: "Build the website" permissions: {} if: github.base_ref == 'main' uses: ./.github/workflows/microsoft-build-website.yml + npm-publish-dry-run: name: "NPM Publish (Dry Run)" permissions: {} @@ -45,7 +48,8 @@ jobs: with: filter: blob:none fetch-depth: 0 - - uses: actions/setup-node@v4 + - name: Setup toolchain + uses: ./.github/actions/microsoft-setup-toolchain with: node-version: '22' - name: Read publish tag from nx.json @@ -79,10 +83,80 @@ jobs: with: filter: blob:none fetch-depth: 0 - - uses: actions/setup-node@v4 + - name: Setup toolchain + uses: ./.github/actions/microsoft-setup-toolchain with: node-version: '22' - name: Install dependencies run: yarn - name: Check constraints run: yarn constraints + + javascript-tests: + name: "JavaScript Tests" + permissions: {} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + filter: blob:none + fetch-depth: 0 + + - name: Setup toolchain + uses: ./.github/actions/microsoft-setup-toolchain + with: + node-version: '22' + + - name: Install npm dependencies + run: yarn install + + - name: Run Jest tests + run: yarn test-ci + + - name: Run Flow type checker + run: yarn flow-check + + - name: Run ESLint + run: yarn lint + + - name: Run Prettier format check + run: yarn format-check + + build-rntester: + name: "Build RNTester" + permissions: {} + uses: ./.github/workflows/microsoft-build-rntester.yml + + test-react-native-macos-init: + name: "Test react-native-macos init" + permissions: {} + # https://github.com/microsoft/react-native-macos/issues/2344 + # Run only for stable branches. Once nightlies are available, enable on main as well. + if: ${{ endsWith(github.base_ref, '-stable') }} + uses: ./.github/workflows/microsoft-test-react-native-macos-init.yml + + react-native-test-app-integration: + name: "Test react-native-test-app integration" + permissions: {} + # https://github.com/microsoft/react-native-macos/issues/2344 + # Run only for stable branches. Once nightlies are available, enable on main as well. + if: ${{ endsWith(github.base_ref, '-stable') }} + uses: ./.github/workflows/microsoft-react-native-test-app-integration.yml + + all: + name: "All" + permissions: {} + runs-on: ubuntu-latest + needs: + - lint-title + - build-website + - npm-publish-dry-run + - yarn-constraints + - javascript-tests + - build-rntester + - test-react-native-macos-init + - react-native-test-app-integration + if: always() + steps: + - name: All required jobs passed + run: echo "All required jobs completed." diff --git a/.github/workflows/microsoft-react-native-test-app-integration.yml b/.github/workflows/microsoft-react-native-test-app-integration.yml new file mode 100644 index 00000000000000..98c09568cdf48f --- /dev/null +++ b/.github/workflows/microsoft-react-native-test-app-integration.yml @@ -0,0 +1,88 @@ +name: Test react-native-test-app integration + +on: + workflow_call: + +jobs: + react-native-test-app-integration: + name: "Test react-native-test-app integration" + runs-on: macos-15 + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + with: + filter: blob:none + fetch-depth: 0 + clean: true + + - name: Setup toolchain + uses: ./.github/actions/microsoft-setup-toolchain + with: + node-version: '22' + platform: 'macos' + + - name: Install npm dependencies + run: yarn install + + - name: Build community CLI plugin + run: yarn build + + - name: Build react-native-macos-init + working-directory: packages/react-native-macos-init + run: yarn build + + - name: Start Verdaccio server + run: | + set -euo pipefail + nohup npx --yes verdaccio --config .ado/verdaccio/config.yaml >/dev/null 2>&1 & + echo $! > $RUNNER_TEMP/verdaccio.pid + - name: Wait for Verdaccio to be ready + run: node .ado/scripts/waitForVerdaccio.mjs http://localhost:4873 + + - name: Configure npm for Verdaccio + run: .ado/scripts/verdaccio.sh init + + - name: Publish to Verdaccio + run: .ado/scripts/verdaccio.sh publish --branch origin/${{ github.base_ref }} + + - name: Clone react-native-test-app + run: | + git clone --filter=blob:none --progress https://github.com/microsoft/react-native-test-app.git + + - name: Export versions + run: node .ado/scripts/export-versions.mjs + + - name: Configure react-native-test-app dependencies + working-directory: react-native-test-app + run: | + npm run set-react-version $(cat ${{ github.workspace }}/.react_native_version) -- --overrides '{ "react-native-macos": "1000.0.0" }' + + - name: Install dependencies in test app + working-directory: react-native-test-app + run: | + set -eo pipefail + ${{ github.workspace }}/.ado/scripts/verdaccio.sh configure + yarn --no-immutable + + - name: Bundle JavaScript + working-directory: react-native-test-app/example + run: | + yarn build:macos || yarn build:macos + + - name: Install Pods + working-directory: react-native-test-app/example + run: | + rm -f macos/Podfile.lock + pod install --project-directory=macos + + - name: Build test app + working-directory: react-native-test-app/example + run: | + ../scripts/build/xcodebuild.sh macos/Example.xcworkspace build + + - name: Stop Verdaccio + if: always() + run: | + if [ -f "$RUNNER_TEMP/verdaccio.pid" ]; then + kill "$(cat $RUNNER_TEMP/verdaccio.pid)" || true + fi diff --git a/.github/workflows/microsoft-test-react-native-macos-init.yml b/.github/workflows/microsoft-test-react-native-macos-init.yml new file mode 100644 index 00000000000000..98bf62f681931d --- /dev/null +++ b/.github/workflows/microsoft-test-react-native-macos-init.yml @@ -0,0 +1,84 @@ +name: Test react-native-macos init + +on: + workflow_call: + +jobs: + test-react-native-macos-init: + name: "Test react-native-macos init" + runs-on: macos-15 + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + with: + filter: blob:none + fetch-depth: 0 + lfs: false + clean: true + + - name: Setup toolchain + uses: ./.github/actions/microsoft-setup-toolchain + with: + node-version: '22' + platform: 'macos' + + - name: Install npm dependencies + run: yarn install + + - name: Build community CLI plugin + run: yarn build + + - name: Build react-native-macos-init + working-directory: packages/react-native-macos-init + run: yarn build + + - name: Start Verdaccio server + run: | + set -euo pipefail + nohup npx --yes verdaccio --config .ado/verdaccio/config.yaml >/dev/null 2>&1 & + echo $! > $RUNNER_TEMP/verdaccio.pid + - name: Wait for Verdaccio to be ready + run: node .ado/scripts/waitForVerdaccio.mjs http://localhost:4873 + + - name: Configure npm for Verdaccio + run: .ado/scripts/verdaccio.sh init + + - name: Publish to Verdaccio + run: .ado/scripts/verdaccio.sh publish --branch origin/${{ github.base_ref }} + + - name: Export versions + run: node .ado/scripts/export-versions.mjs + + - name: Initialize new project + run: | + set -eox pipefail + npx --yes @react-native-community/cli init testcli --version $(cat .react_native_version) --skip-install + working-directory: ${{ runner.temp }} + + - name: Install dependencies in new project + working-directory: ${{ runner.temp }}/testcli + run: | + set -eox pipefail + yarn install --mode=update-lockfile + yarn install + + - name: Apply macOS template + working-directory: ${{ runner.temp }}/testcli + run: | + set -eox pipefail + ${{ github.workspace }}/.ado/scripts/verdaccio.sh configure + node ${{ github.workspace }}/packages/react-native-macos-init/bin.js --verbose --version latest --overwrite --prerelease + pod install --project-directory=macos + + - name: Build macOS app + working-directory: ${{ runner.temp }}/testcli + run: | + set -eox pipefail + npx react-native build-macos + + - name: Stop Verdaccio + if: always() + run: | + if [ -f "$RUNNER_TEMP/verdaccio.pid" ]; then + kill "$(cat $RUNNER_TEMP/verdaccio.pid)" || true + fi