Skip to content
Closed
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
29 changes: 22 additions & 7 deletions .github/actions/test_ios_helloworld/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,20 @@ runs:
uses: ./.github/actions/setup-xcode
- name: Setup node.js
uses: ./.github/actions/setup-node
- name: Cache setup
id: cache_setup
uses: ./.github/actions/cache_setup
- name: Create Hermes folder
shell: bash
run: mkdir -p "$HERMES_WS_DIR"
- name: Download Hermes
uses: actions/download-artifact@v4
with:
hermes-version: ${{ inputs.hermes-version }}
react-native-version: ${{ inputs.react-native-version }}
name: hermes-darwin-bin-${{ inputs.flavor }}
path: /tmp/hermes/hermes-runtime-darwin/
- name: Print Downloaded hermes
shell: bash
run: ls -lR "$HERMES_WS_DIR"
- name: Run yarn
shell: bash
run: yarn install --non-interactive
- name: Restore Hermes workspace
uses: ./.github/actions/restore-hermes-workspace
- name: Setup ruby
uses: ruby/setup-ruby@v1.170.0
with:
Expand All @@ -78,6 +81,17 @@ runs:
args+=(--jsvm jsc)
yarn bootstrap ios "${args[@]}" | cat
else
# Tarball is restored with capital flavors suffix, but somehow the tarball name from JS at line 96 returns as lowercased.
# Let's ensure that the tarballs have the right names

if [[ -f "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-Debug.tar.gz" ]]; then
mv "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-Debug.tar.gz" "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-debug.tar.gz"
fi

if [[ -f "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-Release.tar.gz" ]]; then
mv "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-Release.tar.gz" "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-release.tar.gz"
fi

BUILD_TYPE="${{ inputs.flavor }}"
TARBALL_FILENAME=$(node ../react-native/scripts/hermes/get-tarball-name.js --buildType "$BUILD_TYPE")
HERMES_PATH="$HERMES_WS_DIR/hermes-runtime-darwin/$TARBALL_FILENAME"
Expand All @@ -87,6 +101,7 @@ runs:
shell: bash
run: |
cd packages/helloworld

args=()
if [[ ${{ inputs.flavor }} == "Release" ]]; then
args+=(--prod)
Expand Down
10 changes: 5 additions & 5 deletions .github/actions/test_ios_rntester/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,11 @@ runs:
- name: Run yarn
shell: bash
run: yarn install --non-interactive
- name: Cache setup
id: cache_setup
uses: ./.github/actions/cache_setup
- name: Download Hermes
uses: actions/download-artifact@v4
with:
hermes-version: ${{ inputs.hermes-version }}
react-native-version: ${{ inputs.react-native-version }}
name: hermes-darwin-bin-${{ inputs.flavor }}
path: ${{ inputs.hermes-tarball-artifacts-dir }}
- name: Setup ruby
uses: ruby/setup-ruby@v1.170.0
with:
Expand Down Expand Up @@ -82,6 +81,7 @@ runs:
if [[ -e $TARBALL_PATH ]]; then
tar -xf $TARBALL_PATH
echo 'print(HermesInternal?.getRuntimeProperties?.()["OSS Release Version"])' > test.js
chmod +x ./destroot/bin/hermes
./destroot/bin/hermes test.js
rm test.js
rm -rf destroot
Expand Down
181 changes: 110 additions & 71 deletions .github/workflows/nightly.yml

Large diffs are not rendered by default.

181 changes: 110 additions & 71 deletions .github/workflows/publish-release.yml

Large diffs are not rendered by default.

183 changes: 108 additions & 75 deletions .github/workflows/test-all.yml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/community-cli-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"dist"
],
"dependencies": {
"@react-native-community/cli-server-api": "14.0.0-alpha.9",
"@react-native-community/cli-tools": "14.0.0-alpha.9",
"@react-native-community/cli-server-api": "14.0.0-alpha.11",
"@react-native-community/cli-tools": "14.0.0-alpha.11",
"@react-native/dev-middleware": "0.76.0-main",
"@react-native/metro-babel-transformer": "0.76.0-main",
"chalk": "^4.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@
},
"dependencies": {
"@jest/create-cache-key-function": "^29.6.3",
"@react-native-community/cli": "14.0.0-alpha.9",
"@react-native-community/cli-platform-android": "14.0.0-alpha.9",
"@react-native-community/cli-platform-ios": "14.0.0-alpha.9",
"@react-native-community/cli": "14.0.0-alpha.11",
"@react-native-community/cli-platform-android": "14.0.0-alpha.11",
"@react-native-community/cli-platform-ios": "14.0.0-alpha.11",
"@react-native/assets-registry": "0.76.0-main",
"@react-native/codegen": "0.76.0-main",
"@react-native/community-cli-plugin": "0.76.0-main",
Expand Down
78 changes: 69 additions & 9 deletions scripts/e2e/init-template-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

'use strict';

/*:: import type {ProjectInfo} from '../utils/monorepo'; */

const {retry} = require('../circleci/retry');
const {REPO_ROOT} = require('../consts');
const {getPackages} = require('../utils/monorepo');
Expand All @@ -22,12 +24,12 @@ const {
const {parseArgs} = require('@pkgjs/parseargs');
const chalk = require('chalk');
const {execSync} = require('child_process');
const fs = require('fs');
const path = require('path');

const config = {
options: {
projectName: {type: 'string'},
templatePath: {type: 'string'},
directory: {type: 'string'},
verbose: {type: 'boolean', default: false},
help: {type: 'boolean'},
Expand Down Expand Up @@ -56,10 +58,10 @@ async function main() {
should not be committed.

Options:
--projectName The name of the new React Native project.
--templatePath The absolute path to the folder containing the template.
--directory The absolute path to the target project directory.
--verbose Print additional output. Default: false.
--projectName The name of the new React Native project.
--directory The absolute path to the target project directory.
--pathToLocalReactNative The absolute path to the local react-native package.
--verbose Print additional output. Default: false.
`);
return;
}
Expand All @@ -74,10 +76,10 @@ async function main() {
async function initNewProjectFromSource(
{
projectName,
templatePath,
directory,
pathToLocalReactNative = null,
verbose = false,
} /*: {projectName: string, templatePath: string, directory: string, verbose?: boolean} */,
} /*: {projectName: string, directory: string, pathToLocalReactNative?: ?string, verbose?: boolean} */,
) {
console.log('Starting local npm proxy (Verdaccio)');
const verdaccioPid = setupVerdaccio();
Expand Down Expand Up @@ -117,9 +119,9 @@ async function initNewProjectFromSource(

console.log('Running react-native init without install');
execSync(
`node ./packages/react-native/cli.js init ${projectName} \
`npx @react-native-community/cli@next init ${projectName} \
--directory ${directory} \
--template ${templatePath} \
--version 0.75.0-rc.2 \
--verbose \
--pm npm \
--skip-install`,
Expand All @@ -131,6 +133,9 @@ async function initNewProjectFromSource(
);
console.log('\nDone ✅');

_updateScopedPackages(packages, directory);
_updateReactNativeInTemplateIfNeeded(pathToLocalReactNative, directory);

console.log('Installing project dependencies');
await installProjectUsingProxy(directory);
console.log('Done ✅');
Expand Down Expand Up @@ -169,6 +174,61 @@ async function installProjectUsingProxy(cwd /*: string */) {
}
}

function _updateScopedPackages(
packages /*: ProjectInfo */,
directory /*: string */,
) {
console.log(
'Updating the scoped packagesto match the version published in Verdaccio',
);

// Packages are updated in a lockstep and all with the same version.
// Pick the version from the first package
const version = packages[Object.keys(packages)[0]].packageJson.version;

// Update scoped packages which starts with @react-native
const appPackageJsonPath = path.join(directory, 'package.json');
const appPackageJson = JSON.parse(
fs.readFileSync(appPackageJsonPath, 'utf8'),
);

for (const [key, _] of Object.entries(appPackageJson.dependencies)) {
if (key.startsWith('@react-native')) {
appPackageJson.dependencies[key] = version;
}
}
for (const [key, _] of Object.entries(appPackageJson.devDependencies)) {
if (key.startsWith('@react-native')) {
appPackageJson.devDependencies[key] = version;
}
}

fs.writeFileSync(appPackageJsonPath, JSON.stringify(appPackageJson, null, 2));

console.log('Done ✅');
}

function _updateReactNativeInTemplateIfNeeded(
pathToLocalReactNative /*: ?string */,
directory /*: string */,
) {
if (pathToLocalReactNative != null) {
console.log('Updating the template version to local react-native');
// Update template version.
const appPackageJsonPath = path.join(directory, 'package.json');
const appPackageJson = JSON.parse(
fs.readFileSync(appPackageJsonPath, 'utf8'),
);
appPackageJson.dependencies['react-native'] =
`file:${pathToLocalReactNative}`;
fs.writeFileSync(
appPackageJsonPath,
JSON.stringify(appPackageJson, null, 2),
);
console.log('Done ✅');
}
}

module.exports = {
initNewProjectFromSource,
};
Expand Down
3 changes: 3 additions & 0 deletions scripts/objc-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ buildForTesting() {
}

runTestsOnly() {
# shellcheck disable=SC1091
source "$ROOT/scripts/.tests.env"
echo "[Testing] Running tests on $IOS_DEVICE for OS $IOS_TARGET_OS"
xcodebuild test \
-workspace RNTesterPods.xcworkspace \
-scheme RNTester \
Expand Down
31 changes: 5 additions & 26 deletions scripts/release-testing/test-e2e-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const {
launchPackagerInSeparateWindow,
maybeLaunchAndroidEmulator,
prepareArtifacts,
setupCircleCIArtifacts,
setupGHAArtifacts,
} = require('./utils/testing-utils');
const chalk = require('chalk');
Expand Down Expand Up @@ -78,7 +77,7 @@ const argv = yargs
* - @onReleaseBranch whether we are on a release branch or not
*/
async function testRNTesterIOS(
ciArtifacts /*: Unwrap<ReturnType<typeof setupCircleCIArtifacts>> */,
ciArtifacts /*: Unwrap<ReturnType<typeof setupGHAArtifacts>> */,
onReleaseBranch /*: boolean */,
) {
console.info(
Expand Down Expand Up @@ -130,7 +129,7 @@ async function testRNTesterIOS(
* - @circleCIArtifacts manager object to manage all the download of CircleCIArtifacts. If null, it will fallback not to use them.
*/
async function testRNTesterAndroid(
ciArtifacts /*: Unwrap<ReturnType<typeof setupCircleCIArtifacts>> */,
ciArtifacts /*: Unwrap<ReturnType<typeof setupGHAArtifacts>> */,
) {
maybeLaunchAndroidEmulator();

Expand Down Expand Up @@ -206,7 +205,7 @@ async function testRNTesterAndroid(
* - @onReleaseBranch whether we are on a release branch or not
*/
async function testRNTester(
circleCIArtifacts /*:Unwrap<ReturnType<typeof setupCircleCIArtifacts>> */,
circleCIArtifacts /*:Unwrap<ReturnType<typeof setupGHAArtifacts>> */,
onReleaseBranch /*: boolean */,
) {
// FIXME: make sure that the commands retains colors
Expand All @@ -225,7 +224,7 @@ async function testRNTester(
// === RNTestProject === //

async function testRNTestProject(
ciArtifacts /*: Unwrap<ReturnType<typeof setupCircleCIArtifacts>> */,
ciArtifacts /*: Unwrap<ReturnType<typeof setupGHAArtifacts>> */,
) {
console.info("We're going to test a fresh new RN project");

Expand All @@ -244,11 +243,6 @@ async function testRNTestProject(
const buildType = 'dry-run';

const reactNativePackagePath = `${REPO_ROOT}/packages/react-native`;
const templateRepoFolder = '/tmp/template';
const pathToTemplate = path.join(templateRepoFolder, 'template');

// Cleanup template clone folder
exec(`rm -rf ${templateRepoFolder}`);
const localNodeTGZPath = `${reactNativePackagePath}/react-native-${releaseVersion}.tgz`;

const mavenLocalPath =
Expand Down Expand Up @@ -286,21 +280,6 @@ async function testRNTestProject(
}
}

// Cloning the template repo
// TODO: handle versioning of the template to make sure that we are downloading the right version of
// the template, given a specific React Native version
exec(
`git clone https://github.com/react-native-community/template ${templateRepoFolder} --depth=1`,
);

// Update template version.
const appPackageJsonPath = path.join(pathToTemplate, 'package.json');
const appPackageJson = JSON.parse(
fs.readFileSync(appPackageJsonPath, 'utf8'),
);
appPackageJson.dependencies['react-native'] = `file:${newLocalNodeTGZ}`;
fs.writeFileSync(appPackageJsonPath, JSON.stringify(appPackageJson, null, 2));

pushd('/tmp/');

debug('Creating RNTestProject from template');
Expand All @@ -311,7 +290,7 @@ async function testRNTestProject(
await initNewProjectFromSource({
projectName: 'RNTestProject',
directory: '/tmp/RNTestProject',
templatePath: templateRepoFolder,
pathToLocalReactNative: newLocalNodeTGZ,
});

cd('RNTestProject');
Expand Down
2 changes: 1 addition & 1 deletion scripts/utils/monorepo.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export type PackageInfo = {
packageJson: PackageJson,
};

type ProjectInfo = {
export type ProjectInfo = {
[packageName: string]: PackageInfo,
};
*/
Expand Down
Loading