From 5df40521d821ccd5b044dbd0288502d3a1fd2011 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Tue, 9 Jan 2024 21:27:05 +0100 Subject: [PATCH 1/8] chore(ci): Use ubuntu-latest runners everywhere possible --- .github/workflows/e2e.yml | 25 +++++++++++++++++++++--- .github/workflows/sample-application.yml | 6 ++++-- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index b4f850fb76..c979392db2 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -22,7 +22,7 @@ jobs: access_token: ${{ github.token }} metrics: - runs-on: macos-latest + runs-on: ${{ matrix.runs-on }} strategy: # we want that the matrix keeps running, default is to cancel them if it fails. fail-fast: false @@ -31,9 +31,11 @@ jobs: platform: ["ios", "android"] include: - platform: ios + runs-on: macos-latest name: iOS appPlain: test/perf/test-app-plain.ipa - platform: android + runs-on: ubuntu-latest name: Android appPlain: test/perf/TestAppPlain/android/app/build/outputs/apk/release/app-release.apk steps: @@ -141,7 +143,7 @@ jobs: react-native-build: name: Build RN ${{ matrix.rn-version }} ${{ matrix.rn-architecture }} ${{ matrix.engine }} ${{ matrix.platform }} ${{ matrix.build-type }} ${{ matrix.ios-use-frameworks }} - runs-on: macos-latest + runs-on: ${{ matrix.runs-on }} env: RN_SENTRY_POD_NAME: RNSentry RN_DIFF_REPOSITORY: https://github.com/react-native-community/rn-diff-purge.git @@ -156,8 +158,11 @@ jobs: engine: ['hermes', 'jsc'] include: - platform: ios + runs-on: macos-latest runtime: 'latest' device: 'iPhone 14' + - platform: android + runs-on: ubuntu-latest exclude: # exclude JSC for new RN versions (keeping the matrix manageable) - rn-version: '0.72.4' @@ -387,7 +392,7 @@ jobs: react-native-test: name: Test RN ${{ matrix.rn-version }} ${{ matrix.rn-architecture }} ${{ matrix.engine }} ${{ matrix.platform }} ${{ matrix.build-type }} ${{ matrix.ios-use-frameworks }} needs: react-native-build - runs-on: macos-latest + runs-on: ${{ matrix.runs-on }} strategy: fail-fast: false # keeps matrix running if one fails matrix: @@ -399,8 +404,11 @@ jobs: engine: ['hermes', 'jsc'] include: - platform: ios + runs-on: macos-latest runtime: 'latest' device: 'iPhone 14' + - platform: android + runs-on: ubuntu-latest exclude: # exclude all rn versions lower than 0.70.0 for new architecture - rn-version: '0.65.3' @@ -416,6 +424,17 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Setup KVM + shell: bash + run: | + # check if virtualization is supported... + sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok + # allow access to KVM to run the emulator + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ + | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + - name: Setup Global Tools run: brew install xcbeautify diff --git a/.github/workflows/sample-application.yml b/.github/workflows/sample-application.yml index 3ebb2b2eba..081065a433 100644 --- a/.github/workflows/sample-application.yml +++ b/.github/workflows/sample-application.yml @@ -24,8 +24,7 @@ jobs: build: name: Build ${{ matrix.rn-architecture }} ${{ matrix.platform }} ${{ matrix.build-type }} - # Android emulator said to perform best with macos HAXM - runs-on: macos-latest + runs-on: ${{ matrix.runs-on }} strategy: # we want that the matrix keeps running, default is to cancel them if it fails. fail-fast: false @@ -35,8 +34,11 @@ jobs: build-type: ['dev', 'production'] include: - platform: ios + runs-on: macos-latest runtime: 'latest' device: 'iPhone 14' + - platform: android + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From c7920835e36e7beee8f329cacf568965ba3d80a9 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Tue, 9 Jan 2024 21:39:40 +0100 Subject: [PATCH 2/8] Install xcodebeutify only on macos --- .github/workflows/e2e.yml | 8 ++++++-- .github/workflows/sample-application.yml | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index c979392db2..d0f13a79bf 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -223,7 +223,10 @@ jobs: - name: Setup Global Tools run: | yarn global add yalc semver - brew install xcbeautify + + - name: Setup Global Xcode Tools + if: ${{ matrix.platform == 'ios' }} + run: brew install xcbeautify - name: NPM cache SDK uses: actions/cache@v3 @@ -435,7 +438,8 @@ jobs: sudo udevadm control --reload-rules sudo udevadm trigger --name-match=kvm - - name: Setup Global Tools + - name: Setup Global Xcode Tools + if: ${{ matrix.platform == 'ios' }} run: brew install xcbeautify - name: Download App Package diff --git a/.github/workflows/sample-application.yml b/.github/workflows/sample-application.yml index 081065a433..6b76e3e323 100644 --- a/.github/workflows/sample-application.yml +++ b/.github/workflows/sample-application.yml @@ -54,7 +54,8 @@ jobs: java-version: '17' distribution: 'adopt' - - name: Install Global Dependencies + - name: Setup Global Xcode Tools + if: ${{ matrix.platform == 'ios' }} run: brew install xcbeautify - name: NPM cache From abd47b8672d2bd45e776e11669dbec68f47011a1 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 10 Jan 2024 10:33:28 +0100 Subject: [PATCH 3/8] Run KVM check only for android, use atd image for emulator --- .github/workflows/e2e.yml | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index d0f13a79bf..8ffb3a7497 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -427,17 +427,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup KVM - shell: bash - run: | - # check if virtualization is supported... - sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok - # allow access to KVM to run the emulator - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ - | sudo tee /etc/udev/rules.d/99-kvm4all.rules - sudo udevadm control --reload-rules - sudo udevadm trigger --name-match=kvm - - name: Setup Global Xcode Tools if: ${{ matrix.platform == 'ios' }} run: brew install xcbeautify @@ -468,6 +457,18 @@ jobs: java-version: '17' distribution: 'adopt' + - name: Setup KVM + if: ${{ matrix.platform == 'android' }} + shell: bash + run: | + # check if virtualization is supported... + sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok + # allow access to KVM to run the emulator + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ + | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + - name: NPM cache E2E Tests Library uses: actions/cache@v3 id: deps-cache-e2e-library @@ -517,10 +518,15 @@ jobs: uses: reactivecircus/android-emulator-runner@50986b1464923454c95e261820bc626f38490ec0 # pin@v2 with: working-directory: test/e2e - api-level: 29 + api-level: 30 + force-avd-creation: false + disable-animations: true + disable-spellchecker: true + target: 'aosp_atd' + channel: canary # Necessary for ATDs emulator-options: > - -accel on - -no-snapshot + -no-window + -no-snapshot-save -gpu swiftshader_indirect -noaudio -no-boot-anim From 6c891a0b057b4936dd1a2e9fa7b7a31cadd53114 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 10 Jan 2024 10:55:18 +0100 Subject: [PATCH 4/8] exclude dev builds and fix no jsc for 0.73 rn --- .github/workflows/e2e.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 8ffb3a7497..d080a6a94b 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -153,7 +153,7 @@ jobs: rn-version: ['0.65.3', '0.73.2'] rn-architecture: ['legacy', 'new'] platform: ['android', 'ios'] - build-type: ['dev', 'production'] + build-type: ['production'] ios-use-frameworks: ['no', 'static', 'dynamic'] engine: ['hermes', 'jsc'] include: @@ -165,7 +165,7 @@ jobs: runs-on: ubuntu-latest exclude: # exclude JSC for new RN versions (keeping the matrix manageable) - - rn-version: '0.72.4' + - rn-version: '0.73.2' engine: 'jsc' # exclude all rn versions lower than 0.70.0 for new architecture - rn-version: '0.65.3' From 73d9d4553d9b882d2fbaa050ccf97775ddb6c802 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 10 Jan 2024 12:09:30 +0100 Subject: [PATCH 5/8] Add runner os to the sample app node cache --- .github/workflows/sample-application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sample-application.yml b/.github/workflows/sample-application.yml index 6b76e3e323..c0b2a608ed 100644 --- a/.github/workflows/sample-application.yml +++ b/.github/workflows/sample-application.yml @@ -65,7 +65,7 @@ jobs: path: | node_modules samples/react-native/node_modules - key: ${{ github.workflow }}-${{ github.job }}-npm-${{ hashFiles('yarn.lock', 'samples/react-native/yarn.lock') }} + key: ${{ github.workflow }}-${{ github.job }}-${{ runner.os }}-npm-${{ hashFiles('yarn.lock', 'samples/react-native/yarn.lock') }} - name: Install SDK Dependencies if: ${{ steps.deps-cache.outputs['cache-hit'] != 'true' }} From 233714f7896a726a8218f1e6c128ef8f9839cb56 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 10 Jan 2024 12:48:02 +0100 Subject: [PATCH 6/8] remove jsc from e2e test for latest rn --- .github/workflows/e2e.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index d080a6a94b..6a192d24b3 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -419,7 +419,7 @@ jobs: # e2e test only the default combinations - rn-version: '0.65.3' engine: 'hermes' - - rn-version: '0.72.4' + - rn-version: '0.73.2' engine: 'jsc' env: PLATFORM: ${{ matrix.platform }} From 97303dad028528321c6ba5f9830f1bda8deda797 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 10 Jan 2024 13:33:13 +0100 Subject: [PATCH 7/8] Use atd device for native tests --- .github/workflows/native-tests.yml | 40 +++++++++++++++++++----------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/.github/workflows/native-tests.yml b/.github/workflows/native-tests.yml index 9ce34ffab3..a2136c6fa7 100644 --- a/.github/workflows/native-tests.yml +++ b/.github/workflows/native-tests.yml @@ -62,6 +62,17 @@ jobs: - name: Gradle cache uses: gradle/gradle-build-action@v2 + - name: Setup KVM + shell: bash + run: | + # check if virtualization is supported... + sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok + # allow access to KVM to run the emulator + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ + | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + - name: AVD cache uses: actions/cache@v3 id: avd-cache @@ -69,47 +80,48 @@ jobs: path: | ~/.android/avd/* ~/.android/adb* - key: avd-21 + key: avd-aosp-atd-30 - name: Create AVD and generate snapshot for caching if: steps.avd-cache.outputs.cache-hit != 'true' uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b #pin@v2.28.0 with: - api-level: 21 + api-level: 30 + force-avd-creation: false + disable-animations: true + disable-spellchecker: true + target: 'aosp_atd' + channel: canary # Necessary for ATDs emulator-options: > - -accel on -no-window + -no-snapshot-save -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none -timezone US/Pacific - force-avd-creation: false - disable-animations: true - arch: x86_64 - profile: Nexus 6 script: echo "Generated AVD snapshot for caching." - name: Run connected tests uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b #pin@v2.28.0 with: working-directory: RNSentryAndroidTester - api-level: 21 + api-level: 30 + force-avd-creation: false + disable-animations: true + disable-spellchecker: true + target: 'aosp_atd' + channel: canary # Necessary for ATDs emulator-options: > - -no-snapshot-save - -accel on -no-window + -no-snapshot-save -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none -timezone US/Pacific - force-avd-creation: false - disable-animations: true - arch: x86_64 - profile: Nexus 6 script: | ./gradlew uninstallDebug uninstallDebugAndroidTest ./gradlew connectedCheck From 470bafd1e5256552bd2886186c02d88068336137 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 10 Jan 2024 13:39:00 +0100 Subject: [PATCH 8/8] Use gradle cache for all builds --- .github/workflows/codegen.yml | 2 ++ .github/workflows/e2e.yml | 8 ++++++++ .github/workflows/sample-application.yml | 3 +++ 3 files changed, 13 insertions(+) diff --git a/.github/workflows/codegen.yml b/.github/workflows/codegen.yml index 6fefa20df6..4fd6dce765 100644 --- a/.github/workflows/codegen.yml +++ b/.github/workflows/codegen.yml @@ -33,6 +33,8 @@ jobs: with: java-version: '17' distribution: "adopt" + - name: Gradle cache + uses: gradle/gradle-build-action@v2 - uses: actions/cache@v3 id: cache with: diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 6a192d24b3..71d5e433ea 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -47,6 +47,8 @@ jobs: with: java-version: '17' distribution: "adopt" + - name: Gradle cache + uses: gradle/gradle-build-action@v2 - name: Install Global Dependencies run: yarn global add react-native-cli @sentry/cli yalc - uses: actions/cache@v3 @@ -220,6 +222,9 @@ jobs: java-version: '17' distribution: 'adopt' + - name: Gradle cache + uses: gradle/gradle-build-action@v2 + - name: Setup Global Tools run: | yarn global add yalc semver @@ -457,6 +462,9 @@ jobs: java-version: '17' distribution: 'adopt' + - name: Gradle cache + uses: gradle/gradle-build-action@v2 + - name: Setup KVM if: ${{ matrix.platform == 'android' }} shell: bash diff --git a/.github/workflows/sample-application.yml b/.github/workflows/sample-application.yml index c0b2a608ed..b337000ed4 100644 --- a/.github/workflows/sample-application.yml +++ b/.github/workflows/sample-application.yml @@ -54,6 +54,9 @@ jobs: java-version: '17' distribution: 'adopt' + - name: Gradle cache + uses: gradle/gradle-build-action@v2 + - name: Setup Global Xcode Tools if: ${{ matrix.platform == 'ios' }} run: brew install xcbeautify