Skip to content

Commit d8bb1e6

Browse files
React Native Version Matrix CI (#2673)
1 parent 78b177d commit d8bb1e6

File tree

9 files changed

+350
-7
lines changed

9 files changed

+350
-7
lines changed

.eslintrc.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ module.exports = {
1212
settings: {
1313
version: 'detect', // React version. "detect" automatically picks the version you have installed.
1414
},
15+
ignorePatterns: [
16+
'test/react-native/versions/*',
17+
],
1518
overrides: [
1619
{
1720
// Typescript Files
@@ -44,6 +47,13 @@ module.exports = {
4447
'no-console': 'off',
4548
},
4649
},
50+
{
51+
// RN Versions Test Tools
52+
files: ['test/react-native/*'],
53+
parserOptions: {
54+
ecmaVersion: 2017,
55+
},
56+
}
4757
],
4858
rules: {
4959
// Bundle size isn't too much of an issue for React Native.

.github/workflows/e2e.yml

Lines changed: 139 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ env:
99
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
1010

1111
jobs:
12+
cancel-previous-workflow:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Cancel Previous Runs
16+
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # [email protected]
17+
with:
18+
access_token: ${{ github.token }}
19+
1220
device-test:
1321
# Android emulator said to perform best with macos HAXM
1422
runs-on: macos-latest
@@ -95,10 +103,26 @@ jobs:
95103
else
96104
mkdir -p DerivedData
97105
defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES
98-
buildArgs=('-destination' 'platform=iOS Simulator,name=${{ matrix.device }}' 'ONLY_ACTIVE_ARCH=yes' '-sdk' 'iphonesimulator${{ matrix.runtime }}' '-derivedDataPath' $(cd "DerivedData" ; pwd -P))
106+
buildArgs=(
107+
'-destination' 'platform=iOS Simulator,name=${{ matrix.device }}'
108+
'ONLY_ACTIVE_ARCH=yes'
109+
'-sdk' 'iphonesimulator${{ matrix.runtime }}'
110+
'-derivedDataPath' $(cd "DerivedData" ; pwd -P)
111+
)
99112
echo "buildArgs = ${buildArgs[@]}"
100-
xcodebuild -workspace sample.xcworkspace -configuration Release -scheme sample "${buildArgs[@]}" build
101-
xcodebuild -project ../node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO "${buildArgs[@]}" build
113+
xcodebuild \
114+
-workspace sample.xcworkspace \
115+
-configuration Release \
116+
-scheme sample \
117+
"${buildArgs[@]}" \
118+
build
119+
xcodebuild \
120+
-project ../node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj \
121+
-scheme WebDriverAgentRunner \
122+
GCC_TREAT_WARNINGS_AS_ERRORS=0 \
123+
COMPILER_INDEX_STORE_ENABLE=NO \
124+
"${buildArgs[@]}" \
125+
build
102126
fi
103127
104128
- name: Start Appium Server
@@ -140,3 +164,115 @@ jobs:
140164
path: |
141165
./sample/*.log
142166
./sample/*.png
167+
168+
react-native-build:
169+
name: Build RN ${{ matrix.rn-version }} ${{ matrix.rn-architecture }} ${{ matrix.platform }} ${{ matrix.build-type }}
170+
runs-on: macos-latest
171+
env:
172+
RN_DIFF_REPOSITORY: https://github.com/react-native-community/rn-diff-purge.git
173+
strategy:
174+
fail-fast: false # keeps matrix running if one fails
175+
matrix:
176+
rn-version: ['0.64.4', '0.70.6']
177+
rn-architecture: ['legacy']
178+
platform: ['android', 'ios']
179+
build-type: ['dev', 'production']
180+
include:
181+
- platform: ios
182+
runtime: '16.0'
183+
device: 'iPhone 14'
184+
# exclude all rn versions lower than 0.70.0 for new architecture
185+
exclude:
186+
- rn-version: '0.64.4'
187+
rn-architecture: 'new'
188+
steps:
189+
- uses: actions/checkout@v3
190+
191+
- uses: actions/setup-java@v3
192+
with:
193+
java-version: '11'
194+
distribution: 'adopt'
195+
196+
- name: Setup JS Tools
197+
run: yarn global add yalc semver
198+
199+
- name: NPM cache SDK
200+
uses: actions/cache@v3
201+
id: deps-cache
202+
with:
203+
path: node_modules
204+
key: ${{ github.workflow }}-${{ github.job }}-npm-${{ hashFiles('yarn.lock') }}
205+
206+
- name: Install SDK JS Dependencies
207+
if: steps.deps-cache.outputs['cache-hit'] != 'true'
208+
run: yarn install
209+
210+
- name: Build SDK
211+
run: yarn build
212+
213+
- name: Package SDK
214+
run: yalc publish
215+
216+
- name: Download Plain RN ${{ matrix.rn-version }} App
217+
working-directory: test/react-native/versions
218+
run: git clone $RN_DIFF_REPOSITORY --branch release/${{ matrix.rn-version }} --single-branch ${{ matrix.rn-version }}
219+
220+
- name: Add SDK to App
221+
working-directory: test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp
222+
run: yalc add @sentry/react-native
223+
224+
- name: Install App JS Dependencies
225+
working-directory: test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp
226+
run: yarn install
227+
228+
- name: Install App Pods
229+
if: matrix.platform == 'ios'
230+
working-directory: test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp/ios
231+
run: |
232+
[[ "${{ matrix.build-type }}" == "production" ]] && ENABLE_PROD=1 || ENABLE_PROD=0
233+
[[ "${{ matrix.rn-architecture }}" == "new" ]] && ENABLE_NEW_ARCH=1 || ENABLE_NEW_ARCH=0
234+
echo "ENABLE_PROD=$ENABLE_PROD"
235+
echo "ENABLE_NEW_ARCH=$ENABLE_NEW_ARCH"
236+
PRODUCTION=$ENABLE_PROD RCT_NEW_ARCH_ENABLED=$ENABLE_NEW_ARCH pod install
237+
238+
- name: Patch App RN
239+
working-directory: test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp
240+
run: patch --verbose --strip=0 --force --ignore-whitespace --fuzz 4 < ../../../rn.patch
241+
242+
- name: Patch iOS App RN
243+
if: matrix.platform == 'ios'
244+
working-directory: test/react-native
245+
run: |
246+
./rn.patch.xcode.js \
247+
--project 'versions/${{ matrix.rn-version }}/RnDiffApp/ios/RnDiffApp.xcodeproj/project.pbxproj' \
248+
--rn-version '${{ matrix.rn-version }}'
249+
250+
- name: Build Android App
251+
if: matrix.platform == 'android'
252+
working-directory: test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp/android
253+
run: |
254+
if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
255+
perl -i -pe's/newArchEnabled=false/newArchEnabled=true/g' gradle.properties
256+
echo 'New Architecture enabled'
257+
fi
258+
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
259+
echo "Building $CONFIG"
260+
./gradlew ":app:assemble$CONFIG" -PreactNativeArchitectures=x86
261+
262+
- name: Build iOS App
263+
if: matrix.platform == 'ios'
264+
working-directory: test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp/ios
265+
run: |
266+
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
267+
echo "Building $CONFIG"
268+
derivedData="$(cd "DerivedData" ; pwd -P)"
269+
mkdir -p "$derivedData"
270+
xcodebuild \
271+
-workspace RnDiffApp.xcworkspace \
272+
-configuration "$CONFIG" \
273+
-scheme RnDiffApp \
274+
-destination 'platform=iOS Simulator,name=${{ matrix.device }}' \
275+
ONLY_ACTIVE_ARCH=yes \
276+
-sdk 'iphonesimulator${{ matrix.runtime }}' \
277+
-derivedDataPath "$derivedData" \
278+
build

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,4 @@ sample/.vscode/.react/debuggerWorker.js
7878

7979
# E2E tests
8080
sample/*.png
81+
test/react-native/versions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"build:tools": "tsc -p tsconfig.build.tools.json",
1818
"clean": "rimraf dist coverage",
1919
"test": "jest",
20-
"lint": "eslint .",
20+
"lint": "eslint --config .eslintrc.js .",
2121
"test:watch": "jest --watch",
2222
"run-ios": "cd sample && yarn react-native run-ios",
2323
"run-android": "cd sample && yarn react-native run-android"

sample/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
"eslint": "^7.32.0",
2626
"jest": "^29.3.1",
2727
"metro-react-native-babel-preset": "0.73.3",
28-
"webdriverio": "^7.26.0"
28+
"minimist": "^1.2.7",
29+
"webdriverio": "^7.26.0",
30+
"xcode": "^3.0.1"
2931
},
3032
"name": "sample",
3133
"private": true,

sample/yarn.lock

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3256,13 +3256,27 @@ [email protected]:
32563256
type-is "~1.6.18"
32573257
unpipe "1.0.0"
32583258

3259+
3260+
version "0.1.0"
3261+
resolved "https://registry.yarnpkg.com/bplist-creator/-/bplist-creator-0.1.0.tgz#018a2d1b587f769e379ef5519103730f8963ba1e"
3262+
integrity sha512-sXaHZicyEEmY86WyueLTQesbeoH/mquvarJaQNbjuOQO+7gbFcDEWqKmcWA4cOTLzFlfgvkiVxolk1k5bBIpmg==
3263+
dependencies:
3264+
stream-buffers "2.2.x"
3265+
32593266
[email protected], bplist-creator@^0.x:
32603267
version "0.1.1"
32613268
resolved "https://registry.yarnpkg.com/bplist-creator/-/bplist-creator-0.1.1.tgz#ef638af058a7021e10ebfd557ffd73d95e6799fc"
32623269
integrity sha512-Ese7052fdWrxp/vqSJkydgx/1MdBnNOCV2XVfbmdGWD2H6EYza+Q4pyYSuVSnCUD22hfI/BFI4jHaC3NLXLlJQ==
32633270
dependencies:
32643271
stream-buffers "2.2.x"
32653272

3273+
3274+
version "0.3.1"
3275+
resolved "https://registry.yarnpkg.com/bplist-parser/-/bplist-parser-0.3.1.tgz#e1c90b2ca2a9f9474cc72f6862bbf3fee8341fd1"
3276+
integrity sha512-PyJxiNtA5T2PlLIeBot4lbp7rj4OadzjnMZD/G5zuBNt8ei/yCU7+wW0h2bag9vr8c+/WuRWmSxbqAl9hL1rBA==
3277+
dependencies:
3278+
big-integer "1.6.x"
3279+
32663280
[email protected], bplist-parser@^0.x:
32673281
version "0.3.2"
32683282
resolved "https://registry.yarnpkg.com/bplist-parser/-/bplist-parser-0.3.2.tgz#3ac79d67ec52c4c107893e0237eb787cbacbced7"
@@ -7139,7 +7153,7 @@ minimatch@^5.0.0, minimatch@^5.0.1, minimatch@^5.1.0:
71397153
dependencies:
71407154
brace-expansion "^2.0.1"
71417155

7142-
minimist@^1.2.6:
7156+
minimist@^1.2.6, minimist@^1.2.7:
71437157
version "1.2.7"
71447158
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18"
71457159
integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==
@@ -7783,7 +7797,7 @@ pkg-up@^3.1.0:
77837797
dependencies:
77847798
find-up "^3.0.0"
77857799

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

8666+
simple-plist@^1.1.0:
8667+
version "1.3.1"
8668+
resolved "https://registry.yarnpkg.com/simple-plist/-/simple-plist-1.3.1.tgz#16e1d8f62c6c9b691b8383127663d834112fb017"
8669+
integrity sha512-iMSw5i0XseMnrhtIzRb7XpQEXepa9xhWxGUojHBL43SIpQuDQkh3Wpy67ZbDzZVr6EKxvwVChnVpdl8hEVLDiw==
8670+
dependencies:
8671+
bplist-creator "0.1.0"
8672+
bplist-parser "0.3.1"
8673+
plist "^3.0.5"
8674+
86528675
simple-swizzle@^0.2.2:
86538676
version "0.2.2"
86548677
resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a"
@@ -9405,6 +9428,11 @@ [email protected]:
94059428
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
94069429
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
94079430

9431+
uuid@^7.0.3:
9432+
version "7.0.3"
9433+
resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.3.tgz#c5c9f2c8cf25dc0a372c4df1441c41f5bd0c680b"
9434+
integrity sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==
9435+
94089436
uuid@^9.0.0:
94099437
version "9.0.0"
94109438
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"
@@ -9679,6 +9707,14 @@ ws@^8.0.0:
96799707
resolved "https://registry.yarnpkg.com/ws/-/ws-8.11.0.tgz#6a0d36b8edfd9f96d8b25683db2f8d7de6e8e143"
96809708
integrity sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==
96819709

9710+
xcode@^3.0.1:
9711+
version "3.0.1"
9712+
resolved "https://registry.yarnpkg.com/xcode/-/xcode-3.0.1.tgz#3efb62aac641ab2c702458f9a0302696146aa53c"
9713+
integrity sha512-kCz5k7J7XbJtjABOvkc5lJmkiDh8VhjVCGNiqdKCscmVpdVUpEAyXv1xmCLkQJ5dsHqx3IPO4XW+NTDhU/fatA==
9714+
dependencies:
9715+
simple-plist "^1.1.0"
9716+
uuid "^7.0.3"
9717+
96829718
xhr@^2.0.1:
96839719
version "2.6.0"
96849720
resolved "https://registry.yarnpkg.com/xhr/-/xhr-2.6.0.tgz#b69d4395e792b4173d6b7df077f0fc5e4e2b249d"

test/react-native/rn.patch

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
diff -ruN App.js App.js
2+
--- App.js 2022-12-06 11:42:35.000000000 +0100
3+
+++ App.js 2022-12-06 11:45:09.000000000 +0100
4+
@@ -26,6 +26,13 @@
5+
ReloadInstructions,
6+
} from 'react-native/Libraries/NewAppScreen';
7+
8+
+import * as Sentry from '@sentry/react-native';
9+
+
10+
+Sentry.init({
11+
+ dsn: 'https://[email protected]/5428561',
12+
+});
13+
+
14+
+
15+
const Section = ({children, title}): Node => {
16+
const isDarkMode = useColorScheme() === 'dark';
17+
return (
18+
diff -ruN android/app/build.gradle android/app/build.gradle
19+
--- android/app/build.gradle 2022-12-06 11:42:35.000000000 +0100
20+
+++ android/app/build.gradle 2022-12-06 11:44:50.000000000 +0100
21+
@@ -82,6 +82,7 @@
22+
]
23+
24+
apply from: "../../node_modules/react-native/react.gradle"
25+
+apply from: "../../node_modules/@sentry/react-native/sentry.gradle"
26+
27+
/**
28+
* Set this to true to create two separate APKs instead of one:
29+
diff -ruN android/sentry.properties android/sentry.properties
30+
--- android/sentry.properties 1970-01-01 01:00:00.000000000 +0100
31+
+++ android/sentry.properties 2022-12-06 11:45:37.000000000 +0100
32+
@@ -0,0 +1,4 @@
33+
+defaults.url=https://sentry.io/
34+
+defaults.org=sentry-sdks
35+
+defaults.project=sentry-react-native
36+
+# auth.token=
37+
diff -ruN ios/sentry.properties ios/sentry.properties
38+
--- ios/sentry.properties 1970-01-01 01:00:00.000000000 +0100
39+
+++ ios/sentry.properties 2022-12-06 11:45:31.000000000 +0100
40+
@@ -0,0 +1,4 @@
41+
+defaults.url=https://sentry.io/
42+
+defaults.org=sentry-sdks
43+
+defaults.project=sentry-react-native
44+
+# auth.token=

0 commit comments

Comments
 (0)