|
| 1 | +name: Test Android Helloworld on PR |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + push: |
| 7 | + |
| 8 | +jobs: |
| 9 | + test_android_helloworld: |
| 10 | + run-name: Android Helloworld: ${{ inputs.deploy_target}} by ${{ github.actor }} |
| 11 | + runs-on: ubuntu-latest |
| 12 | + needs: prepare_hermes_workspace |
| 13 | + container: |
| 14 | + image: reactnativecommunity/react-native-android:latest |
| 15 | + env: |
| 16 | + # Set the encoding to resolve a known character encoding issue with decompressing tar.gz files in conatiners |
| 17 | + # via Gradle: https://github.com/gradle/gradle/issues/23391#issuecomment-1878979127 |
| 18 | + LC_ALL: C.UTF8 |
| 19 | + YARN_ENABLE_IMMUTABLE_INSTALLS: false |
| 20 | + TERM: "dumb" |
| 21 | + GRADLE_OPTS: "-Dorg.gradle.daemon=false" |
| 22 | + TARGET_ARCHITECTURE: "arm64-v8a" |
| 23 | + continue-on-error: true |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + flavor: [Debug, Release] |
| 28 | + architecture: [NewArch, OldArch] |
| 29 | + jsengine: [Hermes, JSC] |
| 30 | + steps: |
| 31 | + - name: Checkout |
| 32 | + |
| 33 | + - name: Cache setup |
| 34 | + id: cache_setup |
| 35 | + uses: ./.github/actions/cache_setup |
| 36 | + with: |
| 37 | + hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} |
| 38 | + react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} |
| 39 | + - name: Run yarn |
| 40 | + shell: bash |
| 41 | + run: yarn install --non-interactive |
| 42 | + - name: Setup gradle |
| 43 | + uses: ./.github/actions/setup-gradle |
| 44 | + - name: Build CodeGen JS scripts |
| 45 | + shell: bash |
| 46 | + run: | |
| 47 | + cd packages/react-native-codegen |
| 48 | + yarn run build |
| 49 | + - name: Monitor Disk utilization (before build) |
| 50 | + shell: bash |
| 51 | + if: always() |
| 52 | + run: | |
| 53 | + echo "On Runner:" |
| 54 | + df -h |
| 55 | + echo "Root:" |
| 56 | + du -hs * |
| 57 | + echo "Projects folder:" |
| 58 | + du -hs ./packages/* |
| 59 | + - name: Build the Helloworld application for ${{ matrix.flavor }} with Architecture set to ${{ matrix.architecture }}, and using the ${{ matrix.jsengine }} JS engine. |
| 60 | + shell: bash |
| 61 | + run: | |
| 62 | + cd packages/helloworld/android |
| 63 | + args=() |
| 64 | + if [[ ${{ matrix.architecture }} == "OldArch" ]]; then |
| 65 | + args+=(--arch old) |
| 66 | + fi |
| 67 | + if [[ ${{ matrix.jsengine }} == "JSC" ]]; then |
| 68 | + args+=(--jsvm jsc) |
| 69 | + fi |
| 70 | + if [[ ${{ matrix.flavor }} == "Release" ]]; then |
| 71 | + args+=(--prod) |
| 72 | + fi |
| 73 | + yarn build android "${args[@]}" -P reactNativeArchitectures="$TARGET_ARCHITECTURE" |
| 74 | + - name: Monitor Disk utilization (after build) |
| 75 | + shell: bash |
| 76 | + if: always() |
| 77 | + run: | |
| 78 | + echo "On Runner:" |
| 79 | + df -h |
| 80 | + echo "Root:" |
| 81 | + du -hs * |
| 82 | + echo "Projects folder:" |
| 83 | + du -hs ./packages/* |
| 84 | + - name: Upload artifact |
| 85 | + |
| 86 | + with: |
| 87 | + name: template-apk-${{ matrix.flavor }}-${{ matrix.architecture }}-${{ matrix.jsengine }} |
| 88 | + path: ./app/build/outputs/apk/ |
| 89 | + compression-level: 0 |
| 90 | + |
0 commit comments