Skip to content
Merged
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
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down Expand Up @@ -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

Expand All @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down Expand Up @@ -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"
Expand Down
129 changes: 129 additions & 0 deletions scripts/test-matrix.sh
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down