From 220f1ddbb235222a24135b76267209195023f9bd Mon Sep 17 00:00:00 2001 From: Blake Friedman Date: Tue, 18 Jun 2024 10:24:36 +0100 Subject: [PATCH] [RN][GHA] Add Android Helloworld test on PR Will run test_android_helloworld when users create a PR, to provide coverage while we figure out what's going on with our CircleCI tests / deprecate them. Changelog: [Internal] --- .github/workflows/android.yml | 88 +++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .github/workflows/android.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 00000000000000..b211e696ce3289 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,88 @@ +name: Test Android Helloworld on PR + +on: [workflow_dispatch, pull_request, push] + +run-name: Android Helloworld: ${{ inputs.deploy_target}} by ${{ github.actor }} + +jobs: + test_android_helloworld: + runs-on: ubuntu-latest + needs: prepare_hermes_workspace + container: + image: reactnativecommunity/react-native-android:latest + env: + # Set the encoding to resolve a known character encoding issue with decompressing tar.gz files in conatiners + # via Gradle: https://github.com/gradle/gradle/issues/23391#issuecomment-1878979127 + LC_ALL: C.UTF8 + YARN_ENABLE_IMMUTABLE_INSTALLS: false + TERM: "dumb" + GRADLE_OPTS: "-Dorg.gradle.daemon=false" + TARGET_ARCHITECTURE: "arm64-v8a" + continue-on-error: true + strategy: + fail-fast: false + matrix: + flavor: [Debug, Release] + architecture: [NewArch, OldArch] + jsengine: [Hermes, JSC] + steps: + - name: Checkout + uses: actions/checkout@v4.1.1 + - name: Cache setup + id: cache_setup + uses: ./.github/actions/cache_setup + with: + hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} + react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} + - name: Run yarn + shell: bash + run: yarn install --non-interactive + - name: Setup gradle + uses: ./.github/actions/setup-gradle + - name: Build CodeGen JS scripts + shell: bash + run: | + cd packages/react-native-codegen + yarn run build + - name: Monitor Disk utilization (before build) + shell: bash + if: always() + run: | + echo "On Runner:" + df -h + echo "Root:" + du -hs * + echo "Projects folder:" + du -hs ./packages/* + - name: Build the Helloworld application for ${{ matrix.flavor }} with Architecture set to ${{ matrix.architecture }}, and using the ${{ matrix.jsengine }} JS engine. + shell: bash + run: | + cd packages/helloworld/android + args=() + if [[ ${{ matrix.architecture }} == "OldArch" ]]; then + args+=(--arch old) + fi + if [[ ${{ matrix.jsengine }} == "JSC" ]]; then + args+=(--jsvm jsc) + fi + if [[ ${{ matrix.flavor }} == "Release" ]]; then + args+=(--prod) + fi + yarn build android "${args[@]}" -P reactNativeArchitectures="$TARGET_ARCHITECTURE" + - name: Monitor Disk utilization (after build) + shell: bash + if: always() + run: | + echo "On Runner:" + df -h + echo "Root:" + du -hs * + echo "Projects folder:" + du -hs ./packages/* + - name: Upload artifact + uses: actions/upload-artifact@v4.3.1 + with: + name: template-apk-${{ matrix.flavor }}-${{ matrix.architecture }}-${{ matrix.jsengine }} + path: ./app/build/outputs/apk/ + compression-level: 0 +