Skip to content

Commit eb60a86

Browse files
Test RN versions (#567)
1 parent 0fe3a4e commit eb60a86

5 files changed

Lines changed: 201 additions & 0 deletions

File tree

.github/workflows/testVersion.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: Test RN/BRN Version
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
RN_Version:
6+
description: 'ReactNative Version'
7+
required: true
8+
type: string
9+
default: '0.71.0'
10+
BRN_Version:
11+
description: 'BRN package version'
12+
required: true
13+
type: string
14+
default: '1.5.3-preview'
15+
BRN_Postfix:
16+
description: 'BRN package postfix'
17+
required: true
18+
type: string
19+
default: '0-71'
20+
21+
jobs:
22+
build-windows:
23+
runs-on: windows-2019
24+
steps:
25+
- name: Checkout Repo
26+
uses: actions/checkout@v2.3.3
27+
- name: Add msbuild to PATH
28+
uses: microsoft/setup-msbuild@v1.1
29+
- name: Build Playground Windows x64
30+
run: |
31+
npx react-native init Playground --version ${{ github.event.inputs.RN_Version }}
32+
cp Apps/Playground/playground-shared/App.tsx ./Playground/App.tsx
33+
cd Playground
34+
npx react-native-windows-init --overwrite
35+
npm install @babylonjs/core
36+
npm install @babylonjs/loaders
37+
npm install @babylonjs/react-native@${{ github.event.inputs.BRN_Version }}
38+
npm install @babylonjs/react-native-iosandroid-${{ github.event.inputs.BRN_Postfix }}@${{ github.event.inputs.BRN_Version }}
39+
npm install @react-native-community/slider
40+
#npm install react-native-permissions@3.0.0
41+
npx react-native autolink-windows
42+
msbuild.exe /r "./windows/Playground.sln"
43+
msbuild.exe /p:Configuration="Release" /p:Platform="x64" /m "./windows/Playground.sln"
44+
45+
- name: Upload UWP x64
46+
uses: actions/upload-artifact@v2
47+
with:
48+
name: 'WindowsAppx'
49+
path: Playground/windows/AppPackages/Playground/Playground_1.0.0.0_x64_Test/Playground_1.0.0.0_x64.appx
50+
51+
build-android:
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Checkout Repo
55+
uses: actions/checkout@v2.3.3
56+
- name: Build Playground Android
57+
run: |
58+
npm uninstall -g react-native-cli @react-native-community/cli
59+
npx react-native init Playground --version "${{ github.event.inputs.RN_Version }}" --verbose
60+
cp Apps/Playground/playground-shared/App.tsx ./Playground/App.tsx
61+
cd Playground
62+
npm install @babylonjs/core
63+
npm install @babylonjs/loaders
64+
npm install @babylonjs/react-native@${{ github.event.inputs.BRN_Version }}
65+
npm install @babylonjs/react-native-iosandroid-${{ github.event.inputs.BRN_Postfix }}@${{ github.event.inputs.BRN_Version }}
66+
npm install @react-native-community/slider
67+
cd android
68+
./gradlew app:assembleRelease --stacktrace --info
69+
70+
- name: Upload APK
71+
uses: actions/upload-artifact@v2
72+
with:
73+
name: 'AndroidAPK'
74+
path: Playground/android/app/build/outputs/apk/release/app-release.apk
75+
76+
build-ios:
77+
runs-on: macos-latest
78+
steps:
79+
- name: Checkout Repo
80+
uses: actions/checkout@v2.3.3
81+
- name: Clone iOS Toolchain
82+
run: |
83+
git clone https://github.com/leetal/ios-cmake.git
84+
- name: Build Playground iOS
85+
run: |
86+
brew install node
87+
brew install watchman
88+
npm uninstall -g react-native-cli @react-native-community/cli
89+
npx react-native init Playground --version "${{ github.event.inputs.RN_Version }}" --verbose --skip-install
90+
cp Apps/Playground/playground-shared/App.tsx ./Playground/App.tsx
91+
cd Playground
92+
yarn install
93+
npm install @babylonjs/core
94+
npm install @babylonjs/loaders
95+
npm install @babylonjs/react-native@${{ github.event.inputs.BRN_Version }}
96+
npm install @babylonjs/react-native-iosandroid-${{ github.event.inputs.BRN_Postfix }}@${{ github.event.inputs.BRN_Version }}
97+
npm install @react-native-community/slider
98+
cd ios
99+
pod install
100+
#xcodebuild -sdk iphoneos -configuration Release -workspace Playground.xcworkspace -scheme Playground build CODE_SIGNING_ALLOWED=NO
101+
xcodebuild -sdk iphonesimulator -arch x86_64 -configuration Release -workspace Playground.xcworkspace -scheme Playground build CODE_SIGNING_ALLOWED=NO -archivePath ./playgroundSimulator.xcarchive archive
102+
103+
- name: Upload iOS App
104+
uses: actions/upload-artifact@v2
105+
with:
106+
name: 'iOSApp'
107+
path: Playground/ios/playgroundSimulator.xcarchive
108+
109+
# test jobs not working
110+
# test-android:
111+
# needs: [build-android]
112+
# runs-on: macos-latest
113+
# steps:
114+
# - name: Download APK
115+
# uses: actions/download-artifact@v2
116+
# with:
117+
# name: 'AndroidAPK'
118+
# path: ./
119+
# - name: Install Android Emulator
120+
# run: |
121+
# echo Install Android image
122+
# echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install "system-images;android-27;default;x86_64"
123+
# echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --licenses
124+
# echo Create AVD
125+
# $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_27 -d pixel -k "system-images;android-27;default;x86_64"
126+
#
127+
# - name: Start emulator
128+
# run: |
129+
# echo Start emulator
130+
# 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 &
131+
# echo Wait for emulator
132+
# adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do echo "."; sleep 1; done; input keyevent 82'
133+
# adb devices
134+
# adb install -t ./app-release.apk
135+
# echo APK installation done.
136+
# adb wait-for-device shell am start -n com.playground/com.playground.MainActivity
137+
# echo Activity started.
138+
# adb wait-for-device shell pidof com.playground
139+
# echo Activity PID
140+
# adb wait-for-device shell while [[ -z $(pidof com.playground | tr -d "\r") ]]; do echo "."; sleep 1; done; input keyevent 82
141+
# echo Activity is running. Waiting 10s.
142+
# sleep 10
143+
# echo Checking it's still alive
144+
# if [[ -z "$(pidof com.playground | tr -d '\r')" ]]; then echo "com.playground is not running."; exit 1; fi
145+
# echo Checks done.
39.7 KB
Loading
125 KB
Loading
139 KB
Loading

Documentation/TestingPackages.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Testing BabylonReactNative Packages
2+
3+
Building and testing on every platform can be time consuming.
4+
Moreover, it's pretty common to not have all the tools and/or build platforms.
5+
For easier and faster development, it's possible to test an existing NPM package against a version of ReactNative.
6+
7+
- For new feature/dependencies update and you want a quick test to verify it's still working
8+
- Test an existing BRN NPM package against a new React-Native release
9+
10+
## Releasing preview package
11+
12+
To release a new .APK with the `Publish Package for Preview` Github Action.
13+
Select a branch on the main repo, the NPM version with the `-preview` name and Run Workflow.
14+
![Preview](./Images/publishPreview.jpg)
15+
16+
## Building Apps for Windows, Android and iOS
17+
18+
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.
19+
20+
![Preview](./Images/testVersion.jpg)
21+
22+
After some time (around 1hour), test packages are available for Windows, Android, iOS.
23+
24+
![Preview](./Images/downloadArtifact.jpg)
25+
26+
### Testing on Windows
27+
28+
Download and unzip Appx artifact. There is an installer inside named:
29+
```
30+
Playground_1.0.0.0_x64.appx
31+
```
32+
33+
Run it and application should be installed and can then be tested.
34+
35+
### Testing on iOS
36+
37+
Download and unzip iOSApp. It constains an `.xcarchive`.
38+
Boot up the simulator with an iOS image. When it's ready, open a terminal and type this command:
39+
```
40+
xcrun simctl install booted Path_to_the_xcarchive/Products/Applications/Playground
41+
```
42+
After a few seconds, the application icon should be visible in the dashboard.
43+
Tap to run.
44+
45+
### Testing on Android
46+
47+
Download and unzip AndroidAPK. It constains an `app-release.apk`.
48+
With `abd`, install the application from a terminal:
49+
```
50+
adb install path_to/app-release.apk
51+
```
52+
Then, run the app with:
53+
```
54+
adb shell am start -n com.playground/.MainActivity
55+
```
56+

0 commit comments

Comments
 (0)