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/publish.yml b/.ado/publish.yml deleted file mode 100644 index 25644d43f2bee5..00000000000000 --- a/.ado/publish.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: $(Date:yyyyMMdd).$(Rev:.r) - -trigger: - batch: true - branches: - include: - - main - - '*-stable' - paths: - exclude: - - package.json - -pr: none - -variables: - - group: React-native-macos Secrets - - group: InfoSec-SecurityResults - - name: tags - value: production,externalfacing - # CodeQL Still has not fixed their bug running on Apple ARM64 jobs where they inject x64 binaries into arm64 processes and just make it crash :( - # Only workaround for now is to disable CodeQL on Apple jobs. - - name: Codeql.Enabled - value: false - - template: /.ado/variables/vars.yml@self - -resources: - repositories: - - repository: OfficePipelineTemplates - type: git - name: 1ESPipelineTemplates/OfficePipelineTemplates - ref: refs/tags/release - -extends: - template: v1/Office.Official.PipelineTemplate.yml@OfficePipelineTemplates - parameters: - pool: - name: Azure-Pipelines-1ESPT-ExDShared - image: windows-latest - os: windows - sdl: - componentgovernance: - ignoreDirectories: $(Build.SourcesDirectory)/packages/helloworld - credscan: - suppressionsFile: .ado/CredScanSuppressions.json - eslint: - configuration: 'recommended' - parser: '@typescript-eslint/parser' - parserOptions: '' - enableExclusions: true - # Justification: js files in this repo are flow files. the built-in eslint does not support this. Adding a separate step to run the sdl rules for flow files. - exclusionPatterns: '**/*.js' - stages: - - stage: NPM - dependsOn: [] - jobs: - - template: /.ado/jobs/npm-publish.yml@self 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/export-versions.mjs b/.ado/scripts/export-versions.mjs deleted file mode 100644 index 53fb6ae28323de..00000000000000 --- a/.ado/scripts/export-versions.mjs +++ /dev/null @@ -1,27 +0,0 @@ -// @ts-check -import * as fs from "node:fs"; -import { URL } from "node:url"; - -/** - * @param {string} version - * @returns {string} - */ -function coerce(version) { - const [major, minor = 0] = version.split("-")[0].split("."); - return `${major}.${minor}`; -} - -/** - * @param {string} name - * @param {unknown} value - */ -function exportValue(name, value) { - console.log(`##vso[task.setvariable variable=${name}]${value}`); -} - -const manifestPath = new URL("../../packages/react-native/package.json", import.meta.url); -const json = fs.readFileSync(manifestPath, { encoding: "utf-8" }); -const { dependencies, peerDependencies } = JSON.parse(json); - -exportValue("react_version", peerDependencies["react"]); -exportValue("react_native_version", coerce(dependencies["@react-native/codegen"])); diff --git a/.ado/scripts/npmAddUser.mjs b/.ado/scripts/npmAddUser.mjs deleted file mode 100644 index 3a62339ab9400a..00000000000000 --- a/.ado/scripts/npmAddUser.mjs +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env node -// @ts-check - -import * as assert from "node:assert/strict"; -import { exec } from "node:child_process"; - -const { [2]: username, [3]: password, [4]: email, [5]: registry } = process.argv; -assert.ok(username, "Please specify username"); -assert.ok(password, "Please specify password"); -assert.ok(email, "Please specify email"); - -const child = exec(`npm adduser${registry ? ` --registry ${registry}` : ""}`); -assert.ok(child.stdout, "Missing stdout on child process"); - -child.stdout.on("data", d => { - assert.ok(child.stdin, "Missing stdin on child process"); - - process.stdout.write(d); - process.stdout.write("\n"); - - const data = d.toString(); - if (data.match(/username/i)) { - child.stdin.write(username + "\n"); - } else if (data.match(/password/i)) { - child.stdin.write(password + "\n"); - } else if (data.match(/email/i)) { - child.stdin.write(email + "\n"); - } else if (data.match(/logged in as/i)) { - child.stdin.end(); - } -}); diff --git a/.ado/scripts/waitForVerdaccio.mjs b/.ado/scripts/waitForVerdaccio.mjs deleted file mode 100644 index 2ceb782c4e3f4a..00000000000000 --- a/.ado/scripts/waitForVerdaccio.mjs +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env node -// @ts-check - -import * as fs from "node:fs"; -import { get } from "node:http"; - -/** - * @param {string} npmRegistryUrl - */ -function queryForServerStatus(npmRegistryUrl) { - get(npmRegistryUrl, res => { - console.log(`Verdaccio server status: ${res.statusCode}`); - if (res.statusCode != 200) { - setTimeout(queryForServerStatus, 2000); - } - }).on("error", err => { - console.log(err.message); - const logUrl = new URL("../verdaccio/console.log", import.meta.url); - try { - const logFile = fs.readFileSync(logUrl, { encoding: "utf-8" }); - console.log("Verdaccio console output: " + logFile); - } catch (error) { - console.log("No Verdaccio console output yet."); - } - setTimeout(queryForServerStatus, 2000); - }); -} - -console.log("Waiting for Verdaccio instance to respond..."); - -queryForServerStatus(process.argv[2]); 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..cbaaf4b98033b5 --- /dev/null +++ b/.github/actions/microsoft-setup-toolchain/action.yml @@ -0,0 +1,68 @@ +name: Setup the toolchain +description: Sets up the toolchain for the project +inputs: + node-version: + description: The version of Node to use + type: string + default: "20" + node-cache: + description: Cache global packages data + type: string + default: "yarn" + jdk-version: + description: The Java JDK version to use, if specified + type: number + platform: + description: The target platform to set up toolchain for + type: string + xcode-version: + description: The Xcode version to use (full path) + type: string + 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 == 'xros' }} + run: | + podfile_lock="packages/test-app/${{ inputs.platform }}/Podfile.lock" + if [[ -f $(git rev-parse --show-toplevel)/.ccache/ccache.conf ]] && [[ -f "$podfile_lock" ]]; then + 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 Node.js + uses: actions/setup-node@v4.4.0 + with: + node-version: ${{ inputs.node-version }} + cache: ${{ inputs.node-cache }} + - name: Set up JDK + if: ${{ inputs.jdk-version != 0 }} + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: ${{ inputs.jdk-version }} + - name: Install Homebrew dependencies (macOS/iOS) + if: ${{ inputs.platform == 'ios' || inputs.platform == 'macos' || inputs.platform == 'xros' }} + run: | + brew install xcbeautify ccache + shell: bash + - name: Setup Xcode + if: ${{ inputs.platform == 'ios' || inputs.platform == 'macos' || inputs.platform == 'xros' }} + run: | + sudo xcode-select --switch ${{ inputs.xcode-version }} + shell: bash + - name: Download Xcode Platforms + if: ${{ inputs.platform == 'ios' || inputs.platform == 'macos' || inputs.platform == 'xros' }} + run: | + xcodebuild -downloadAllPlatforms + 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 }} diff --git a/.github/workflows/microsoft-pr.yml b/.github/workflows/microsoft-pr.yml index 4049f66997f0a0..62a33a437b730b 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. @@ -45,15 +46,16 @@ 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 id: config run: | PUBLISH_TAG=$(jq -r '.release.version.generatorOptions.currentVersionResolverMetadata.tag' nx.json) - echo "publishTag=$PUBLISH_TAG" >> $GITHUB_OUTPUT - echo "Using publish tag from nx.json: $PUBLISH_TAG" + echo "publishTag=${PUBLISH_TAG}" >> "$GITHUB_OUTPUT" + echo "Using publish tag from nx.json: ${PUBLISH_TAG}" - name: Configure git run: | git config --global user.email "53619745+rnbot@users.noreply.github.com" @@ -79,10 +81,252 @@ 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: '23' + + - 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-test-rntester: + name: "Build RNTester - ${{ matrix.platform }}, ${{ matrix.arch }}, ${{ matrix.engine }}" + permissions: {} + runs-on: macos-15 + timeout-minutes: 90 + strategy: + fail-fast: false + matrix: + platform: [macos, ios, xros] + 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: xros + 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: '23' + platform: ${{ matrix.platform }} + + - 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: + CCACHE_DISABLE: 1 + run: | + set -eox pipefail + .ado/scripts/xcodebuild.sh packages/rn-tester/RNTesterPods.xcworkspace ${{ matrix.sdk }} Debug ${{ matrix.scheme }} build + + test-react-native-macos-init: + name: "Test react-native-macos init" + permissions: {} + 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: '23' + 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: | + npx verdaccio --config .ado/verdaccio/config.yaml & + sleep 5 + + - 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 + + react-native-test-app-integration: + name: "Test react-native-test-app integration" + permissions: {} + 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: '23' + 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: | + npx verdaccio --config .ado/verdaccio/config.yaml & + sleep 5 + + - 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