From 12522824b43a4c1ff51c7627008e1093e5b463d9 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Wed, 30 Jul 2025 11:27:37 -0700 Subject: [PATCH 01/27] ci: Convert PR jobs to Github Actions --- .github/workflows/microsoft-pr.yml | 197 ++++++++++++++++++++++++++++- 1 file changed, 195 insertions(+), 2 deletions(-) diff --git a/.github/workflows/microsoft-pr.yml b/.github/workflows/microsoft-pr.yml index 4049f66997f0..90bb5eb79d86 100644 --- a/.github/workflows/microsoft-pr.yml +++ b/.github/workflows/microsoft-pr.yml @@ -52,8 +52,8 @@ jobs: 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" @@ -86,3 +86,196 @@ jobs: run: yarn - name: Check constraints run: yarn constraints + + javascript-tests: + name: "JavaScript Tests" + permissions: {} + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + with: + filter: blob:none + fetch-depth: 0 + + - uses: actions/setup-node@v4 + with: + node-version: '23' + + - name: Install Homebrew dependencies + run: | + brew install xcbeautify ccache + + - name: Setup Xcode + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '16.2' + + - name: Download Xcode Platforms + run: | + xcodebuild -downloadAllPlatforms + sudo xcodebuild -runFirstLaunch + + - name: Install npm dependencies + run: yarn install + + - name: Run tests + run: yarn test-ci + + - name: Flow type check + run: yarn flow-check + + - name: Lint + run: yarn lint + + - name: Format check + run: yarn format-check + + build-test-rntester: + name: "Build RNTester - ${{ matrix.friendly_name }}" + permissions: {} + runs-on: macos-latest + timeout-minutes: 90 + strategy: + fail-fast: false + matrix: + include: + - 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' + + steps: + - uses: actions/checkout@v4 + with: + filter: blob:none + fetch-depth: 0 + + - uses: actions/setup-node@v4 + with: + node-version: '23' + + - name: Install Homebrew dependencies + run: | + brew install xcbeautify ccache + + - name: Setup Xcode + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '16.2' + + - name: Download Xcode Platforms + run: | + xcodebuild -downloadAllPlatforms + sudo xcodebuild -runFirstLaunch + + - 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 }} ${{ matrix.configuration }} ${{ matrix.scheme }} build From b8c513409956b78002871f5905d0de91ca039751 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Wed, 30 Jul 2025 11:30:20 -0700 Subject: [PATCH 02/27] use allowed action --- .github/workflows/microsoft-pr.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/microsoft-pr.yml b/.github/workflows/microsoft-pr.yml index 90bb5eb79d86..2c3691838830 100644 --- a/.github/workflows/microsoft-pr.yml +++ b/.github/workflows/microsoft-pr.yml @@ -106,9 +106,8 @@ jobs: brew install xcbeautify ccache - name: Setup Xcode - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: '16.2' + run: | + sudo xcode-select --switch /Applications/Xcode_16.2.app - name: Download Xcode Platforms run: | @@ -251,9 +250,8 @@ jobs: brew install xcbeautify ccache - name: Setup Xcode - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: '16.2' + run: | + sudo xcode-select --switch /Applications/Xcode_16.2.app - name: Download Xcode Platforms run: | From d3f471388dad5e1e89ffc59e15fa9611e24a7632 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Wed, 30 Jul 2025 20:28:39 -0700 Subject: [PATCH 03/27] Update microsoft-pr.yml --- .github/workflows/microsoft-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/microsoft-pr.yml b/.github/workflows/microsoft-pr.yml index 2c3691838830..218fc02dc08c 100644 --- a/.github/workflows/microsoft-pr.yml +++ b/.github/workflows/microsoft-pr.yml @@ -107,7 +107,7 @@ jobs: - name: Setup Xcode run: | - sudo xcode-select --switch /Applications/Xcode_16.2.app + sudo xcode-select --switch /Applications/Xcode_16.4.0.app - name: Download Xcode Platforms run: | From a5073d87f60f6ef3db82d278831e73c28778ea36 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Thu, 31 Jul 2025 18:27:57 -0700 Subject: [PATCH 04/27] simplify matrix --- .github/workflows/microsoft-pr.yml | 105 +++++------------------------ 1 file changed, 17 insertions(+), 88 deletions(-) diff --git a/.github/workflows/microsoft-pr.yml b/.github/workflows/microsoft-pr.yml index 2c3691838830..844b849609d7 100644 --- a/.github/workflows/microsoft-pr.yml +++ b/.github/workflows/microsoft-pr.yml @@ -130,109 +130,38 @@ jobs: run: yarn format-check build-test-rntester: - name: "Build RNTester - ${{ matrix.friendly_name }}" + name: "Build RNTester - ${{ matrix.platform }}, ${{ matrix.arch }}, ${{ matrix.engine }}" permissions: {} runs-on: macos-latest timeout-minutes: 90 strategy: fail-fast: false matrix: + platform: [macos, ios, xros] + arch: [oldarch, newarch] + engine: [jsc, hermes] include: - - name: macos_debug_oldarch_jsc - friendly_name: 'macOS, Old Arch, JSC' + # Platform-specific properties + - platform: macos 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' + packager_platform: macos + - platform: ios 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' + packager_platform: ios + - platform: xros sdk: xrsimulator - configuration: Debug scheme: RNTester-visionOS - packager_platform: 'ios' + packager_platform: ios + # Architecture-specific properties + - arch: oldarch 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' + - arch: newarch new_arch_enabled: '1' + - engine: jsc 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' + - engine: hermes use_hermes: '1' steps: @@ -276,4 +205,4 @@ jobs: CCACHE_DISABLE: 1 run: | set -eox pipefail - .ado/scripts/xcodebuild.sh packages/rn-tester/RNTesterPods.xcworkspace ${{ matrix.sdk }} ${{ matrix.configuration }} ${{ matrix.scheme }} build + .ado/scripts/xcodebuild.sh packages/rn-tester/RNTesterPods.xcworkspace ${{ matrix.sdk }} Debug ${{ matrix.scheme }} build From bc8a06c51e43df95b84931788a4cc68f80f15194 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 1 Aug 2025 00:26:55 -0700 Subject: [PATCH 05/27] setup-toolchain --- .../microsoft-setup-toolchain/action.yml | 48 +++++++++++++++++++ .github/workflows/microsoft-pr.yml | 25 ++++++---- 2 files changed, 64 insertions(+), 9 deletions(-) create mode 100644 .github/actions/microsoft-setup-toolchain/action.yml diff --git a/.github/actions/microsoft-setup-toolchain/action.yml b/.github/actions/microsoft-setup-toolchain/action.yml new file mode 100644 index 000000000000..bc884e57de59 --- /dev/null +++ b/.github/actions/microsoft-setup-toolchain/action.yml @@ -0,0 +1,48 @@ +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 +runs: + using: composite + steps: + - name: Set up Ccache + id: setup-ccache + if: ${{ inputs.platform == 'ios' || inputs.platform == 'macos' }} + 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: 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 a0bba1291ea9..13f8014b794c 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,7 +46,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,7 +81,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: Install dependencies @@ -97,9 +100,11 @@ jobs: filter: blob:none fetch-depth: 0 - - uses: actions/setup-node@v4 + - name: Setup toolchain + uses: ./.github/actions/microsoft-setup-toolchain with: node-version: '23' + platform: 'macos' - name: Install Homebrew dependencies run: | @@ -117,16 +122,16 @@ jobs: - name: Install npm dependencies run: yarn install - - name: Run tests + - name: Run Jest tests run: yarn test-ci - - name: Flow type check + - name: Run Flow type checker run: yarn flow-check - - name: Lint + - name: Run ESLint run: yarn lint - - name: Format check + - name: Run Prettier format check run: yarn format-check build-test-rntester: @@ -170,9 +175,11 @@ jobs: filter: blob:none fetch-depth: 0 - - uses: actions/setup-node@v4 + - name: Setup toolchain + uses: ./.github/actions/microsoft-setup-toolchain with: node-version: '23' + platform: ${{ matrix.platform }} - name: Install Homebrew dependencies run: | From a400d20827d85d4fa55e3fe0ad0cc699a58377fb Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 1 Aug 2025 00:34:57 -0700 Subject: [PATCH 06/27] more --- .ado/apple-pr.yml | 18 ++-- .github/workflows/microsoft-pr.yml | 166 +++++++++++++++++++++++++++++ 2 files changed, 175 insertions(+), 9 deletions(-) diff --git a/.ado/apple-pr.yml b/.ado/apple-pr.yml index c8671f8441ea..31e5ba32c2e9 100644 --- a/.ado/apple-pr.yml +++ b/.ado/apple-pr.yml @@ -16,16 +16,16 @@ pr: - '*.md' stages: - - stage: Build_And_Test - displayName: 'Build and Test' - dependsOn: [] - jobs: - - template: /.ado/jobs/build-test-rntester.yml@self + # - 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 + # - 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 diff --git a/.github/workflows/microsoft-pr.yml b/.github/workflows/microsoft-pr.yml index 13f8014b794c..5d3b4c5fd7e3 100644 --- a/.github/workflows/microsoft-pr.yml +++ b/.github/workflows/microsoft-pr.yml @@ -213,3 +213,169 @@ jobs: run: | set -eox pipefail .ado/scripts/xcodebuild.sh packages/rn-tester/RNTesterPods.xcworkspace ${{ matrix.sdk }} Debug ${{ matrix.scheme }} build + + # Integration tests - currently disabled due to Verdaccio server hanging issues + # https://github.com/microsoft/react-native-macos/issues/2344 + # test-react-native-macos-init: + # name: "Test react-native-macos init" + # permissions: {} + # runs-on: macos-latest + # 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 Homebrew dependencies + # run: | + # brew bundle --file .ado/Brewfile + # + # - name: Setup Xcode + # run: | + # sudo xcode-select --switch /Applications/Xcode_16.2.app + # xcodebuild -downloadAllPlatforms + # sudo xcodebuild -runFirstLaunch + # + # - 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-latest + # 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 Homebrew dependencies + # run: | + # brew bundle --file .ado/Brewfile + # + # - name: Setup Xcode + # run: | + # sudo xcode-select --switch /Applications/Xcode_16.2.app + # xcodebuild -downloadAllPlatforms + # sudo xcodebuild -runFirstLaunch + # + # - 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 From bf052524d65d2a67a7a0484807800b117af4c70d Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 1 Aug 2025 00:48:58 -0700 Subject: [PATCH 07/27] xcode -> setup-toolchain --- .../microsoft-setup-toolchain/action.yml | 22 ++++++++- .github/workflows/microsoft-pr.yml | 46 ------------------- 2 files changed, 21 insertions(+), 47 deletions(-) diff --git a/.github/actions/microsoft-setup-toolchain/action.yml b/.github/actions/microsoft-setup-toolchain/action.yml index bc884e57de59..ff37a62d00a6 100644 --- a/.github/actions/microsoft-setup-toolchain/action.yml +++ b/.github/actions/microsoft-setup-toolchain/action.yml @@ -15,12 +15,16 @@ inputs: 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.app" runs: using: composite steps: - name: Set up Ccache id: setup-ccache - if: ${{ inputs.platform == 'ios' || inputs.platform == 'macos' }} + 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 @@ -40,6 +44,22 @@ runs: 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 diff --git a/.github/workflows/microsoft-pr.yml b/.github/workflows/microsoft-pr.yml index 5d3b4c5fd7e3..34a49087a982 100644 --- a/.github/workflows/microsoft-pr.yml +++ b/.github/workflows/microsoft-pr.yml @@ -106,19 +106,6 @@ jobs: node-version: '23' platform: 'macos' - - name: Install Homebrew dependencies - run: | - brew install xcbeautify ccache - - - name: Setup Xcode - run: | - sudo xcode-select --switch /Applications/Xcode_16.4.0.app - - - name: Download Xcode Platforms - run: | - xcodebuild -downloadAllPlatforms - sudo xcodebuild -runFirstLaunch - - name: Install npm dependencies run: yarn install @@ -181,19 +168,6 @@ jobs: node-version: '23' platform: ${{ matrix.platform }} - - name: Install Homebrew dependencies - run: | - brew install xcbeautify ccache - - - name: Setup Xcode - run: | - sudo xcode-select --switch /Applications/Xcode_16.2.app - - - name: Download Xcode Platforms - run: | - xcodebuild -downloadAllPlatforms - sudo xcodebuild -runFirstLaunch - - name: Install npm dependencies run: yarn install @@ -235,16 +209,6 @@ jobs: # node-version: '23' # platform: 'macos' # - # - name: Install Homebrew dependencies - # run: | - # brew bundle --file .ado/Brewfile - # - # - name: Setup Xcode - # run: | - # sudo xcode-select --switch /Applications/Xcode_16.2.app - # xcodebuild -downloadAllPlatforms - # sudo xcodebuild -runFirstLaunch - # # - name: Install npm dependencies # run: yarn install # @@ -314,16 +278,6 @@ jobs: # node-version: '23' # platform: 'macos' # - # - name: Install Homebrew dependencies - # run: | - # brew bundle --file .ado/Brewfile - # - # - name: Setup Xcode - # run: | - # sudo xcode-select --switch /Applications/Xcode_16.2.app - # xcodebuild -downloadAllPlatforms - # sudo xcodebuild -runFirstLaunch - # # - name: Install npm dependencies # run: yarn install # From d32448b861775004a6999e4a0c17d709358d13d4 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 1 Aug 2025 01:06:27 -0700 Subject: [PATCH 08/27] f --- .github/actions/microsoft-setup-toolchain/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/microsoft-setup-toolchain/action.yml b/.github/actions/microsoft-setup-toolchain/action.yml index ff37a62d00a6..cbaaf4b98033 100644 --- a/.github/actions/microsoft-setup-toolchain/action.yml +++ b/.github/actions/microsoft-setup-toolchain/action.yml @@ -18,7 +18,7 @@ inputs: xcode-version: description: The Xcode version to use (full path) type: string - default: "/Applications/Xcode_16.4.app" + default: "/Applications/Xcode_16.4.0.app" runs: using: composite steps: From bc863c1d0b03dc8e257b1fce7e23a8532de62bb4 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 1 Aug 2025 01:43:28 -0700 Subject: [PATCH 09/27] f --- .github/workflows/microsoft-pr.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/microsoft-pr.yml b/.github/workflows/microsoft-pr.yml index 34a49087a982..c71bc1190a45 100644 --- a/.github/workflows/microsoft-pr.yml +++ b/.github/workflows/microsoft-pr.yml @@ -93,7 +93,7 @@ jobs: javascript-tests: name: "JavaScript Tests" permissions: {} - runs-on: macos-latest + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: @@ -104,7 +104,6 @@ jobs: uses: ./.github/actions/microsoft-setup-toolchain with: node-version: '23' - platform: 'macos' - name: Install npm dependencies run: yarn install @@ -124,7 +123,7 @@ jobs: build-test-rntester: name: "Build RNTester - ${{ matrix.platform }}, ${{ matrix.arch }}, ${{ matrix.engine }}" permissions: {} - runs-on: macos-latest + runs-on: macos-15 timeout-minutes: 90 strategy: fail-fast: false @@ -193,7 +192,7 @@ jobs: # test-react-native-macos-init: # name: "Test react-native-macos init" # permissions: {} - # runs-on: macos-latest + # runs-on: macos-15 # timeout-minutes: 60 # steps: # - uses: actions/checkout@v4 @@ -263,7 +262,7 @@ jobs: # react-native-test-app-integration: # name: "Test react-native-test-app integration" # permissions: {} - # runs-on: macos-latest + # runs-on: macos-15 # timeout-minutes: 60 # steps: # - uses: actions/checkout@v4 From f35d3893c33709b69acadd0f5382e6b3eeab0079 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 1 Aug 2025 02:00:34 -0700 Subject: [PATCH 10/27] delete most of .ado folder --- .ado/Brewfile | 2 - .ado/ReactApple.nuspec | 356 ------------------ .ado/apple-pr.yml | 36 -- .ado/get-next-semver-version.js | 33 -- .ado/gitTagRelease.js | 44 --- .ado/jobs/build-test-rntester.yml | 132 ------- .../react-native-test-app-integration.yml | 59 --- .ado/jobs/test-javascript.yml | 22 -- .ado/jobs/test-react-native-macos-init.yml | 55 --- .ado/publish.yml | 56 --- .ado/scripts/ado-test-cleanup.sh | 34 -- .ado/scripts/ado-test-setup.sh | 63 ---- .ado/scripts/export-versions.mjs | 27 -- .ado/scripts/npmAddUser.mjs | 31 -- .ado/scripts/verdaccio.sh | 27 -- .ado/scripts/waitForVerdaccio.mjs | 31 -- .ado/templates/apple-tools-setup.yml | 17 - .ado/templates/build-rntester-steps.yml | 35 -- .ado/templates/test-rntester-steps.yml | 47 --- .ado/templates/verdaccio-publish.yml | 25 -- .ado/variables/vars.yml | 6 - .ado/verdaccio/config.yaml | 25 -- .ado/versionUtils.js | 26 -- .ado/xcconfig/debug_overrides.xcconfig | 3 - .ado/xcconfig/release_overrides.xcconfig | 21 -- .ado/xcconfig/release_staticanalysis.xcconfig | 13 - 26 files changed, 1226 deletions(-) delete mode 100644 .ado/Brewfile delete mode 100644 .ado/ReactApple.nuspec delete mode 100644 .ado/apple-pr.yml delete mode 100644 .ado/get-next-semver-version.js delete mode 100644 .ado/gitTagRelease.js delete mode 100644 .ado/jobs/build-test-rntester.yml delete mode 100644 .ado/jobs/react-native-test-app-integration.yml delete mode 100644 .ado/jobs/test-javascript.yml delete mode 100644 .ado/jobs/test-react-native-macos-init.yml delete mode 100644 .ado/publish.yml delete mode 100755 .ado/scripts/ado-test-cleanup.sh delete mode 100755 .ado/scripts/ado-test-setup.sh delete mode 100644 .ado/scripts/export-versions.mjs delete mode 100644 .ado/scripts/npmAddUser.mjs delete mode 100755 .ado/scripts/verdaccio.sh delete mode 100644 .ado/scripts/waitForVerdaccio.mjs delete mode 100644 .ado/templates/apple-tools-setup.yml delete mode 100644 .ado/templates/build-rntester-steps.yml delete mode 100644 .ado/templates/test-rntester-steps.yml delete mode 100644 .ado/templates/verdaccio-publish.yml delete mode 100644 .ado/variables/vars.yml delete mode 100644 .ado/verdaccio/config.yaml delete mode 100644 .ado/versionUtils.js delete mode 100644 .ado/xcconfig/debug_overrides.xcconfig delete mode 100644 .ado/xcconfig/release_overrides.xcconfig delete mode 100644 .ado/xcconfig/release_staticanalysis.xcconfig diff --git a/.ado/Brewfile b/.ado/Brewfile deleted file mode 100644 index bfe131072dca..000000000000 --- 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 2cb5901b6f60..000000000000 --- 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 31e5ba32c2e9..000000000000 --- 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 f45b99b04a1c..000000000000 --- 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 c314a7e5c1fb..000000000000 --- 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 f72e2869ae22..000000000000 --- 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 fdb8f0226804..000000000000 --- 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 cf13945d7be4..000000000000 --- 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 5a7031689b84..000000000000 --- 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 25644d43f2be..000000000000 --- 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 d3c01cd6d86b..000000000000 --- 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 dd8a9b13fdaa..000000000000 --- 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 53fb6ae28323..000000000000 --- 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 3a62339ab940..000000000000 --- 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/verdaccio.sh b/.ado/scripts/verdaccio.sh deleted file mode 100755 index 5539a1a03e7c..000000000000 --- a/.ado/scripts/verdaccio.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -NPM_REGISTRY=http://localhost:4873 - -set -eox pipefail - -case ${1-} in - "configure") - yarn config set npmRegistryServer $NPM_REGISTRY - yarn config set unsafeHttpWhitelist --json '["localhost"]' - ;; - - "init") - npm set registry $NPM_REGISTRY - scripts_root=$(cd -P "$(dirname $0)" && pwd) - node $scripts_root/waitForVerdaccio.mjs $NPM_REGISTRY - node $scripts_root/npmAddUser.mjs user pass mail@nomail.com $NPM_REGISTRY - ;; - - "publish") - checkpoint=$(git rev-parse HEAD) - cp nx.test.json nx.json - yarn nx release version 1000.0.0 - yarn nx release publish --registry $NPM_REGISTRY - git reset --hard $checkpoint - ;; -esac diff --git a/.ado/scripts/waitForVerdaccio.mjs b/.ado/scripts/waitForVerdaccio.mjs deleted file mode 100644 index 2ceb782c4e3f..000000000000 --- 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 5ceec7319288..000000000000 --- 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 9165999c854a..000000000000 --- 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 fd3816939693..000000000000 --- 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 4ec7d058ccf9..000000000000 --- 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 2b2001707a9f..000000000000 --- 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/verdaccio/config.yaml b/.ado/verdaccio/config.yaml deleted file mode 100644 index 7728446b6719..000000000000 --- a/.ado/verdaccio/config.yaml +++ /dev/null @@ -1,25 +0,0 @@ -storage: ./storage -auth: - htpasswd: - file: ./htpasswd -uplinks: - npmjs: - url: https://registry.npmjs.org/ - max_fails: 40 - maxage: 30m - timeout: 60s - agent_options: - keepAlive: true - maxSockets: 40 - maxFreeSockets: 10 -packages: - '@*/*': - access: $all - publish: $all - proxy: npmjs - '**': - access: $all - publish: $all - proxy: npmjs -logs: - - {type: file, path: verdaccio.log, format: pretty, level: debug} \ No newline at end of file diff --git a/.ado/versionUtils.js b/.ado/versionUtils.js deleted file mode 100644 index 1511df7b3e96..000000000000 --- 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 4d2cc29c3d83..000000000000 --- 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 48d2466f2a49..000000000000 --- 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 c87887e0251c..000000000000 --- 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 From 2888986e70666821ea31ff4956ca1fb7ac2aeaf5 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Wed, 6 Aug 2025 18:54:27 -0700 Subject: [PATCH 11/27] bring back verdaccio files and uncomment jobs --- .ado/scripts/verdaccio.sh | 27 +++ .ado/verdaccio/config.yaml | 25 +++ .github/workflows/microsoft-pr.yml | 286 ++++++++++++++--------------- 3 files changed, 194 insertions(+), 144 deletions(-) create mode 100755 .ado/scripts/verdaccio.sh create mode 100644 .ado/verdaccio/config.yaml diff --git a/.ado/scripts/verdaccio.sh b/.ado/scripts/verdaccio.sh new file mode 100755 index 000000000000..5539a1a03e7c --- /dev/null +++ b/.ado/scripts/verdaccio.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +NPM_REGISTRY=http://localhost:4873 + +set -eox pipefail + +case ${1-} in + "configure") + yarn config set npmRegistryServer $NPM_REGISTRY + yarn config set unsafeHttpWhitelist --json '["localhost"]' + ;; + + "init") + npm set registry $NPM_REGISTRY + scripts_root=$(cd -P "$(dirname $0)" && pwd) + node $scripts_root/waitForVerdaccio.mjs $NPM_REGISTRY + node $scripts_root/npmAddUser.mjs user pass mail@nomail.com $NPM_REGISTRY + ;; + + "publish") + checkpoint=$(git rev-parse HEAD) + cp nx.test.json nx.json + yarn nx release version 1000.0.0 + yarn nx release publish --registry $NPM_REGISTRY + git reset --hard $checkpoint + ;; +esac diff --git a/.ado/verdaccio/config.yaml b/.ado/verdaccio/config.yaml new file mode 100644 index 000000000000..7728446b6719 --- /dev/null +++ b/.ado/verdaccio/config.yaml @@ -0,0 +1,25 @@ +storage: ./storage +auth: + htpasswd: + file: ./htpasswd +uplinks: + npmjs: + url: https://registry.npmjs.org/ + max_fails: 40 + maxage: 30m + timeout: 60s + agent_options: + keepAlive: true + maxSockets: 40 + maxFreeSockets: 10 +packages: + '@*/*': + access: $all + publish: $all + proxy: npmjs + '**': + access: $all + publish: $all + proxy: npmjs +logs: + - {type: file, path: verdaccio.log, format: pretty, level: debug} \ No newline at end of file diff --git a/.github/workflows/microsoft-pr.yml b/.github/workflows/microsoft-pr.yml index c71bc1190a45..62a33a437b73 100644 --- a/.github/workflows/microsoft-pr.yml +++ b/.github/workflows/microsoft-pr.yml @@ -187,148 +187,146 @@ jobs: set -eox pipefail .ado/scripts/xcodebuild.sh packages/rn-tester/RNTesterPods.xcworkspace ${{ matrix.sdk }} Debug ${{ matrix.scheme }} build - # Integration tests - currently disabled due to Verdaccio server hanging issues - # https://github.com/microsoft/react-native-macos/issues/2344 - # 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 + 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 + 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 From bfc41b869ecb76198887ce23194e9cdb6df118b5 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Thu, 7 Aug 2025 18:13:34 -0700 Subject: [PATCH 12/27] bring back more scripts --- .ado/scripts/npmAddUser.mjs | 31 +++++++++++++++++++++++++++++++ .ado/scripts/waitForVerdaccio.mjs | 31 +++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 .ado/scripts/npmAddUser.mjs create mode 100644 .ado/scripts/waitForVerdaccio.mjs diff --git a/.ado/scripts/npmAddUser.mjs b/.ado/scripts/npmAddUser.mjs new file mode 100644 index 000000000000..3a62339ab940 --- /dev/null +++ b/.ado/scripts/npmAddUser.mjs @@ -0,0 +1,31 @@ +#!/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 new file mode 100644 index 000000000000..2ceb782c4e3f --- /dev/null +++ b/.ado/scripts/waitForVerdaccio.mjs @@ -0,0 +1,31 @@ +#!/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]); From 55ca895e7b9db6c9de8d888ab2a56a0661867776 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Thu, 7 Aug 2025 18:48:14 -0700 Subject: [PATCH 13/27] try: copilot fix verdaccio hangs --- .ado/scripts/verdaccio.sh | 1 - .ado/scripts/waitForVerdaccio.mjs | 60 ++++++++++++++++++++---------- .github/workflows/microsoft-pr.yml | 26 +++++++++++-- 3 files changed, 62 insertions(+), 25 deletions(-) diff --git a/.ado/scripts/verdaccio.sh b/.ado/scripts/verdaccio.sh index 5539a1a03e7c..fc6ecd522975 100755 --- a/.ado/scripts/verdaccio.sh +++ b/.ado/scripts/verdaccio.sh @@ -13,7 +13,6 @@ case ${1-} in "init") npm set registry $NPM_REGISTRY scripts_root=$(cd -P "$(dirname $0)" && pwd) - node $scripts_root/waitForVerdaccio.mjs $NPM_REGISTRY node $scripts_root/npmAddUser.mjs user pass mail@nomail.com $NPM_REGISTRY ;; diff --git a/.ado/scripts/waitForVerdaccio.mjs b/.ado/scripts/waitForVerdaccio.mjs index 2ceb782c4e3f..9b2798b77b8f 100644 --- a/.ado/scripts/waitForVerdaccio.mjs +++ b/.ado/scripts/waitForVerdaccio.mjs @@ -4,28 +4,48 @@ 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); +const REGISTRY_URL = process.argv[2] || "http://localhost:4873"; +const TIMEOUT_MS = Number(process.env.VERDACCIO_WAIT_TIMEOUT_MS || 60_000); +const POLL_MS = Number(process.env.VERDACCIO_WAIT_POLL_MS || 1_000); + +// Construct a ping URL that's supported by Verdaccio +const pingUrl = new URL(REGISTRY_URL); +// Ensure we hit the ping endpoint regardless of trailing slash +pingUrl.pathname = (pingUrl.pathname?.replace(/\/*$/, "") || "") + "/-/ping"; + +const deadline = Date.now() + TIMEOUT_MS; + +function dumpLogs() { + try { + // Verdaccio config logs to .ado/verdaccio/verdaccio.log + const logUrl = new URL("../verdaccio/verdaccio.log", import.meta.url); + const logFile = fs.readFileSync(logUrl, { encoding: "utf-8" }); + console.log("\n--- Verdaccio log ---\n" + logFile + "\n--- end log ---\n"); + } catch { + console.log("No Verdaccio log output yet."); + } +} + +function check() { + if (Date.now() > deadline) { + console.error(`Timed out waiting for Verdaccio at ${pingUrl.href}`); + dumpLogs(); + process.exit(1); + } + + get(pingUrl, res => { + if (res.statusCode === 200) { + console.log("Verdaccio is ready: " + pingUrl.href); + process.exit(0); + } else { + console.log(`Verdaccio status: ${res.statusCode}; retrying in ${POLL_MS}ms`); + setTimeout(check, POLL_MS); } }).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(`Verdaccio not ready (${err.message}); retrying in ${POLL_MS}ms`); + setTimeout(check, POLL_MS); }); } -console.log("Waiting for Verdaccio instance to respond..."); - -queryForServerStatus(process.argv[2]); +console.log(`Waiting for Verdaccio to respond at ${pingUrl.href} (timeout ${TIMEOUT_MS}ms)...`); +check(); diff --git a/.github/workflows/microsoft-pr.yml b/.github/workflows/microsoft-pr.yml index 62a33a437b73..e8df899e9ee2 100644 --- a/.github/workflows/microsoft-pr.yml +++ b/.github/workflows/microsoft-pr.yml @@ -218,14 +218,23 @@ jobs: - name: Start Verdaccio server run: | - npx verdaccio --config .ado/verdaccio/config.yaml & - sleep 5 + set -euo pipefail + nohup npx 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: Stop Verdaccio + if: always() + run: | + if [ -f "$RUNNER_TEMP/verdaccio.pid" ]; then + kill "$(cat $RUNNER_TEMP/verdaccio.pid)" || true + fi - name: Export versions run: node .ado/scripts/export-versions.mjs @@ -287,14 +296,23 @@ jobs: - name: Start Verdaccio server run: | - npx verdaccio --config .ado/verdaccio/config.yaml & - sleep 5 + set -euo pipefail + nohup npx 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: Stop Verdaccio + if: always() + run: | + if [ -f "$RUNNER_TEMP/verdaccio.pid" ]; then + kill "$(cat $RUNNER_TEMP/verdaccio.pid)" || true + fi - name: Clone react-native-test-app run: | From 2a9ed3c07edd772a9456cabe8b2a55b1265d58ea Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Thu, 7 Aug 2025 18:53:43 -0700 Subject: [PATCH 14/27] Move workflows to separate files --- .../workflows/microsoft-build-rntester.yml | 71 ++++++ .github/workflows/microsoft-pr.yml | 222 +----------------- ...soft-react-native-test-app-integration.yml | 88 +++++++ ...microsoft-test-react-native-macos-init.yml | 84 +++++++ 4 files changed, 247 insertions(+), 218 deletions(-) create mode 100644 .github/workflows/microsoft-build-rntester.yml create mode 100644 .github/workflows/microsoft-react-native-test-app-integration.yml create mode 100644 .github/workflows/microsoft-test-react-native-macos-init.yml diff --git a/.github/workflows/microsoft-build-rntester.yml b/.github/workflows/microsoft-build-rntester.yml new file mode 100644 index 000000000000..0c2dd10c1cd7 --- /dev/null +++ b/.github/workflows/microsoft-build-rntester.yml @@ -0,0 +1,71 @@ +name: Build RNTester + +on: + workflow_call: + +jobs: + build-test-rntester: + name: "${{ matrix.platform }}, ${{ matrix.arch }}, ${{ matrix.engine }}" + 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 diff --git a/.github/workflows/microsoft-pr.yml b/.github/workflows/microsoft-pr.yml index e8df899e9ee2..2f727bf07791 100644 --- a/.github/workflows/microsoft-pr.yml +++ b/.github/workflows/microsoft-pr.yml @@ -121,230 +121,16 @@ jobs: run: yarn format-check build-test-rntester: - name: "Build RNTester - ${{ matrix.platform }}, ${{ matrix.arch }}, ${{ matrix.engine }}" + name: "Build RNTester" 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 + uses: ./.github/workflows/microsoft-build-rntester.yml 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: | - set -euo pipefail - nohup npx 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: Stop Verdaccio - if: always() - run: | - if [ -f "$RUNNER_TEMP/verdaccio.pid" ]; then - kill "$(cat $RUNNER_TEMP/verdaccio.pid)" || true - fi - - - 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 + uses: ./.github/workflows/microsoft-test-react-native-macos-init.yml 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: | - set -euo pipefail - nohup npx 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: Stop Verdaccio - if: always() - run: | - if [ -f "$RUNNER_TEMP/verdaccio.pid" ]; then - kill "$(cat $RUNNER_TEMP/verdaccio.pid)" || true - fi - - - 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 + uses: ./.github/workflows/microsoft-react-native-test-app-integration.yml 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 000000000000..82acd7c2f368 --- /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: '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: | + 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 000000000000..6be323509ca7 --- /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: '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: | + 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 From 8de05771b20e0e38fa6bd3a95091930489e3683e Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Thu, 7 Aug 2025 19:20:37 -0700 Subject: [PATCH 15/27] only on stable --- .github/workflows/microsoft-pr.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/microsoft-pr.yml b/.github/workflows/microsoft-pr.yml index 2f727bf07791..0fa7997986ca 100644 --- a/.github/workflows/microsoft-pr.yml +++ b/.github/workflows/microsoft-pr.yml @@ -128,9 +128,15 @@ jobs: 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 From 19bf6651edd29d596d921e0788bdf295b37c8c4d Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 8 Aug 2025 01:11:06 -0700 Subject: [PATCH 16/27] Revert "try: copilot fix verdaccio hangs" This reverts commit 55ca895e7b9db6c9de8d888ab2a56a0661867776. --- .ado/scripts/verdaccio.sh | 1 + .ado/scripts/waitForVerdaccio.mjs | 60 +++++++++++-------------------- 2 files changed, 21 insertions(+), 40 deletions(-) diff --git a/.ado/scripts/verdaccio.sh b/.ado/scripts/verdaccio.sh index fc6ecd522975..5539a1a03e7c 100755 --- a/.ado/scripts/verdaccio.sh +++ b/.ado/scripts/verdaccio.sh @@ -13,6 +13,7 @@ case ${1-} in "init") npm set registry $NPM_REGISTRY scripts_root=$(cd -P "$(dirname $0)" && pwd) + node $scripts_root/waitForVerdaccio.mjs $NPM_REGISTRY node $scripts_root/npmAddUser.mjs user pass mail@nomail.com $NPM_REGISTRY ;; diff --git a/.ado/scripts/waitForVerdaccio.mjs b/.ado/scripts/waitForVerdaccio.mjs index 9b2798b77b8f..2ceb782c4e3f 100644 --- a/.ado/scripts/waitForVerdaccio.mjs +++ b/.ado/scripts/waitForVerdaccio.mjs @@ -4,48 +4,28 @@ import * as fs from "node:fs"; import { get } from "node:http"; -const REGISTRY_URL = process.argv[2] || "http://localhost:4873"; -const TIMEOUT_MS = Number(process.env.VERDACCIO_WAIT_TIMEOUT_MS || 60_000); -const POLL_MS = Number(process.env.VERDACCIO_WAIT_POLL_MS || 1_000); - -// Construct a ping URL that's supported by Verdaccio -const pingUrl = new URL(REGISTRY_URL); -// Ensure we hit the ping endpoint regardless of trailing slash -pingUrl.pathname = (pingUrl.pathname?.replace(/\/*$/, "") || "") + "/-/ping"; - -const deadline = Date.now() + TIMEOUT_MS; - -function dumpLogs() { - try { - // Verdaccio config logs to .ado/verdaccio/verdaccio.log - const logUrl = new URL("../verdaccio/verdaccio.log", import.meta.url); - const logFile = fs.readFileSync(logUrl, { encoding: "utf-8" }); - console.log("\n--- Verdaccio log ---\n" + logFile + "\n--- end log ---\n"); - } catch { - console.log("No Verdaccio log output yet."); - } -} - -function check() { - if (Date.now() > deadline) { - console.error(`Timed out waiting for Verdaccio at ${pingUrl.href}`); - dumpLogs(); - process.exit(1); - } - - get(pingUrl, res => { - if (res.statusCode === 200) { - console.log("Verdaccio is ready: " + pingUrl.href); - process.exit(0); - } else { - console.log(`Verdaccio status: ${res.statusCode}; retrying in ${POLL_MS}ms`); - setTimeout(check, POLL_MS); +/** + * @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(`Verdaccio not ready (${err.message}); retrying in ${POLL_MS}ms`); - setTimeout(check, POLL_MS); + 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 to respond at ${pingUrl.href} (timeout ${TIMEOUT_MS}ms)...`); -check(); +console.log("Waiting for Verdaccio instance to respond..."); + +queryForServerStatus(process.argv[2]); From ab261dbe3f27645f0a4a8cfee294d5c0e05ce3b7 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 8 Aug 2025 06:33:34 -0700 Subject: [PATCH 17/27] copy RNTA setup toolchain action instead of rnx-kit one --- .../microsoft-setup-toolchain/action.yml | 107 +++++++++++------- .../workflows/microsoft-build-rntester.yml | 4 +- .github/workflows/microsoft-pr.yml | 2 +- ...soft-react-native-test-app-integration.yml | 2 +- ...microsoft-test-react-native-macos-init.yml | 2 +- 5 files changed, 74 insertions(+), 43 deletions(-) diff --git a/.github/actions/microsoft-setup-toolchain/action.yml b/.github/actions/microsoft-setup-toolchain/action.yml index cbaaf4b98033..925b30d3cfa8 100644 --- a/.github/actions/microsoft-setup-toolchain/action.yml +++ b/.github/actions/microsoft-setup-toolchain/action.yml @@ -1,63 +1,94 @@ -name: Setup the toolchain +name: Setup 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" + 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 runs: using: composite steps: - name: Set up Ccache id: setup-ccache - if: ${{ inputs.platform == 'ios' || inputs.platform == 'macos' || inputs.platform == 'xros' }} + if: ${{ inputs.platform == 'ios' || inputs.platform == 'macos' || inputs.platform == 'visionos' }} run: | - podfile_lock="packages/test-app/${{ inputs.platform }}/Podfile.lock" + 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 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 }} + if: ${{ inputs.platform == 'android' || inputs.platform == 'node' }} 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' }} + java-version: ${{ inputs.java-version }} + - name: Set up Gradle + if: ${{ inputs.platform == 'android' || inputs.platform == 'node' }} + uses: gradle/actions/setup-gradle@v4 + with: + gradle-version: wrapper + gradle-home-cache-excludes: | + caches + jdks + - name: Set up MSBuild + if: ${{ inputs.platform == 'windows' }} + uses: microsoft/setup-msbuild@v2 + - name: Set up Ruby + if: ${{ runner.os != 'Windows' }} + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.2.3" + bundler: Gemfile.lock + bundler-cache: true + - 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.xcode-developer-dir != '' }} run: | - sudo xcode-select --switch ${{ inputs.xcode-version }} + sudo xcode-select --switch ${{ inputs.xcode-developer-dir }} shell: bash - - name: Download Xcode Platforms - if: ${{ inputs.platform == 'ios' || inputs.platform == 'macos' || inputs.platform == 'xros' }} + - name: Download visionOS SDK + if: ${{ inputs.platform == 'visionos' }} run: | - xcodebuild -downloadAllPlatforms + # 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 @@ -65,4 +96,4 @@ runs: uses: actions/cache@v4 with: path: .ccache - key: ${{ runner.os }}-${{ inputs.cache-key-prefix }}-ccache-${{ steps.setup-ccache.outputs.cache-key }} + 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 index 0c2dd10c1cd7..ae67d79310ad 100644 --- a/.github/workflows/microsoft-build-rntester.yml +++ b/.github/workflows/microsoft-build-rntester.yml @@ -24,7 +24,7 @@ jobs: sdk: iphonesimulator scheme: RNTester packager_platform: ios - - platform: xros + - platform: visionos sdk: xrsimulator scheme: RNTester-visionOS packager_platform: ios @@ -47,7 +47,7 @@ jobs: - name: Setup toolchain uses: ./.github/actions/microsoft-setup-toolchain with: - node-version: '23' + node-version: '22' platform: ${{ matrix.platform }} - name: Install npm dependencies diff --git a/.github/workflows/microsoft-pr.yml b/.github/workflows/microsoft-pr.yml index 0fa7997986ca..def449676daf 100644 --- a/.github/workflows/microsoft-pr.yml +++ b/.github/workflows/microsoft-pr.yml @@ -103,7 +103,7 @@ jobs: - name: Setup toolchain uses: ./.github/actions/microsoft-setup-toolchain with: - node-version: '23' + node-version: '22' - name: Install npm dependencies run: yarn install diff --git a/.github/workflows/microsoft-react-native-test-app-integration.yml b/.github/workflows/microsoft-react-native-test-app-integration.yml index 82acd7c2f368..98c09568cdf4 100644 --- a/.github/workflows/microsoft-react-native-test-app-integration.yml +++ b/.github/workflows/microsoft-react-native-test-app-integration.yml @@ -18,7 +18,7 @@ jobs: - name: Setup toolchain uses: ./.github/actions/microsoft-setup-toolchain with: - node-version: '23' + node-version: '22' platform: 'macos' - name: Install npm dependencies diff --git a/.github/workflows/microsoft-test-react-native-macos-init.yml b/.github/workflows/microsoft-test-react-native-macos-init.yml index 6be323509ca7..98bf62f68193 100644 --- a/.github/workflows/microsoft-test-react-native-macos-init.yml +++ b/.github/workflows/microsoft-test-react-native-macos-init.yml @@ -19,7 +19,7 @@ jobs: - name: Setup toolchain uses: ./.github/actions/microsoft-setup-toolchain with: - node-version: '23' + node-version: '22' platform: 'macos' - name: Install npm dependencies From fa37265323ba120f359dcefbf5d19d6b75983a21 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 8 Aug 2025 06:40:41 -0700 Subject: [PATCH 18/27] f --- .../microsoft-setup-toolchain/action.yml | 18 ------------------ .github/workflows/microsoft-build-rntester.yml | 1 + 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/.github/actions/microsoft-setup-toolchain/action.yml b/.github/actions/microsoft-setup-toolchain/action.yml index 925b30d3cfa8..14546fb5cb99 100644 --- a/.github/actions/microsoft-setup-toolchain/action.yml +++ b/.github/actions/microsoft-setup-toolchain/action.yml @@ -53,24 +53,6 @@ runs: with: distribution: temurin java-version: ${{ inputs.java-version }} - - name: Set up Gradle - if: ${{ inputs.platform == 'android' || inputs.platform == 'node' }} - uses: gradle/actions/setup-gradle@v4 - with: - gradle-version: wrapper - gradle-home-cache-excludes: | - caches - jdks - - name: Set up MSBuild - if: ${{ inputs.platform == 'windows' }} - uses: microsoft/setup-msbuild@v2 - - name: Set up Ruby - if: ${{ runner.os != 'Windows' }} - uses: ruby/setup-ruby@v1 - with: - ruby-version: "3.2.3" - bundler: Gemfile.lock - bundler-cache: true - name: Set up Node.js uses: actions/setup-node@v4.4.0 with: diff --git a/.github/workflows/microsoft-build-rntester.yml b/.github/workflows/microsoft-build-rntester.yml index ae67d79310ad..74c523fa15bd 100644 --- a/.github/workflows/microsoft-build-rntester.yml +++ b/.github/workflows/microsoft-build-rntester.yml @@ -49,6 +49,7 @@ jobs: with: node-version: '22' platform: ${{ matrix.platform }} + project-root: 'packages/rn-tester' - name: Install npm dependencies run: yarn install From 8a0ac3874819255c729ad3d5fb38ffde1efffbc0 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 8 Aug 2025 06:52:45 -0700 Subject: [PATCH 19/27] f --- .github/workflows/microsoft-build-rntester.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/microsoft-build-rntester.yml b/.github/workflows/microsoft-build-rntester.yml index 74c523fa15bd..cc8b8cee9d67 100644 --- a/.github/workflows/microsoft-build-rntester.yml +++ b/.github/workflows/microsoft-build-rntester.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - platform: [macos, ios, xros] + platform: [macos, ios, visionos] arch: [oldarch, newarch] engine: [jsc, hermes] include: From 82565984aac126ac0b8a660fdbf12acd6f18690c Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 8 Aug 2025 06:58:25 -0700 Subject: [PATCH 20/27] try use ccache --- .ado/scripts/xcodebuild.sh | 4 ++-- .github/workflows/microsoft-build-rntester.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.ado/scripts/xcodebuild.sh b/.ado/scripts/xcodebuild.sh index 178ec14cd3c2..29da04b74c51 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/.github/workflows/microsoft-build-rntester.yml b/.github/workflows/microsoft-build-rntester.yml index cc8b8cee9d67..2ef50e3d30f0 100644 --- a/.github/workflows/microsoft-build-rntester.yml +++ b/.github/workflows/microsoft-build-rntester.yml @@ -66,7 +66,7 @@ jobs: - name: Build ${{ matrix.scheme }} env: - CCACHE_DISABLE: 1 + USE_CCACHE: 1 run: | set -eox pipefail .ado/scripts/xcodebuild.sh packages/rn-tester/RNTesterPods.xcworkspace ${{ matrix.sdk }} Debug ${{ matrix.scheme }} build From c740aed35d4944c7bff234c23d5b5d3bc5ba550a Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 8 Aug 2025 07:10:06 -0700 Subject: [PATCH 21/27] use xcode 16.4 again --- .github/actions/microsoft-setup-toolchain/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/microsoft-setup-toolchain/action.yml b/.github/actions/microsoft-setup-toolchain/action.yml index 14546fb5cb99..83ae29bd828a 100644 --- a/.github/actions/microsoft-setup-toolchain/action.yml +++ b/.github/actions/microsoft-setup-toolchain/action.yml @@ -18,6 +18,7 @@ inputs: 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: From c59d3e67941da14cf4639c79c00f7977c287250c Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 8 Aug 2025 07:14:14 -0700 Subject: [PATCH 22/27] f --- .github/actions/microsoft-setup-toolchain/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/microsoft-setup-toolchain/action.yml b/.github/actions/microsoft-setup-toolchain/action.yml index 83ae29bd828a..e8e05e1c7765 100644 --- a/.github/actions/microsoft-setup-toolchain/action.yml +++ b/.github/actions/microsoft-setup-toolchain/action.yml @@ -61,7 +61,7 @@ runs: cache: ${{ inputs.cache-npm-dependencies }} registry-url: https://registry.npmjs.org - name: Set up Xcode - if: ${{ inputs.xcode-developer-dir != '' }} + if: ${{ inputs.platform == 'ios' || inputs.platform == 'macos' || inputs.platform == 'visionos' }} run: | sudo xcode-select --switch ${{ inputs.xcode-developer-dir }} shell: bash From b766bbf7dd26e2e4e56e3f38eb7ba09a5b83d74c Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 8 Aug 2025 07:19:58 -0700 Subject: [PATCH 23/27] disable ccache --- .github/workflows/microsoft-build-rntester.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/microsoft-build-rntester.yml b/.github/workflows/microsoft-build-rntester.yml index 2ef50e3d30f0..2635151cf14c 100644 --- a/.github/workflows/microsoft-build-rntester.yml +++ b/.github/workflows/microsoft-build-rntester.yml @@ -66,7 +66,7 @@ jobs: - name: Build ${{ matrix.scheme }} env: - USE_CCACHE: 1 + USE_CCACHE: 0 run: | set -eox pipefail .ado/scripts/xcodebuild.sh packages/rn-tester/RNTesterPods.xcworkspace ${{ matrix.sdk }} Debug ${{ matrix.scheme }} build From e276015f23e2b08585ffa0b7c6a65a30184f8fd4 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Mon, 11 Aug 2025 15:48:11 -0700 Subject: [PATCH 24/27] PR feedback --- .ado/publish.yml | 56 ++++++++++++++++++++++++++++++ .ado/scripts/export-versions.mjs | 27 ++++++++++++++ .github/workflows/microsoft-pr.yml | 4 +-- 3 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 .ado/publish.yml create mode 100644 .ado/scripts/export-versions.mjs diff --git a/.ado/publish.yml b/.ado/publish.yml new file mode 100644 index 000000000000..25644d43f2be --- /dev/null +++ b/.ado/publish.yml @@ -0,0 +1,56 @@ +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/export-versions.mjs b/.ado/scripts/export-versions.mjs new file mode 100644 index 000000000000..53fb6ae28323 --- /dev/null +++ b/.ado/scripts/export-versions.mjs @@ -0,0 +1,27 @@ +// @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/.github/workflows/microsoft-pr.yml b/.github/workflows/microsoft-pr.yml index def449676daf..39690aed0e2d 100644 --- a/.github/workflows/microsoft-pr.yml +++ b/.github/workflows/microsoft-pr.yml @@ -54,8 +54,8 @@ jobs: 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" From 9a2aa0872457f60c7fe2317dbffe3961280e5025 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Wed, 13 Aug 2025 13:03:56 -0700 Subject: [PATCH 25/27] build-test-rntester --> build-rntester --- .github/workflows/microsoft-build-rntester.yml | 2 +- .github/workflows/microsoft-pr.yml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/microsoft-build-rntester.yml b/.github/workflows/microsoft-build-rntester.yml index 2635151cf14c..746fd235ca02 100644 --- a/.github/workflows/microsoft-build-rntester.yml +++ b/.github/workflows/microsoft-build-rntester.yml @@ -4,7 +4,7 @@ on: workflow_call: jobs: - build-test-rntester: + build-rntester: name: "${{ matrix.platform }}, ${{ matrix.arch }}, ${{ matrix.engine }}" runs-on: macos-15 timeout-minutes: 90 diff --git a/.github/workflows/microsoft-pr.yml b/.github/workflows/microsoft-pr.yml index 39690aed0e2d..cc08d14136ec 100644 --- a/.github/workflows/microsoft-pr.yml +++ b/.github/workflows/microsoft-pr.yml @@ -32,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: {} @@ -120,7 +122,7 @@ jobs: - name: Run Prettier format check run: yarn format-check - build-test-rntester: + build-rntester: name: "Build RNTester" permissions: {} uses: ./.github/workflows/microsoft-build-rntester.yml @@ -140,3 +142,4 @@ jobs: # 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 + From 999f4b67ba9fd25e47975692d7745dd35e06dc36 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Wed, 13 Aug 2025 13:04:06 -0700 Subject: [PATCH 26/27] add pr / all --- .github/workflows/microsoft-pr.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/microsoft-pr.yml b/.github/workflows/microsoft-pr.yml index cc08d14136ec..0e4ca1a6f3e2 100644 --- a/.github/workflows/microsoft-pr.yml +++ b/.github/workflows/microsoft-pr.yml @@ -143,3 +143,19 @@ jobs: if: ${{ endsWith(github.base_ref, '-stable') }} uses: ./.github/workflows/microsoft-react-native-test-app-integration.yml + all: + name: "All" + 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." From 25749eebf7939a23bf49c360f25e68aa74effe4d Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Wed, 13 Aug 2025 13:42:22 -0700 Subject: [PATCH 27/27] add permissions --- .github/workflows/microsoft-pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/microsoft-pr.yml b/.github/workflows/microsoft-pr.yml index 0e4ca1a6f3e2..8af4285316f1 100644 --- a/.github/workflows/microsoft-pr.yml +++ b/.github/workflows/microsoft-pr.yml @@ -145,6 +145,7 @@ jobs: all: name: "All" + permissions: {} runs-on: ubuntu-latest needs: - lint-title