Repository navigation
205 lines (192 loc) · 7.27 KB
/
Copy pathtest-android.yml
File metadata and controls
205 lines (192 loc) · 7.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
name: Test Android
on:
workflow_call:
outputs:
build-result:
description: The result of the build_android job
value: ${{ jobs.build_android.result }}
jobs:
build_android:
runs-on: 8-core-ubuntu
container:
image: reactnativecommunity/react-native-android:latest
env:
# Set the encoding to resolve a known character encoding issue with decompressing tar.gz files in containers
# via Gradle: https://github.com/gradle/gradle/issues/23391#issuecomment-1878979127
LC_ALL: C.UTF8
TERM: 'dumb'
GRADLE_OPTS: '-Dorg.gradle.daemon=false'
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }}
REACT_NATIVE_DOWNLOADS_DIR: /opt/react-native-downloads
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Build Android
uses: ./.github/actions/build-android
with:
release-type: dry-run
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
build_npm_package:
runs-on: 8-core-ubuntu
needs: build_android
container:
image: reactnativecommunity/react-native-android:latest
env:
TERM: 'dumb'
# Set the encoding to resolve a known character encoding issue with decompressing tar.gz files in containers
# via Gradle: https://github.com/gradle/gradle/issues/23391#issuecomment-1878979127
LC_ALL: C.UTF8
GRADLE_OPTS: '-Dorg.gradle.daemon=false'
REACT_NATIVE_DOWNLOADS_DIR: /opt/react-native-downloads
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Build NPM Package
uses: ./.github/actions/build-npm-package
with:
release-type: dry-run
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
skip-apple-prebuilts: true
artifact-suffix: -android
test_okhttp3:
runs-on: 8-core-ubuntu
container:
image: reactnativecommunity/react-native-android:latest
env:
LC_ALL: C.UTF8
TERM: 'dumb'
GRADLE_OPTS: '-Dorg.gradle.daemon=false'
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup node.js
uses: ./.github/actions/setup-node
- name: Install node dependencies
uses: ./.github/actions/yarn-install
- name: Setup gradle
uses: ./.github/actions/setup-gradle
with:
cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
- name: Compile and test ReactAndroid with OkHttp 3.14.9
run: |
./gradlew --init-script .github/workflow-scripts/okhttp3-compat.gradle \
:packages:react-native:ReactAndroid:verifyOkHttp3Compatibility
- name: Upload test results
if: ${{ always() }}
uses: ./.github/actions/upload-artifact
with:
name: android-okhttp3-results
path: packages/react-native/ReactAndroid/build/reports/tests/testDebugUnitTest/
if-no-files-found: ignore
test_e2e_rntester:
needs: build_android
uses: ./.github/workflows/e2e-android-rntester.yml
secrets: inherit
test_e2e_rntester_retry_1:
needs: test_e2e_rntester
if: ${{ always() && needs.test_e2e_rntester.outputs.status == 'failure' }}
uses: ./.github/workflows/e2e-android-rntester.yml
with:
retry-attempt: 1
secrets: inherit
test_e2e_rntester_retry_2:
needs: test_e2e_rntester_retry_1
if: ${{ always() && needs.test_e2e_rntester_retry_1.outputs.status == 'failure' }}
uses: ./.github/workflows/e2e-android-rntester.yml
with:
fail-on-error: true
retry-attempt: 2
secrets: inherit
test_visual_rntester:
needs: build_android
uses: ./.github/workflows/visual-capture-rntester.yml
with:
platform: android
build_templateapp:
needs: [build_npm_package, build_android]
uses: ./.github/workflows/build-android-templateapp.yml
secrets: inherit
test_e2e_templateapp:
needs: build_templateapp
uses: ./.github/workflows/e2e-android-templateapp.yml
secrets: inherit
test_e2e_templateapp_retry_1:
needs: test_e2e_templateapp
if: ${{ always() && needs.test_e2e_templateapp.outputs.status == 'failure' }}
uses: ./.github/workflows/e2e-android-templateapp.yml
with:
retry-attempt: 1
secrets: inherit
test_e2e_templateapp_retry_2:
needs: test_e2e_templateapp_retry_1
if: ${{ always() && needs.test_e2e_templateapp_retry_1.outputs.status == 'failure' }}
uses: ./.github/workflows/e2e-android-templateapp.yml
with:
fail-on-error: true
retry-attempt: 2
secrets: inherit
test_helloworld:
runs-on: ubuntu-latest
needs: [build_npm_package, build_android]
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'
REACT_NATIVE_DOWNLOADS_DIR: /opt/react-native-downloads
continue-on-error: true
strategy:
fail-fast: false
matrix:
flavor: [Debug, Release]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup git safe folders
run: git config --global --add safe.directory '*'
- name: Download npm package artifact
uses: ./.github/actions/download-artifact
with:
name: react-native-package-android
path: build
- name: Download maven-local artifact
uses: ./.github/actions/download-artifact
with:
name: maven-local
path: /tmp/maven-local
- name: Setup gradle
uses: ./.github/actions/setup-gradle
with:
cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
- name: Run yarn install
uses: ./.github/actions/yarn-install
- name: Set Hermes prebuilt version
shell: bash
run: |
node ./scripts/releases/use-hermes-prebuilt.js
- name: Run yarn install again, with the correct hermes version
uses: ./.github/actions/yarn-install
- name: Prepare the Helloworld application
shell: bash
run: node ./scripts/e2e/init-project-e2e.js --useHelloWorld --pathToLocalReactNative "$GITHUB_WORKSPACE/build/$(cat build/react-native-package-version)"
- name: Build the Helloworld application for ${{ matrix.flavor }} with Architecture set to New Architecture.
shell: bash
run: |
cd private/helloworld/android
args=()
if [[ ${{ matrix.flavor }} == "Release" ]]; then
args+=(--prod)
fi
yarn build android "${args[@]}" -P reactNativeArchitectures="$TARGET_ARCHITECTURE" -P react.internal.mavenLocalRepo="/tmp/maven-local"
- name: Upload artifact
uses: ./.github/actions/upload-artifact
with:
name: helloworld-apk-${{ matrix.flavor }}-NewArch-hermes
path: ./private/helloworld/android/app/build/outputs/apk/
compression-level: 0