Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native Version Matrix CI #2673

Merged
merged 43 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
93633c2
Add clean 0.64.4 test app
krystofwoldrich Dec 5, 2022
93ff0a9
Move test app to folder named after the rn version
krystofwoldrich Dec 5, 2022
ac789fc
Rename test app to sample
krystofwoldrich Dec 5, 2022
172e52d
Add react native build job to ci
krystofwoldrich Dec 5, 2022
0a78cd6
Remove placeholder brackets from if condition of the build steps
krystofwoldrich Dec 5, 2022
1a7c869
Remove placeholder brackets from the end of conditions
krystofwoldrich Dec 5, 2022
56ba1aa
Add bracket to enclose legacy arch condition
krystofwoldrich Dec 5, 2022
cfba6ce
Add missing bracket to close build conditions
krystofwoldrich Dec 5, 2022
e89d844
Add pod install
krystofwoldrich Dec 6, 2022
bb02928
Add cancel previous workflow
krystofwoldrich Dec 6, 2022
80cffb5
Fixed derivedData dir
krystofwoldrich Dec 6, 2022
d183c82
Add rn-init patch, add sdk to the sample ci jobs
krystofwoldrich Dec 6, 2022
6f82109
Fix add yalc
krystofwoldrich Dec 6, 2022
3c8dc60
Merge remote-tracking branch 'origin/main' into rn-matrix-e2e-tests
krystofwoldrich Dec 6, 2022
7d5283b
Remove silent from patch
krystofwoldrich Dec 6, 2022
7e04ea0
Delete plain test app from the repo
krystofwoldrich Dec 6, 2022
808900c
Use rn diff repo af source of the plain rn app
krystofwoldrich Dec 6, 2022
eca6c1b
Use https for the rn diff repo
krystofwoldrich Dec 6, 2022
37fa1e2
Fix the test app cwd path
krystofwoldrich Dec 6, 2022
c50bc76
Fix patch relative path
krystofwoldrich Dec 6, 2022
3c10900
Add more rn versions
krystofwoldrich Dec 6, 2022
e6afe40
Revert "Add more rn versions"
krystofwoldrich Dec 6, 2022
2f034d4
Fix patch job name typo
krystofwoldrich Dec 6, 2022
25c9f22
Make patch tool verbose and allow larger diff
krystofwoldrich Dec 6, 2022
59d73a5
WIP! xcode patch
krystofwoldrich Dec 6, 2022
a859ec2
Finish xcode patch
krystofwoldrich Dec 7, 2022
dfe20a6
Fix the xcode project name
krystofwoldrich Dec 7, 2022
9877670
Add build type and new arch compatible rn version
krystofwoldrich Dec 7, 2022
491296f
Add shorted name to the rn matrix job
krystofwoldrich Dec 7, 2022
63c484b
Remove incompatible symbols script
krystofwoldrich Dec 7, 2022
9719ffb
Fix lint when multiple project are in the sub dirs
krystofwoldrich Dec 7, 2022
91500ea
Fix unescaped back slash in xcode patch
krystofwoldrich Dec 7, 2022
d776bb0
Use semver
krystofwoldrich Dec 8, 2022
538ef1d
Build only one architecture
krystofwoldrich Dec 9, 2022
a3dcd56
Refactor ios e2e build command to be more readable
krystofwoldrich Dec 9, 2022
212133a
Do not run e2e for contributors
krystofwoldrich Dec 9, 2022
7122e85
Remove new arch from v4 ci
krystofwoldrich Dec 9, 2022
4a8ddf3
Rename the test dir and add rn version repos to git ignore
krystofwoldrich Dec 9, 2022
5450f62
Merge branch 'main' into rn-matrix-e2e-tests
krystofwoldrich Dec 9, 2022
a03b28d
Revert "Do not run e2e for contributors"
krystofwoldrich Dec 9, 2022
0c74fb0
Add versions dir
krystofwoldrich Dec 9, 2022
fee50dc
Merge branch 'main' into rn-matrix-e2e-tests
krystofwoldrich Dec 9, 2022
877f2c5
Merge branch 'main' into rn-matrix-e2e-tests
krystofwoldrich Dec 19, 2022
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
10 changes: 10 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ module.exports = {
settings: {
version: 'detect', // React version. "detect" automatically picks the version you have installed.
},
ignorePatterns: [
'test/react-native/versions/*',
],
overrides: [
{
// Typescript Files
Expand Down Expand Up @@ -44,6 +47,13 @@ module.exports = {
'no-console': 'off',
},
},
{
// RN Versions Test Tools
files: ['test/react-native/*'],
parserOptions: {
ecmaVersion: 2017,
},
}
],
rules: {
// Bundle size isn't too much of an issue for React Native.
Expand Down
142 changes: 139 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

jobs:
cancel-previous-workflow:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # [email protected]
with:
access_token: ${{ github.token }}

device-test:
# Android emulator said to perform best with macos HAXM
runs-on: macos-latest
Expand Down Expand Up @@ -95,10 +103,26 @@ jobs:
else
mkdir -p DerivedData
defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES
buildArgs=('-destination' 'platform=iOS Simulator,name=${{ matrix.device }}' 'ONLY_ACTIVE_ARCH=yes' '-sdk' 'iphonesimulator${{ matrix.runtime }}' '-derivedDataPath' $(cd "DerivedData" ; pwd -P))
buildArgs=(
'-destination' 'platform=iOS Simulator,name=${{ matrix.device }}'
'ONLY_ACTIVE_ARCH=yes'
'-sdk' 'iphonesimulator${{ matrix.runtime }}'
'-derivedDataPath' $(cd "DerivedData" ; pwd -P)
)
echo "buildArgs = ${buildArgs[@]}"
xcodebuild -workspace sample.xcworkspace -configuration Release -scheme sample "${buildArgs[@]}" build
xcodebuild -project ../node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO "${buildArgs[@]}" build
xcodebuild \
-workspace sample.xcworkspace \
-configuration Release \
-scheme sample \
"${buildArgs[@]}" \
build
xcodebuild \
-project ../node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj \
-scheme WebDriverAgentRunner \
GCC_TREAT_WARNINGS_AS_ERRORS=0 \
COMPILER_INDEX_STORE_ENABLE=NO \
"${buildArgs[@]}" \
build
fi

- name: Start Appium Server
Expand Down Expand Up @@ -140,3 +164,115 @@ jobs:
path: |
./sample/*.log
./sample/*.png

react-native-build:
name: Build RN ${{ matrix.rn-version }} ${{ matrix.rn-architecture }} ${{ matrix.platform }} ${{ matrix.build-type }}
runs-on: macos-latest
env:
RN_DIFF_REPOSITORY: https://github.com/react-native-community/rn-diff-purge.git
strategy:
fail-fast: false # keeps matrix running if one fails
matrix:
rn-version: ['0.64.4', '0.70.6']
rn-architecture: ['legacy']
platform: ['android', 'ios']
build-type: ['dev', 'production']
include:
- platform: ios
runtime: '16.0'
device: 'iPhone 14'
# exclude all rn versions lower than 0.70.0 for new architecture
exclude:
- rn-version: '0.64.4'
rn-architecture: 'new'
steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'

- name: Setup JS Tools
run: yarn global add yalc semver

- name: NPM cache SDK
uses: actions/cache@v3
id: deps-cache
with:
path: node_modules
key: ${{ github.workflow }}-${{ github.job }}-npm-${{ hashFiles('yarn.lock') }}

- name: Install SDK JS Dependencies
if: steps.deps-cache.outputs['cache-hit'] != 'true'
run: yarn install

- name: Build SDK
run: yarn build

- name: Package SDK
run: yalc publish

- name: Download Plain RN ${{ matrix.rn-version }} App
working-directory: test/react-native/versions
run: git clone $RN_DIFF_REPOSITORY --branch release/${{ matrix.rn-version }} --single-branch ${{ matrix.rn-version }}

- name: Add SDK to App
working-directory: test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp
run: yalc add @sentry/react-native

- name: Install App JS Dependencies
working-directory: test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp
run: yarn install

- name: Install App Pods
if: matrix.platform == 'ios'
working-directory: test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp/ios
run: |
[[ "${{ matrix.build-type }}" == "production" ]] && ENABLE_PROD=1 || ENABLE_PROD=0
[[ "${{ matrix.rn-architecture }}" == "new" ]] && ENABLE_NEW_ARCH=1 || ENABLE_NEW_ARCH=0
echo "ENABLE_PROD=$ENABLE_PROD"
echo "ENABLE_NEW_ARCH=$ENABLE_NEW_ARCH"
PRODUCTION=$ENABLE_PROD RCT_NEW_ARCH_ENABLED=$ENABLE_NEW_ARCH pod install

- name: Patch App RN
working-directory: test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp
run: patch --verbose --strip=0 --force --ignore-whitespace --fuzz 4 < ../../../rn.patch

- name: Patch iOS App RN
if: matrix.platform == 'ios'
working-directory: test/react-native
run: |
./rn.patch.xcode.js \
--project 'versions/${{ matrix.rn-version }}/RnDiffApp/ios/RnDiffApp.xcodeproj/project.pbxproj' \
--rn-version '${{ matrix.rn-version }}'

- name: Build Android App
if: matrix.platform == 'android'
working-directory: test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp/android
run: |
if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
perl -i -pe's/newArchEnabled=false/newArchEnabled=true/g' gradle.properties
echo 'New Architecture enabled'
fi
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
echo "Building $CONFIG"
./gradlew ":app:assemble$CONFIG" -PreactNativeArchitectures=x86

- name: Build iOS App
if: matrix.platform == 'ios'
working-directory: test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp/ios
run: |
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
echo "Building $CONFIG"
derivedData="$(cd "DerivedData" ; pwd -P)"
mkdir -p "$derivedData"
xcodebuild \
-workspace RnDiffApp.xcworkspace \
-configuration "$CONFIG" \
-scheme RnDiffApp \
-destination 'platform=iOS Simulator,name=${{ matrix.device }}' \
ONLY_ACTIVE_ARCH=yes \
-sdk 'iphonesimulator${{ matrix.runtime }}' \
-derivedDataPath "$derivedData" \
build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,4 @@ sample/.vscode/.react/debuggerWorker.js

# E2E tests
sample/*.png
test/react-native/versions
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"build:tools": "tsc -p tsconfig.build.tools.json",
"clean": "rimraf dist coverage",
"test": "jest",
"lint": "eslint .",
"lint": "eslint --config .eslintrc.js .",
"test:watch": "jest --watch",
"run-ios": "cd sample && yarn react-native run-ios",
"run-android": "cd sample && yarn react-native run-android"
Expand Down
4 changes: 3 additions & 1 deletion sample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
"eslint": "^7.32.0",
"jest": "^29.3.1",
"metro-react-native-babel-preset": "0.73.3",
"webdriverio": "^7.26.0"
"minimist": "^1.2.7",
"webdriverio": "^7.26.0",
"xcode": "^3.0.1"
},
"name": "sample",
"private": true,
Expand Down
40 changes: 38 additions & 2 deletions sample/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3256,13 +3256,27 @@ [email protected]:
type-is "~1.6.18"
unpipe "1.0.0"

[email protected]:
version "0.1.0"
resolved "https://registry.yarnpkg.com/bplist-creator/-/bplist-creator-0.1.0.tgz#018a2d1b587f769e379ef5519103730f8963ba1e"
integrity sha512-sXaHZicyEEmY86WyueLTQesbeoH/mquvarJaQNbjuOQO+7gbFcDEWqKmcWA4cOTLzFlfgvkiVxolk1k5bBIpmg==
dependencies:
stream-buffers "2.2.x"

[email protected], bplist-creator@^0.x:
version "0.1.1"
resolved "https://registry.yarnpkg.com/bplist-creator/-/bplist-creator-0.1.1.tgz#ef638af058a7021e10ebfd557ffd73d95e6799fc"
integrity sha512-Ese7052fdWrxp/vqSJkydgx/1MdBnNOCV2XVfbmdGWD2H6EYza+Q4pyYSuVSnCUD22hfI/BFI4jHaC3NLXLlJQ==
dependencies:
stream-buffers "2.2.x"

[email protected]:
version "0.3.1"
resolved "https://registry.yarnpkg.com/bplist-parser/-/bplist-parser-0.3.1.tgz#e1c90b2ca2a9f9474cc72f6862bbf3fee8341fd1"
integrity sha512-PyJxiNtA5T2PlLIeBot4lbp7rj4OadzjnMZD/G5zuBNt8ei/yCU7+wW0h2bag9vr8c+/WuRWmSxbqAl9hL1rBA==
dependencies:
big-integer "1.6.x"

[email protected], bplist-parser@^0.x:
version "0.3.2"
resolved "https://registry.yarnpkg.com/bplist-parser/-/bplist-parser-0.3.2.tgz#3ac79d67ec52c4c107893e0237eb787cbacbced7"
Expand Down Expand Up @@ -7139,7 +7153,7 @@ minimatch@^5.0.0, minimatch@^5.0.1, minimatch@^5.1.0:
dependencies:
brace-expansion "^2.0.1"

minimist@^1.2.6:
minimist@^1.2.6, minimist@^1.2.7:
version "1.2.7"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18"
integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==
Expand Down Expand Up @@ -7783,7 +7797,7 @@ pkg-up@^3.1.0:
dependencies:
find-up "^3.0.0"

[email protected], plist@^3.0.1:
[email protected], plist@^3.0.1, plist@^3.0.5:
version "3.0.6"
resolved "https://registry.yarnpkg.com/plist/-/plist-3.0.6.tgz#7cfb68a856a7834bca6dbfe3218eb9c7740145d3"
integrity sha512-WiIVYyrp8TD4w8yCvyeIr+lkmrGRd5u0VbRnU+tP/aRLxP/YadJUYOMZJ/6hIa3oUyVCsycXvtNRgd5XBJIbiA==
Expand Down Expand Up @@ -8649,6 +8663,15 @@ signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7:
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==

simple-plist@^1.1.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/simple-plist/-/simple-plist-1.3.1.tgz#16e1d8f62c6c9b691b8383127663d834112fb017"
integrity sha512-iMSw5i0XseMnrhtIzRb7XpQEXepa9xhWxGUojHBL43SIpQuDQkh3Wpy67ZbDzZVr6EKxvwVChnVpdl8hEVLDiw==
dependencies:
bplist-creator "0.1.0"
bplist-parser "0.3.1"
plist "^3.0.5"

simple-swizzle@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a"
Expand Down Expand Up @@ -9405,6 +9428,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==

uuid@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.3.tgz#c5c9f2c8cf25dc0a372c4df1441c41f5bd0c680b"
integrity sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==

uuid@^9.0.0:
version "9.0.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"
Expand Down Expand Up @@ -9679,6 +9707,14 @@ ws@^8.0.0:
resolved "https://registry.yarnpkg.com/ws/-/ws-8.11.0.tgz#6a0d36b8edfd9f96d8b25683db2f8d7de6e8e143"
integrity sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==

xcode@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/xcode/-/xcode-3.0.1.tgz#3efb62aac641ab2c702458f9a0302696146aa53c"
integrity sha512-kCz5k7J7XbJtjABOvkc5lJmkiDh8VhjVCGNiqdKCscmVpdVUpEAyXv1xmCLkQJ5dsHqx3IPO4XW+NTDhU/fatA==
dependencies:
simple-plist "^1.1.0"
uuid "^7.0.3"

xhr@^2.0.1:
version "2.6.0"
resolved "https://registry.yarnpkg.com/xhr/-/xhr-2.6.0.tgz#b69d4395e792b4173d6b7df077f0fc5e4e2b249d"
Expand Down
44 changes: 44 additions & 0 deletions test/react-native/rn.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff -ruN App.js App.js
--- App.js 2022-12-06 11:42:35.000000000 +0100
+++ App.js 2022-12-06 11:45:09.000000000 +0100
@@ -26,6 +26,13 @@
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';

+import * as Sentry from '@sentry/react-native';
+
+Sentry.init({
+ dsn: 'https://[email protected]/5428561',
+});
+
+
const Section = ({children, title}): Node => {
const isDarkMode = useColorScheme() === 'dark';
return (
diff -ruN android/app/build.gradle android/app/build.gradle
--- android/app/build.gradle 2022-12-06 11:42:35.000000000 +0100
+++ android/app/build.gradle 2022-12-06 11:44:50.000000000 +0100
@@ -82,6 +82,7 @@
]

apply from: "../../node_modules/react-native/react.gradle"
+apply from: "../../node_modules/@sentry/react-native/sentry.gradle"

/**
* Set this to true to create two separate APKs instead of one:
diff -ruN android/sentry.properties android/sentry.properties
--- android/sentry.properties 1970-01-01 01:00:00.000000000 +0100
+++ android/sentry.properties 2022-12-06 11:45:37.000000000 +0100
@@ -0,0 +1,4 @@
+defaults.url=https://sentry.io/
+defaults.org=sentry-sdks
+defaults.project=sentry-react-native
+# auth.token=
diff -ruN ios/sentry.properties ios/sentry.properties
--- ios/sentry.properties 1970-01-01 01:00:00.000000000 +0100
+++ ios/sentry.properties 2022-12-06 11:45:31.000000000 +0100
@@ -0,0 +1,4 @@
+defaults.url=https://sentry.io/
+defaults.org=sentry-sdks
+defaults.project=sentry-react-native
+# auth.token=
Loading