Build Android #4
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: Build Android | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - '.github/workflows/android-build.yml' | |
| - 'example/android/**' | |
| - 'nitrogen/generated/shared/**' | |
| - 'nitrogen/generated/android/**' | |
| - 'cpp/**' | |
| - 'android/**' | |
| - '**/bun.lock' | |
| - '**/react-native.config.js' | |
| - '**/nitro.json' | |
| pull_request: | |
| paths: | |
| - '.github/workflows/android-build.yml' | |
| - 'example/android/**' | |
| - '**/nitrogen/generated/shared/**' | |
| - '**/nitrogen/generated/android/**' | |
| - 'cpp/**' | |
| - 'android/**' | |
| - '**/bun.lock' | |
| - '**/react-native.config.js' | |
| - '**/nitro.json' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: Build Android Example App (${{ matrix.arch }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: [new, old] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| - name: Install dependencies (bun) | |
| run: bun install | |
| - name: Generate Nitro modules (codegen) | |
| run: | | |
| npm run codegen | |
| - name: Disable new architecture in gradle.properties | |
| if: matrix.arch == 'old' | |
| run: sed -i "s/newArchEnabled=true/newArchEnabled=false/g" example/android/gradle.properties | |
| - name: Setup JDK 17 | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '17' | |
| cache: 'gradle' | |
| - name: Cache Gradle | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/**/*.gradle*') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Run Gradle build | |
| working-directory: example/android | |
| run: ./gradlew assembleDebug --no-daemon --build-cache | |
| - name: Stop Gradle daemon | |
| working-directory: example/android | |
| run: ./gradlew --stop |