@@ -73,27 +73,35 @@ jobs:
73
73
npm install --fund=false --audit=false --save --save-exact firebase-tools@${{ env.FDC_FIREBASE_TOOLS_VERSION }}
74
74
75
75
- name : Restore Gradle cache
76
+ id : restore-gradle-cache
76
77
uses : actions/cache/restore@v4
77
78
if : github.event_name != 'schedule'
78
79
with :
79
80
path : |
80
81
~/.gradle/caches
81
82
~/.gradle/wrapper
82
- key : gradle-cache-jqnvfzw6w7
83
+ key : gradle-cache-jqnvfzw6w7-${{ github.run_id }}
84
+ restore-keys : |
85
+ gradle-cache-jqnvfzw6w7-
83
86
84
87
- name : tool versions
85
88
continue-on-error : true
86
89
run : |
87
- set +e -v
88
- uname -a
89
- which java
90
- java -version
91
- which javac
92
- javac -version
93
- which node
94
- node --version
95
- ${{ env.FDC_FIREBASE_COMMAND }} --version
96
- ./gradlew --version
90
+ function run_cmd {
91
+ echo "==============================================================================="
92
+ echo "Running Command: $*"
93
+ ("$@" 2>&1) || echo "WARNING: command failed with non-zero exit code $?: $*"
94
+ }
95
+
96
+ run_cmd uname -a
97
+ run_cmd which java
98
+ run_cmd java -version
99
+ run_cmd which javac
100
+ run_cmd javac -version
101
+ run_cmd which node
102
+ run_cmd node --version
103
+ run_cmd ${{ env.FDC_FIREBASE_COMMAND }} --version
104
+ run_cmd ./gradlew --version
97
105
98
106
- name : Gradle assembleDebugAndroidTest
99
107
run : |
@@ -116,7 +124,7 @@ jobs:
116
124
path : |
117
125
~/.gradle/caches
118
126
~/.gradle/wrapper
119
- key : gradle-cache-jqnvfzw6w7
127
+ key : ${{ steps.restore- gradle-cache.outputs.cache-primary-key }}
120
128
121
129
- name : Enable KVM group permissions for Android Emulator
122
130
run : |
@@ -128,24 +136,24 @@ jobs:
128
136
- name : Restore AVD cache
129
137
uses : actions/cache/restore@v4
130
138
if : github.event_name != 'schedule'
131
- id : avd-cache
139
+ id : restore- avd-cache
132
140
with :
133
141
path : |
134
142
~/.android/avd/*
135
143
~/.android/adb*
136
- key : avd-cache-zhdsn586je-api${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}
137
-
138
- - run : echo "github.event_name == '${{ github.event_name }}' steps. avd-cache.outputs.cache-hit == ' ${{ steps.avd-cache.outputs.cache-hit }}'"
144
+ key : avd-cache-zhdsn586je-api${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}-${{ github.run_id }}
145
+ restore-keys : |
146
+ avd-cache-zhdsn586je-api ${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}-
139
147
140
148
- name : Create AVD
141
- if : github.event_name == 'schedule' || steps.avd-cache.outputs.cache-hit != 'true'
149
+ if : github.event_name == 'schedule' || steps.restore- avd-cache.outputs.cache-hit != 'true'
142
150
uses : reactivecircus/android-emulator-runner@v2
143
151
with :
144
152
api-level : ${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}
145
153
arch : x86_64
146
154
force-avd-creation : false
147
155
emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
148
- disable-animations : false
156
+ disable-animations : true
149
157
script : echo "Generated AVD snapshot for caching."
150
158
151
159
- name : Save AVD cache
@@ -155,7 +163,7 @@ jobs:
155
163
path : |
156
164
~/.android/avd/*
157
165
~/.android/adb*
158
- key : avd-cache-zhdsn586je-api ${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}
166
+ key : ${{ steps.restore-avd-cache.outputs.cache-primary-key }}
159
167
160
168
- name : Data Connect Emulator
161
169
run : |
@@ -174,8 +182,16 @@ jobs:
174
182
cd firebase-dataconnect/emulator
175
183
${{ env.FDC_FIREBASE_COMMAND }} emulators:start --only=auth >firebase.emulator.auth.log 2>&1 &
176
184
185
+ - name : Capture Logcat Logs
186
+ run : adb logcat >logcat.log &
187
+
177
188
- name : Gradle connectedCheck
189
+ id : connectedCheck
178
190
uses : reactivecircus/android-emulator-runner@v2
191
+ # Allow this GitHub Actions "job" to continue even if the tests fail so that logs from a
192
+ # failed test run get uploaded as "artifacts" and are available to investigate failed runs.
193
+ # A later step in this "job" will fail the job if this step fails
194
+ continue-on-error : true
179
195
with :
180
196
api-level : ${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}
181
197
arch : x86_64
@@ -185,21 +201,28 @@ jobs:
185
201
script : |
186
202
set -eux && ./gradlew ${{ (inputs.gradleInfoLog && '--info') || '' }} :firebase-dataconnect:connectedCheck :firebase-dataconnect:connectors:connectedCheck
187
203
188
- - uses : actions/upload-artifact@v4
189
- if : true
204
+ - name : Upload log file artifacts
205
+ uses : actions/upload-artifact@v4
190
206
with :
191
- name : logs
207
+ name : integration_test_logs
192
208
path : " **/*.log"
193
209
if-no-files-found : warn
194
210
compression-level : 9
195
211
196
- - uses : actions/upload-artifact@v4
212
+ - name : Upload Gradle build report artifacts
213
+ uses : actions/upload-artifact@v4
197
214
with :
198
- name : gradle_build_reports
215
+ name : integration_test_gradle_build_reports
199
216
path : firebase-dataconnect/**/build/reports/
200
217
if-no-files-found : warn
201
218
compression-level : 9
202
219
220
+ - name : Verify "Gradle connectedCheck" step was successful
221
+ if : steps.connectedCheck.outcome != 'success'
222
+ run : |
223
+ echo 'Failing because the outcome of the "Gradle connectedCheck" step ("${{ steps.connectedCheck.outcome }}") was not successful'
224
+ exit 1
225
+
203
226
# Check this yml file with "actionlint": https://github.com/rhysd/actionlint
204
227
# To run actionlint yourself, run `brew install actionlint` followed by
205
228
# `actionlint .github/workflows/dataconnect.yml`
0 commit comments