Skip to content

chore(deps): update Sample React Native to v0.71.11 #5231

chore(deps): update Sample React Native to v0.71.11

chore(deps): update Sample React Native to v0.71.11 #5231

Workflow file for this run

name: End-to-End Tests
on:
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
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 # pin@0.11.0
with:
access_token: ${{ github.token }}
sample:
# Android emulator said to perform best with macos HAXM
runs-on: macos-latest
strategy:
# we want that the matrix keeps running, default is to cancel them if it fails.
fail-fast: false
matrix:
platform: ['ios', 'android']
include:
- platform: ios
runtime: 'latest'
device: 'iPhone 14'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: Install Global Dependencies
run: brew install xcbeautify
- name: NPM cache
uses: actions/cache@v3
id: deps-cache
with:
path: |
node_modules
sample/node_modules
key: ${{ github.workflow }}-${{ github.job }}-npm-${{ hashFiles('yarn.lock', 'sample/yarn.lock') }}
- name: iOS cache
if: ${{ matrix.platform == 'ios' }}
uses: actions/cache@v3
with:
path: |
sample/ios/Pods
sample/ios/DerivedData
# Note: we cannot use sample/ios/Podfile.lock because it's not source controlled.
key: ${{ github.workflow }}-${{ github.job }}-ios${{ matrix.runtime }}-${{ hashFiles('yarn.lock', 'sample/yarn.lock') }}
- name: Install Dependencies
if: ${{ steps.deps-cache.outputs['cache-hit'] != 'true' }}
run: yarn install
- name: Build SDK
run: yarn build
- name: Install Sample Dependencies
if: ${{ steps.deps-cache.outputs['cache-hit'] != 'true' }}
working-directory: ./sample
run: yarn install
- run: pod install
if: ${{ matrix.platform == 'ios' }}
env:
PRODUCTION: 1
working-directory: ./sample/ios
- name: Build ${{ matrix.platform }} sample app
if: ${{ env.SENTRY_AUTH_TOKEN != null }}
id: build
working-directory: ./sample/${{ matrix.platform }}
run: |
if [[ "${{ matrix.platform }}" == "android" ]]; then
./gradlew :app:assembleRelease -PreactNativeArchitectures=x86
else
mkdir -p DerivedData
defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES
buildArgs=(
'-destination' 'platform=iOS Simulator,OS=${{ matrix.runtime }},name=${{ matrix.device }}'
'ONLY_ACTIVE_ARCH=yes'
'-derivedDataPath' $(cd "DerivedData" ; pwd -P)
)
echo "buildArgs = ${buildArgs[@]}"
set -o pipefail && xcodebuild \
-workspace sample.xcworkspace \
-configuration Release \
-scheme sample \
"${buildArgs[@]}" \
build \
| tee sample-xcodebuild.log \
| xcbeautify --quieter --is-ci --disable-colored-output
set -o pipefail && xcodebuild \
-project ../node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj \
-scheme WebDriverAgentRunner \
GCC_TREAT_WARNINGS_AS_ERRORS=0 \
COMPILER_INDEX_STORE_ENABLE=NO \
"${buildArgs[@]}" \
build \
| tee webdriveragent-xcodebuild.log \
| xcbeautify --quieter --is-ci --disable-colored-output
fi
- name: Upload logs
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.platform }}-logs
path: ./sample/ios/*.log
metrics:
runs-on: macos-latest
strategy:
# we want that the matrix keeps running, default is to cancel them if it fails.
fail-fast: false
matrix:
rn-architecture: ['legacy', 'new']
platform: ["ios", "android"]
include:
- platform: ios
name: iOS
appPlain: test/perf/test-app-plain.ipa
- platform: android
name: Android
appPlain: test/perf/TestAppPlain/android/app/build/outputs/apk/release/app-release.apk
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "adopt"
- name: Install Global Dependencies
run: yarn global add react-native-cli @sentry/cli yalc
- uses: actions/cache@v3
id: deps-cache
with:
path: |
node_modules
test/perf/TestAppSentry/node_modules
key: ${{ github.workflow }}-${{ github.job }}-${{ hashFiles('yarn.lock', 'test/perf/TestAppSentry/yarn.lock') }}
- name: Install Dependencies
if: steps.deps-cache.outputs['cache-hit'] != 'true'
run: yarn install
- name: Build SDK
run: yarn build
- name: Package SDK
run: yalc publish
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: actions/cache@v3
id: app-plain-cache
with:
path: ${{ matrix.appPlain }}
# if the whole plain app folder is hashed the cache is never hit as there are files generated in the folder
# the cache key is calculated both at cache retrieval and save time
# hashFiles fails when there are rn android new arch generated files in the folder (exact reason unknown)
key: ${{ github.workflow }}-${{ github.job }}-appplain-${{ matrix.platform }}-${{ matrix.rn-architecture }}-${{ hashFiles('test/perf/TestAppPlain/yarn.lock') }}
- name: Build app plain
if: steps.app-plain-cache.outputs['cache-hit'] != 'true'
working-directory: ./test/perf/TestAppPlain
run: |
yarn install
cd ${{ matrix.platform }}
if [[ "${{ matrix.platform }}" == "android" ]]; then
if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
perl -i -pe's/newArchEnabled=false/newArchEnabled=true/g' gradle.properties
fi
./gradlew assembleRelease
else
export PRODUCTION=1
if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
export RCT_NEW_ARCH_ENABLED=1
fi
pod install
cd ../..
fastlane build_perf_test_app_plain
fi
env:
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }}
FASTLANE_KEYCHAIN_PASSWORD: ${{ secrets.FASTLANE_KEYCHAIN_PASSWORD }}
MATCH_GIT_PRIVATE_KEY: ${{ secrets.MATCH_GIT_PRIVATE_KEY }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_USERNAME: ${{ secrets.MATCH_USERNAME }}
- name: Build app with Sentry
working-directory: ./test/perf/TestAppSentry
run: |
yalc add @sentry/react-native
yarn install
cd ${{ matrix.platform }}
if [[ "${{ matrix.platform }}" == "android" ]]; then
if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
perl -i -pe's/newArchEnabled=false/newArchEnabled=true/g' gradle.properties
fi
./gradlew assembleRelease
else
export PRODUCTION=1
if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
export RCT_NEW_ARCH_ENABLED=1
fi
pod install
cd ../..
fastlane build_perf_test_app_sentry
cd TestAppSentry
fi
# Remove after build so that the cache isn't invaldiated due to the changes in yarn.lock.
yarn remove @sentry/react-native
env:
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }}
FASTLANE_KEYCHAIN_PASSWORD: ${{ secrets.FASTLANE_KEYCHAIN_PASSWORD }}
MATCH_GIT_PRIVATE_KEY: ${{ secrets.MATCH_GIT_PRIVATE_KEY }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_USERNAME: ${{ secrets.MATCH_USERNAME }}
- name: Collect apps metrics
uses: getsentry/action-app-sdk-overhead-metrics@v1
with:
name: ${{ matrix.name }} (${{ matrix.rn-architecture }})
config: ./test/perf/metrics-${{ matrix.platform }}.yml
sauce-user: ${{ secrets.SAUCE_USERNAME }}
sauce-key: ${{ secrets.SAUCE_ACCESS_KEY }}
react-native-build:
name: Build RN ${{ matrix.rn-version }} ${{ matrix.rn-architecture }} ${{ matrix.platform }} ${{ matrix.build-type }}
runs-on: macos-latest
env:
RN_SENTRY_POD_NAME: RNSentry
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.65.3', '0.71.3']
rn-architecture: ['legacy', 'new']
platform: ['android', 'ios']
build-type: ['dev', 'production']
include:
- platform: ios
runtime: 'latest'
device: 'iPhone 14'
# exclude all rn versions lower than 0.70.0 for new architecture
exclude:
- rn-version: '0.65.3'
rn-architecture: 'new'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: Setup Global Tools
run: |
yarn global add yalc semver
brew install xcbeautify
- 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: NPM cache E2E Tests Library
uses: actions/cache@v3
id: deps-cache-e2e-library
with:
path: test/e2e/node_modules
key: ${{ github.workflow }}-${{ github.job }}-npm-${{ hashFiles('test/e2e/yarn.lock') }}
- name: Install SDK JS Dependencies
if: ${{ steps.deps-cache.outputs['cache-hit'] != 'true' }}
run: yarn install
- name: Install E2E Tests Library JS Dependencies
if: steps.deps-cache.outputs['deps-cache-e2e-library'] != 'true'
working-directory: test/e2e
run: yarn install
- name: Build SDK
run: yarn build
- name: Build E2E Tests Library
working-directory: test/e2e
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: Add E2E Tests Library to App
working-directory: test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp
run: yarn add ../../../../e2e
- 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
cat Podfile.lock | grep $RN_SENTRY_POD_NAME
- 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
../../../rn.patch.app.js --app .
- name: Patch Android App RN
if: ${{ matrix.platform == 'android' }}
working-directory: test/react-native
run: |
./rn.patch.app.build.gradle.js \
--app-build-gradle 'versions/${{ matrix.rn-version }}/RnDiffApp/android/app/build.gradle'
- 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"
mkdir -p "DerivedData"
derivedData="$(cd "DerivedData" ; pwd -P)"
set -o pipefail && xcodebuild \
-workspace RnDiffApp.xcworkspace \
-configuration "$CONFIG" \
-scheme RnDiffApp \
-destination 'platform=iOS Simulator,OS=${{ matrix.runtime }},name=${{ matrix.device }}' \
ONLY_ACTIVE_ARCH=yes \
-derivedDataPath "$derivedData" \
build \
| tee xcodebuild.log \
| xcbeautify --quieter --is-ci --disable-colored-output
- name: Archive Android APK
if: matrix.platform == 'android' && matrix.build-type == 'production'
run: |
BUILD_PATH=test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp/android/app/build/outputs/apk/release
BUILD_NAME=app-release.apk
tar -cvf apk.tar -C $BUILD_PATH $BUILD_NAME
- name: Archive iOS APP
if: matrix.platform == 'ios' && matrix.build-type == 'production'
run: |
BUILD_PATH=test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp/ios/DerivedData/Build/Products/Release-iphonesimulator
BUILD_NAME=RnDiffApp.app
tar -cvf app.tar -C $BUILD_PATH $BUILD_NAME
- name: Upload App APK
if: matrix.platform == 'android' && matrix.build-type == 'production'
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.rn-version }}-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-app-package
path: apk.tar
retention-days: 1
- name: Upload App APP
if: matrix.platform == 'ios' && matrix.build-type == 'production'
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.rn-version }}-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-app-package
path: app.tar
retention-days: 1
- name: Upload logs
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: rn-build-logs-${{ matrix.rn-version }}-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}
path: test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp/ios/*.log
react-native-test:
name: Test RN ${{ matrix.rn-version }} ${{ matrix.rn-architecture }} ${{ matrix.platform }} ${{ matrix.build-type }}
needs: react-native-build
runs-on: macos-latest
strategy:
fail-fast: false # keeps matrix running if one fails
matrix:
rn-version: ['0.65.3', '0.71.3']
rn-architecture: ['legacy', 'new']
platform: ['android', 'ios']
build-type: ['production']
include:
- platform: ios
runtime: 'latest'
device: 'iPhone 14'
# exclude all rn versions lower than 0.70.0 for new architecture
exclude:
- rn-version: '0.65.3'
rn-architecture: 'new'
env:
PLATFORM: ${{ matrix.platform }}
DEVICE: ${{ matrix.device }}
steps:
- uses: actions/checkout@v3
- name: Setup Global Tools
run: brew install xcbeautify
- name: Download App Package
if: matrix.build-type == 'production'
uses: actions/download-artifact@v3
with:
name: ${{ matrix.rn-version }}-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-app-package
path: test/e2e
- name: Extract App Package
working-directory: test/e2e
run: tar -xvf *.tar
- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: NPM cache E2E Tests Library
uses: actions/cache@v3
id: deps-cache-e2e-library
with:
path: test/e2e/node_modules
key: ${{ github.workflow }}-${{ github.job }}-npm-${{ hashFiles('test/e2e/yarn.lock') }}
- name: Install E2E Tests Library JS Dependencies
if: steps.deps-cache.outputs['deps-cache-e2e-library'] != 'true'
working-directory: test/e2e
run: yarn install
- name: Build iOS WebDriverAgent
if: matrix.platform == 'ios'
working-directory: test/e2e
run: |
mkdir -p "DerivedData"
derivedData="$(cd "DerivedData" ; pwd -P)"
set -o pipefail && xcodebuild \
-project node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj \
-scheme WebDriverAgentRunner \
GCC_TREAT_WARNINGS_AS_ERRORS=0 \
COMPILER_INDEX_STORE_ENABLE=NO \
-destination 'platform=iOS Simulator,OS=${{ matrix.runtime }},name=${{ matrix.device }}' \
ONLY_ACTIVE_ARCH=yes \
-derivedDataPath "$derivedData" \
build \
| tee xcodebuild.log \
| xcbeautify --quieter --is-ci --disable-colored-output
- name: Start Appium Server
working-directory: test/e2e
run: yarn run appium --log-timestamp --log-no-colors --log appium.${{ matrix.platform }}.log &
# Wait until the Appium server starts.
- name: Check Appium Server
uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd # pin@v2
with:
timeout_seconds: 60
max_attempts: 10
command: curl --output /dev/null --silent --head --fail http://127.0.0.1:4723/sessions
- name: Run tests on Android
if: ${{ matrix.platform == 'android' }}
env:
APPIUM_APP: ./app-release.apk
uses: reactivecircus/android-emulator-runner@50986b1464923454c95e261820bc626f38490ec0 # pin@v2
with:
working-directory: test/e2e
api-level: 29
emulator-options: >
-accel on
-no-snapshot
-gpu swiftshader_indirect
-noaudio
-no-boot-anim
-camera-back none
-camera-front none
-timezone US/Pacific
script: |
# Collect logs
adb logcat '*:D' 2>&1 >adb.log &
adb devices -l
yarn test --verbose
- name: Run tests on iOS
if: ${{ matrix.platform == 'ios' }}
working-directory: test/e2e
env:
APPIUM_APP: ./RnDiffApp.app
APPIUM_DERIVED_DATA: DerivedData
run: yarn test --verbose
- name: Upload logs
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.rn-version }}-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-logs
path: |
test/e2e/*.log
test/e2e/*.png