diff --git a/README.md b/README.md index e7aee3832..f7a0f24a4 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,15 @@ - [Migrate an Existing Test App](https://github.com/microsoft/react-native-test-app/wiki/Migrate-an-Existing-Test-App) - [Known Issues](#known-issues) -React Native Test App (RNTA) provides test apps for all platforms as a package. It -handles the native bits for you so you can focus on what's important: your +React Native Test App (RNTA) provides test apps for all platforms as a package. +It handles the native bits for you so you can focus on what's important: your product. If you want to learn how RNTA is used at Microsoft, and see a demo of how to add it to an existing library - you can watch the ["Improve all the repos – exploring Microsoft’s DevExp"](https://youtu.be/DAEnPV78rQc?t=499) -talk by [@kelset](https://github.com/kelset) and [@tido64](https://github.com/tido64) from React Native Europe 2021. +talk by [@kelset](https://github.com/kelset) and +[@tido64](https://github.com/tido64) from React Native Europe 2021. In the wiki, you can read more about [the motivation](https://github.com/microsoft/react-native-test-app/wiki#motivation) @@ -25,7 +26,8 @@ of this tool. ## Quick Start -*If you want to migrate an existing test app for a library, follow the [dedicated guide in the wiki](https://github.com/microsoft/react-native-test-app/wiki/Migrate-an-Existing-Test-App).* +_If you want to migrate an existing test app for a library, follow the +[dedicated guide in the wiki](https://github.com/microsoft/react-native-test-app/wiki/Migrate-an-Existing-Test-App)._ Install `react-native-test-app` as a dev dependency. We will use the wizard to generate your test app: @@ -60,7 +62,9 @@ cd sample yarn ``` -Once the dependencies are installed, follow the [platform specific instructions](https://github.com/microsoft/react-native-test-app/wiki/Quick-Start#platform-specific-instructions) in the wiki. +Once the dependencies are installed, follow the +[platform specific instructions](https://github.com/microsoft/react-native-test-app/wiki/Quick-Start#platform-specific-instructions) +in the wiki. ## Configuring the Test App @@ -81,7 +85,8 @@ For a list of known issues and workarounds, please refer to the ## Contributing -Thank you for your interest in this project! We welcome all contributions and suggestions! +Thank you for your interest in this project! We welcome all contributions and +suggestions! Take a look at [CONTRIBUTING.md](CONTRIBUTING.md) for details. diff --git a/example/package.json b/example/package.json index 0c7accb0d..4417408d4 100644 --- a/example/package.json +++ b/example/package.json @@ -17,8 +17,8 @@ "windows": "react-native run-windows --no-packager" }, "peerDependencies": { - "react": "~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2 || ~18.0.0", - "react-native": "^0.0.0-0 || 0.62 - 0.69 || 1000.0.0", + "react": "~16.11.0 || ~16.13.1 || ~17.0.1 || ~18.0.0 || ~18.1.0", + "react-native": "^0.0.0-0 || 0.62 - 0.70 || 1000.0.0", "react-native-macos": "^0.0.0-0 || 0.62 - 0.64 || ^0.66 || ^0.68", "react-native-windows": "^0.0.0-0 || 0.62 - 0.69" }, diff --git a/package.json b/package.json index 25391879b..d09b36728 100644 --- a/package.json +++ b/package.json @@ -79,8 +79,8 @@ "@react-native-community/cli-platform-android": ">=4.10.0", "@react-native-community/cli-platform-ios": ">=4.10.0", "mustache": "^4.0.0", - "react": "~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2 || ~18.0.0", - "react-native": "^0.0.0-0 || 0.62 - 0.69 || 1000.0.0", + "react": "~16.11.0 || ~16.13.1 || ~17.0.1 || ~18.0.0 || ~18.1.0", + "react-native": "^0.0.0-0 || 0.62 - 0.70 || 1000.0.0", "react-native-macos": "^0.0.0-0 || 0.62 - 0.64 || ^0.66 || ^0.68", "react-native-windows": "^0.0.0-0 || 0.62 - 0.69" }, @@ -137,9 +137,7 @@ "resolutions": { "@commitlint/is-ignored/semver": "^7.3.5", "@microsoft/eslint-plugin-sdl/eslint-plugin-react": "^7.26.0", - "@react-native-community/cli-tools/shell-quote": "^1.7.3", - "core-js-compat/semver": "^7.3.5", - "npm/chalk": "^4.1.0" + "core-js-compat/semver": "^7.3.5" }, "workspaces": [ "example" diff --git a/scripts/test-matrix.sh b/scripts/test-matrix.sh new file mode 100755 index 000000000..51912c666 --- /dev/null +++ b/scripts/test-matrix.sh @@ -0,0 +1,129 @@ +#!/bin/bash +set -eo pipefail + +PACKAGE_MANAGER=yarn +VERSION=${1} + +function pod_install { + rm -fr $1/Podfile.lock $1/Pods + pod install --project-directory=$1 +} + +function prepare { + terminate_dev_server + git checkout . + npm run set-react-version ${VERSION} + npm run clean + ${PACKAGE_MANAGER} install + pushd example 1> /dev/null + start_dev_server +} + +function start_dev_server { + echo "*** Starting Metro dev server in the background (logs go to '$(pwd)/metro.server.log')" + yarn start &> metro.server.log & +} + +function terminate_dev_server { + [[ -z "$(jobs -p)" ]] || kill $(jobs -p) +} + +function wait_for_user { + echo + if [[ -n "$1" ]]; then + echo "*** $1 ***" + echo + fi + read -n 1 -r -s -p "Press any key to continue..." + echo +} + +trap terminate_dev_server EXIT + +if command -v ccache 1> /dev/null; then + export USE_CCACHE=1 + export ANDROID_CCACHE=$(which ccache) + export CCACHE_DIR=$HOME/.cache/ccache + export PATH=$(dirname $(dirname $ANDROID_CCACHE))/opt/ccache/libexec:$PATH + mkdir -p $CCACHE_DIR +fi + +pushd $(git rev-parse --show-toplevel) 1> /dev/null +prepare + +echo +echo "┌─────────────────┐" +echo "│ Build Android │" +echo "└─────────────────┘" +echo + +npm run android -- --no-packager +wait_for_user "Android app is ready for testing" + +echo +echo "┌─────────────┐" +echo "│ Build iOS │" +echo "└─────────────┘" +echo + +pod_install ios +npm run ios -- --no-packager +wait_for_user "iOS app is ready for testing" + +echo +echo "┌─────────────────────────┐" +echo "│ Build iOS with Hermes │" +echo "└─────────────────────────┘" +echo + +sed -i '' 's/:hermes_enabled => false/:hermes_enabled => true/' ios/Podfile +pod_install ios +npm run ios -- --no-packager +wait_for_user "iOS app with Hermes is ready for testing" + +echo +echo "┌──────────────────────────────┐" +echo "│ Clean up for Fabric builds │" +echo "└──────────────────────────────┘" +echo + +popd 1> /dev/null +prepare + +echo +echo "┌─────────────────────────────┐" +echo "│ Build Android with Fabric │" +echo "└─────────────────────────────┘" +echo + +sed -i '' 's/#newArchEnabled=true/newArchEnabled=true/' android/gradle.properties +pushd android 1> /dev/null +# Due to a bug in Gradle, we need to run this task separately +./gradlew packageReactNdkDebugLibs +popd 1> /dev/null +npm run android -- --no-packager +wait_for_user "Android app with Fabric is ready for testing" + +echo +echo "┌─────────────────────────┐" +echo "│ Build iOS with Fabric │" +echo "└─────────────────────────┘" +echo + +sed -i '' 's/:turbomodule_enabled => false/:turbomodule_enabled => true/' ios/Podfile +pod_install ios +npm run ios -- --no-packager +wait_for_user "iOS app with Fabric is ready for testing" + +echo +echo "┌──────────────────────────────────┐" +echo "│ Build iOS with Fabric + Hermes │" +echo "└──────────────────────────────────┘" +echo + +sed -i '' 's/:hermes_enabled => false/:hermes_enabled => true/' ios/Podfile +pod_install ios +npm run ios -- --no-packager +wait_for_user "iOS app with Fabric + Hermes is ready for testing" + +popd 1> /dev/null diff --git a/yarn.lock b/yarn.lock index b979e1544..ffc707e52 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5578,8 +5578,8 @@ __metadata: react-native-test-app: "workspace:." react-native-windows: ^0.68.8 peerDependencies: - react: ~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2 || ~18.0.0 - react-native: ^0.0.0-0 || 0.62 - 0.69 || 1000.0.0 + react: ~16.11.0 || ~16.13.1 || ~17.0.1 || ~18.0.0 || ~18.1.0 + react-native: ^0.0.0-0 || 0.62 - 0.70 || 1000.0.0 react-native-macos: ^0.0.0-0 || 0.62 - 0.64 || ^0.66 || ^0.68 react-native-windows: ^0.0.0-0 || 0.62 - 0.69 languageName: unknown @@ -10816,8 +10816,8 @@ fsevents@^2.3.2: "@react-native-community/cli-platform-android": ">=4.10.0" "@react-native-community/cli-platform-ios": ">=4.10.0" mustache: ^4.0.0 - react: ~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2 || ~18.0.0 - react-native: ^0.0.0-0 || 0.62 - 0.69 || 1000.0.0 + react: ~16.11.0 || ~16.13.1 || ~17.0.1 || ~18.0.0 || ~18.1.0 + react-native: ^0.0.0-0 || 0.62 - 0.70 || 1000.0.0 react-native-macos: ^0.0.0-0 || 0.62 - 0.64 || ^0.66 || ^0.68 react-native-windows: ^0.0.0-0 || 0.62 - 0.69 peerDependenciesMeta: