Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .ado/scripts/export-versions.mjs

This file was deleted.

35 changes: 35 additions & 0 deletions .github/scripts/export-versions.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env node
/**
* Export react and react-native version information from packages/react-native/package.json.
*
* Outputs (written to $GITHUB_OUTPUT):
* react_version – the React peer dependency version (e.g. "19.0.0")
* react_native_version – the coerced major.minor React Native version (e.g. "0.79")
*/
import * as fs from "node:fs";
import { URL } from "node:url";

function coerce(version: string): string {
const [major, minor = "0"] = version.split("-")[0].split(".");
return `${major}.${minor}`;
}

function exportValue(name: string, value: string): void {
const githubOutput = process.env.GITHUB_OUTPUT;
if (githubOutput) {
fs.appendFileSync(githubOutput, `${name}=${value}\n`);
} else {
// Fallback: print to stdout for local debugging
console.log(`${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"]));
14 changes: 6 additions & 8 deletions .github/workflows/microsoft-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,11 @@ jobs:
if: ${{ endsWith(github.base_ref, '-stable') }}
uses: ./.github/workflows/microsoft-test-react-native-macos-init.yml

# https://github.com/microsoft/react-native-macos/issues/2344
# Disable these tests because verdaccio hangs
# react-native-test-app-integration:
# name: "Test react-native-test-app integration"
# permissions: {}
# if: ${{ endsWith(github.base_ref, '-stable') }}
# uses: ./.github/workflows/microsoft-react-native-test-app-integration.yml
react-native-test-app-integration:
name: "Test react-native-test-app integration"
permissions: {}
if: ${{ endsWith(github.base_ref, '-stable') }}
uses: ./.github/workflows/microsoft-react-native-test-app-integration.yml

PR:
name: "PR"
Expand All @@ -164,7 +162,7 @@ jobs:
- build-rntester
- prebuild-macos-core
- test-react-native-macos-init
# - react-native-test-app-integration
- react-native-test-app-integration
steps:
- name: Check for failures or cancellations
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
Expand Down
51 changes: 21 additions & 30 deletions .github/workflows/microsoft-react-native-test-app-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,64 +25,55 @@ jobs:
run: yarn install

- name: Build community CLI plugin
run: yarn build
run: |
yarn build
# yarn build rewrites package.json exports; restore them
git checkout -- packages/*/package.json

- 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: Export versions
id: versions
run: node .github/scripts/export-versions.mts

- name: Publish to Verdaccio
run: .ado/scripts/verdaccio.sh publish --branch origin/${{ github.base_ref }}
- name: Pack local react-native-macos
working-directory: packages/react-native
run: |
set -eox pipefail
yarn pack -o ${{ runner.temp }}/react-native-macos.tgz

- 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
working-directory: react-native-test-app/packages/app
run: |
npm run set-react-version $(cat ${{ github.workspace }}/.react_native_version) -- --overrides '{ "react-native-macos": "1000.0.0" }'
node scripts/internal/set-react-version.mts ${{ steps.versions.outputs.react_native_version }} --overrides '{ "react-native-macos": "file:${{ runner.temp }}/react-native-macos.tgz" }'

- name: Install dependencies in test app
working-directory: react-native-test-app
env:
YARN_ENABLE_HARDENED_MODE: 0
YARN_NPM_MINIMAL_AGE_GATE: 0
run: |
set -eo pipefail
${{ github.workspace }}/.ado/scripts/verdaccio.sh configure
yarn --no-immutable

- name: Bundle JavaScript
working-directory: react-native-test-app/example
working-directory: react-native-test-app/packages/example-macos
run: |
yarn build:macos || yarn build:macos

- name: Install Pods
working-directory: react-native-test-app/example
working-directory: react-native-test-app/packages/example-macos
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()
working-directory: react-native-test-app/packages/example-macos
run: |
if [ -f "$RUNNER_TEMP/verdaccio.pid" ]; then
kill "$(cat $RUNNER_TEMP/verdaccio.pid)" || true
fi
../../scripts/xcodebuild.sh macos/Example.xcworkspace build
Loading