Skip to content

Commit 220f1dd

Browse files
committed
[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]
1 parent 5df5ed1 commit 220f1dd

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

.github/workflows/android.yml

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

0 commit comments

Comments
 (0)