Skip to content

Commit

Permalink
Test RN versions (#567)
Browse files Browse the repository at this point in the history
  • Loading branch information
CedricGuillemet authored Mar 10, 2023
1 parent 0fe3a4e commit eb60a86
Show file tree
Hide file tree
Showing 5 changed files with 201 additions and 0 deletions.
145 changes: 145 additions & 0 deletions .github/workflows/testVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
name: Test RN/BRN Version
on:
workflow_dispatch:
inputs:
RN_Version:
description: 'ReactNative Version'
required: true
type: string
default: '0.71.0'
BRN_Version:
description: 'BRN package version'
required: true
type: string
default: '1.5.3-preview'
BRN_Postfix:
description: 'BRN package postfix'
required: true
type: string
default: '0-71'

jobs:
build-windows:
runs-on: windows-2019
steps:
- name: Checkout Repo
uses: actions/[email protected]
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Build Playground Windows x64
run: |
npx react-native init Playground --version ${{ github.event.inputs.RN_Version }}
cp Apps/Playground/playground-shared/App.tsx ./Playground/App.tsx
cd Playground
npx react-native-windows-init --overwrite
npm install @babylonjs/core
npm install @babylonjs/loaders
npm install @babylonjs/react-native@${{ github.event.inputs.BRN_Version }}
npm install @babylonjs/react-native-iosandroid-${{ github.event.inputs.BRN_Postfix }}@${{ github.event.inputs.BRN_Version }}
npm install @react-native-community/slider
#npm install [email protected]
npx react-native autolink-windows
msbuild.exe /r "./windows/Playground.sln"
msbuild.exe /p:Configuration="Release" /p:Platform="x64" /m "./windows/Playground.sln"
- name: Upload UWP x64
uses: actions/upload-artifact@v2
with:
name: 'WindowsAppx'
path: Playground/windows/AppPackages/Playground/Playground_1.0.0.0_x64_Test/Playground_1.0.0.0_x64.appx

build-android:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/[email protected]
- name: Build Playground Android
run: |
npm uninstall -g react-native-cli @react-native-community/cli
npx react-native init Playground --version "${{ github.event.inputs.RN_Version }}" --verbose
cp Apps/Playground/playground-shared/App.tsx ./Playground/App.tsx
cd Playground
npm install @babylonjs/core
npm install @babylonjs/loaders
npm install @babylonjs/react-native@${{ github.event.inputs.BRN_Version }}
npm install @babylonjs/react-native-iosandroid-${{ github.event.inputs.BRN_Postfix }}@${{ github.event.inputs.BRN_Version }}
npm install @react-native-community/slider
cd android
./gradlew app:assembleRelease --stacktrace --info
- name: Upload APK
uses: actions/upload-artifact@v2
with:
name: 'AndroidAPK'
path: Playground/android/app/build/outputs/apk/release/app-release.apk

build-ios:
runs-on: macos-latest
steps:
- name: Checkout Repo
uses: actions/[email protected]
- name: Clone iOS Toolchain
run: |
git clone https://github.com/leetal/ios-cmake.git
- name: Build Playground iOS
run: |
brew install node
brew install watchman
npm uninstall -g react-native-cli @react-native-community/cli
npx react-native init Playground --version "${{ github.event.inputs.RN_Version }}" --verbose --skip-install
cp Apps/Playground/playground-shared/App.tsx ./Playground/App.tsx
cd Playground
yarn install
npm install @babylonjs/core
npm install @babylonjs/loaders
npm install @babylonjs/react-native@${{ github.event.inputs.BRN_Version }}
npm install @babylonjs/react-native-iosandroid-${{ github.event.inputs.BRN_Postfix }}@${{ github.event.inputs.BRN_Version }}
npm install @react-native-community/slider
cd ios
pod install
#xcodebuild -sdk iphoneos -configuration Release -workspace Playground.xcworkspace -scheme Playground build CODE_SIGNING_ALLOWED=NO
xcodebuild -sdk iphonesimulator -arch x86_64 -configuration Release -workspace Playground.xcworkspace -scheme Playground build CODE_SIGNING_ALLOWED=NO -archivePath ./playgroundSimulator.xcarchive archive
- name: Upload iOS App
uses: actions/upload-artifact@v2
with:
name: 'iOSApp'
path: Playground/ios/playgroundSimulator.xcarchive

# test jobs not working
# test-android:
# needs: [build-android]
# runs-on: macos-latest
# steps:
# - name: Download APK
# uses: actions/download-artifact@v2
# with:
# name: 'AndroidAPK'
# path: ./
# - name: Install Android Emulator
# run: |
# echo Install Android image
# echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install "system-images;android-27;default;x86_64"
# echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --licenses
# echo Create AVD
# $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_27 -d pixel -k "system-images;android-27;default;x86_64"
#
# - name: Start emulator
# run: |
# echo Start emulator
# nohup $ANDROID_HOME/emulator/emulator -avd Pixel_API_27 -gpu host -no-audio -no-boot-anim -camera-back none -camera-front none -qemu -m 2048 2>&1 &
# echo Wait for emulator
# adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do echo "."; sleep 1; done; input keyevent 82'
# adb devices
# adb install -t ./app-release.apk
# echo APK installation done.
# adb wait-for-device shell am start -n com.playground/com.playground.MainActivity
# echo Activity started.
# adb wait-for-device shell pidof com.playground
# echo Activity PID
# adb wait-for-device shell while [[ -z $(pidof com.playground | tr -d "\r") ]]; do echo "."; sleep 1; done; input keyevent 82
# echo Activity is running. Waiting 10s.
# sleep 10
# echo Checking it's still alive
# if [[ -z "$(pidof com.playground | tr -d '\r')" ]]; then echo "com.playground is not running."; exit 1; fi
# echo Checks done.
Binary file added Documentation/Images/downloadArtifact.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/Images/publishPreview.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/Images/testVersion.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions Documentation/TestingPackages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Testing BabylonReactNative Packages

Building and testing on every platform can be time consuming.
Moreover, it's pretty common to not have all the tools and/or build platforms.
For easier and faster development, it's possible to test an existing NPM package against a version of ReactNative.

- For new feature/dependencies update and you want a quick test to verify it's still working
- Test an existing BRN NPM package against a new React-Native release

## Releasing preview package

To release a new .APK with the `Publish Package for Preview` Github Action.
Select a branch on the main repo, the NPM version with the `-preview` name and Run Workflow.
![Preview](./Images/publishPreview.jpg)

## Building Apps for Windows, Android and iOS

The `Test RN/BRN version` will create a sample playground using the intended React-Native version and with the Babylon React Native version specified in the parameters.

![Preview](./Images/testVersion.jpg)

After some time (around 1hour), test packages are available for Windows, Android, iOS.

![Preview](./Images/downloadArtifact.jpg)

### Testing on Windows

Download and unzip Appx artifact. There is an installer inside named:
```
Playground_1.0.0.0_x64.appx
```

Run it and application should be installed and can then be tested.

### Testing on iOS

Download and unzip iOSApp. It constains an `.xcarchive`.
Boot up the simulator with an iOS image. When it's ready, open a terminal and type this command:
```
xcrun simctl install booted Path_to_the_xcarchive/Products/Applications/Playground
```
After a few seconds, the application icon should be visible in the dashboard.
Tap to run.

### Testing on Android

Download and unzip AndroidAPK. It constains an `app-release.apk`.
With `abd`, install the application from a terminal:
```
adb install path_to/app-release.apk
```
Then, run the app with:
```
adb shell am start -n com.playground/.MainActivity
```

0 comments on commit eb60a86

Please sign in to comment.