fix: Run legacy Android ASan on API 33 #1125
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Harness Android | |
| concurrency: | |
| group: harness-android-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref_name != 'main' }} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| device_api_level: | |
| description: "Override the Android API level for both jobs" | |
| required: false | |
| type: string | |
| device_profile: | |
| description: "Device profile" | |
| required: false | |
| default: "pixel_7" | |
| type: string | |
| avd_name: | |
| description: "Override the AVD name for both jobs" | |
| required: false | |
| type: string | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - ".github/workflows/harness-android.yml" | |
| - "apps/example/android/**" | |
| - "**/nitrogen/generated/shared/**" | |
| - "**/nitrogen/generated/android/**" | |
| - "packages/react-native-nitro-test/cpp/**" | |
| - "packages/react-native-nitro-test/android/**" | |
| - "packages/react-native-nitro-test-external/cpp/**" | |
| - "packages/react-native-nitro-test-external/android/**" | |
| - "packages/react-native-nitro-modules/cpp/**" | |
| - "packages/react-native-nitro-modules/android/**" | |
| - "packages/react-native-nitro-modules/src/**" | |
| - "**/bun.lock" | |
| - "**/react-native.config.js" | |
| - "**/nitro.json" | |
| - "apps/example/__tests__/**" | |
| - "apps/example/src/getTests.ts" | |
| - "apps/example/src/testing/**" | |
| - "apps/example/jest.harness.config.mjs" | |
| - "apps/example/package.json" | |
| - "apps/example/rn-harness.config.mjs" | |
| pull_request: | |
| paths: | |
| - ".github/workflows/harness-android.yml" | |
| - "apps/example/android/**" | |
| - "**/nitrogen/generated/shared/**" | |
| - "**/nitrogen/generated/android/**" | |
| - "packages/react-native-nitro-test/cpp/**" | |
| - "packages/react-native-nitro-test/android/**" | |
| - "packages/react-native-nitro-test-external/cpp/**" | |
| - "packages/react-native-nitro-test-external/android/**" | |
| - "packages/react-native-nitro-modules/cpp/**" | |
| - "packages/react-native-nitro-modules/android/**" | |
| - "packages/react-native-nitro-modules/src/**" | |
| - "**/bun.lock" | |
| - "**/react-native.config.js" | |
| - "**/nitro.json" | |
| - "apps/example/__tests__/**" | |
| - "apps/example/src/getTests.ts" | |
| - "apps/example/src/testing/**" | |
| - "apps/example/jest.harness.config.mjs" | |
| - "apps/example/package.json" | |
| - "apps/example/rn-harness.config.mjs" | |
| env: | |
| DEVICE_ARCH: x86_64 | |
| DEVICE_PROFILE: ${{ github.event.inputs.device_profile || 'pixel_7' }} | |
| AVD_DISK_SIZE: 1G | |
| AVD_HEAP_SIZE: 1G | |
| jobs: | |
| harness_android_new: | |
| name: Harness Android (${{ matrix.sanitizer.name }}, new architecture) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| min-sdk: | |
| - '26' | |
| sanitizer: | |
| - name: Default | |
| gradle_property: "" | |
| device_api_level: "36" | |
| avd_name: Pixel_7_API_36 | |
| - name: ASan | |
| gradle_property: "address" | |
| # Keep legacy x86_64 ASan on the API 33 image verified in #1530. | |
| # HWASan requires ARM64; this workflow uses an x86_64 emulator. | |
| device_api_level: "33" | |
| avd_name: Pixel_7_API_33 | |
| env: | |
| DEVICE_API_LEVEL: ${{ github.event.inputs.device_api_level || matrix.sanitizer.device_api_level }} | |
| AVD_NAME: ${{ github.event.inputs.avd_name || matrix.sanitizer.avd_name }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 1 | |
| - name: Reclaim disk space | |
| uses: AdityaGarg8/remove-unwanted-software@v5 | |
| with: | |
| remove-dotnet: true | |
| remove-haskell: true | |
| remove-codeql: true | |
| remove-docker-images: true | |
| - uses: oven-sh/setup-bun@v2 | |
| - name: Install npm dependencies (bun) | |
| run: bun install | |
| - name: Set minSdk in build.gradle | |
| run: sed -i "s/minSdkVersion = 24/minSdkVersion = ${{ matrix.min-sdk }}/g" apps/example/android/build.gradle | |
| - name: Setup JDK 17 | |
| uses: actions/setup-java@v5.7.0 | |
| with: | |
| distribution: "zulu" | |
| java-version: 17 | |
| java-package: jdk | |
| - name: Restore Gradle/CMake cache | |
| uses: actions/cache@v6 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| apps/example/android/.gradle | |
| apps/example/android/app/.cxx | |
| key: ${{ runner.os }}-gradle-${{ matrix.min-sdk }}-${{ env.DEVICE_ARCH }}-${{ matrix.sanitizer.name }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/CMakeLists.txt', '**/*.cmake') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle-${{ matrix.min-sdk }}-${{ env.DEVICE_ARCH }}-${{ matrix.sanitizer.name }}- | |
| ${{ runner.os }}-gradle- | |
| - name: Build Android app | |
| working-directory: apps/example/android | |
| run: ./gradlew :app:assembleDebug --no-daemon --build-cache -PreactNativeArchitectures=${{ env.DEVICE_ARCH }} -PnitroSanitizer=${{ matrix.sanitizer.gradle_property }} | |
| - name: Run Harness E2E tests | |
| uses: callstackincubator/react-native-harness@v1.4.1 | |
| with: | |
| runner: android | |
| projectRoot: apps/example | |
| app: android/app/build/outputs/apk/debug/app-debug.apk | |
| packageManager: bun | |
| # Gradle cache doesn't like daemons | |
| - name: Stop Gradle Daemon | |
| working-directory: apps/example/android | |
| run: ./gradlew --stop |