@@ -64,15 +64,16 @@ jobs:
6464 with :
6565 node-version : ${{ env.FDC_NODEJS_VERSION }}
6666
67- - name : install firebase-tools
67+ - name : Install Firebase Tools (" firebase" command-line tool)
6868 run : |
69+ set -euo pipefail
6970 set -v
7071 mkdir -p ${{ env.FDC_FIREBASE_TOOLS_DIR }}
7172 cd ${{ env.FDC_FIREBASE_TOOLS_DIR }}
7273 echo '{}' > package.json
7374 npm install --fund=false --audit=false --save --save-exact firebase-tools@${{ env.FDC_FIREBASE_TOOLS_VERSION }}
7475
75- - name : Restore Gradle cache
76+ - name : Restore Gradle Cache
7677 id : restore-gradle-cache
7778 uses : actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf # 4.2.2
7879 if : github.event_name != 'schedule'
8485 restore-keys : |
8586 gradle-cache-jqnvfzw6w7-
8687
87- - name : tool versions
88+ - name : Print Command-Line Tool Versions
8889 continue-on-error : true
8990 run : |
91+ set -euo pipefail
92+
9093 function run_cmd {
9194 echo "==============================================================================="
9295 echo "Running Command: $*"
@@ -105,6 +108,7 @@ jobs:
105108
106109 - name : Gradle assembleDebugAndroidTest
107110 run : |
111+ set -euo pipefail
108112 set -v
109113
110114 # Speed up build times and also avoid configuring firebase-crashlytics-ndk
@@ -117,7 +121,7 @@ jobs:
117121 ${{ (inputs.gradleInfoLog && '--info') || '' }} \
118122 :firebase-dataconnect:assembleDebugAndroidTest
119123
120- - name : Save Gradle cache
124+ - name : Save Gradle Cache
121125 uses : actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf # 4.2.2
122126 if : github.event_name == 'schedule'
123127 with :
@@ -126,14 +130,15 @@ jobs:
126130 ~/.gradle/wrapper
127131 key : gradle-cache-jqnvfzw6w7-${{ github.run_id }}
128132
129- - name : Enable KVM group permissions for Android Emulator
133+ - name : Enable KVM Group Permissions for Android Emulator
130134 run : |
135+ set -euo pipefail
131136 echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
132137 | sudo tee /etc/udev/rules.d/99-kvm4all.rules
133138 sudo udevadm control --reload-rules
134139 sudo udevadm trigger --name-match=kvm
135140
136- - name : Restore AVD cache
141+ - name : Restore AVD Cache
137142 uses : actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf # 4.2.2
138143 if : github.event_name != 'schedule'
139144 id : restore-avd-cache
@@ -156,7 +161,7 @@ jobs:
156161 disable-animations : true
157162 script : ' echo "Generated AVD snapshot for caching; event_name=${{ github.event_name }}, cache-matched-key=${{ steps.restore-avd-cache.outputs.cache-matched-key }}"'
158163
159- - name : Save AVD cache
164+ - name : Save AVD Cache
160165 uses : actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf # 4.2.2
161166 if : github.event_name == 'schedule'
162167 with :
@@ -165,8 +170,10 @@ jobs:
165170 ~/.android/adb*
166171 key : avd-cache-zhdsn586je-api${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}-${{ github.run_id }}
167172
168- - name : Data Connect Emulator
173+ - name : Data Connect Emulator Start
174+ id : data-connect-emulator
169175 run : |
176+ set -euo pipefail
170177 set -x
171178
172179 echo 'emulator.postgresConnectionUrl=postgresql://postgres:[email protected] :5432?sslmode=disable' > firebase-dataconnect/dataconnect.local.properties @@ -175,15 +182,27 @@ jobs:
175182 ${{ (inputs.gradleInfoLog && '--info') || '' }} \
176183 :firebase-dataconnect:connectors:runDebugDataConnectEmulator \
177184 >firebase.emulator.dataconnect.log 2>&1 &
185+ echo "FIREBASE_DATA_CONNECT_EMULATOR_PID=$!" >> "$GITHUB_OUTPUT"
178186
179- - name : Firebase Auth Emulator
187+ - name : Firebase Auth Emulator Start
188+ id : firebase-auth-emulator
180189 run : |
190+ set -euo pipefail
181191 set -x
182192 cd firebase-dataconnect/emulator
183193 ${{ env.FDC_FIREBASE_COMMAND }} emulators:start --only=auth >firebase.emulator.auth.log 2>&1 &
194+ echo "FIREBASE_AUTH_EMULATOR_PID=$!" >> "$GITHUB_OUTPUT"
195+
196+ - name : Logcat Log Capture Start
197+ id : logcat-capture
198+ continue-on-error : true
199+ run : |
200+ set -euo pipefail
201+ set -v
184202
185- - name : Capture Logcat Logs
186- run : adb logcat >logcat.log &
203+ "$ANDROID_HOME/platform-tools/adb" logcat -c
204+ "$ANDROID_HOME/platform-tools/adb" logcat >logcat.log &
205+ echo "LOGCAT_PID=$!" >> "$GITHUB_OUTPUT"
187206
188207 - name : Gradle connectedCheck
189208 id : connectedCheck
@@ -201,25 +220,83 @@ jobs:
201220 script : |
202221 set -eux && ./gradlew ${{ (inputs.gradleInfoLog && '--info') || '' }} :firebase-dataconnect:connectedCheck :firebase-dataconnect:connectors:connectedCheck
203222
204- - name : Upload log file artifacts
223+ - name : Logcat Log Capture Stop
224+ if : steps.logcat-capture.outcome == 'success'
225+ continue-on-error : true
226+ run : |
227+ set -euo pipefail
228+ set -v
229+
230+ kill -s SIGINT ${{ steps.logcat-capture.outputs.LOGCAT_PID }}
231+ loop_count=0
232+ while kill -0 ${{ steps.logcat-capture.outputs.LOGCAT_PID }} ; do
233+ loop_count=$((loop_count+1))
234+ if [[ $loop_count == 60 ]] ; then
235+ echo "ERROR: timeout waiting for logcat process to terminate" >&2
236+ exit 1
237+ fi
238+ echo "Waiting for logcat process to terminate"
239+ sleep 1
240+ done
241+
242+ - name : Firebase Auth Emulator Stop
243+ continue-on-error : true
244+ run : |
245+ set -euo pipefail
246+ set -v
247+
248+ kill -s SIGINT ${{ steps.firebase-auth-emulator.outputs.FIREBASE_AUTH_EMULATOR_PID }}
249+
250+ loop_count=0
251+ while kill -0 ${{ steps.firebase-auth-emulator.outputs.FIREBASE_AUTH_EMULATOR_PID }} ; do
252+ loop_count=$((loop_count+1))
253+ if [[ $loop_count == 60 ]] ; then
254+ echo "ERROR: timeout waiting for Firebase Auth Emulator process to terminate" >&2
255+ exit 1
256+ fi
257+ echo "Waiting for Firebase Auth Emulator process to terminate"
258+ sleep 1
259+ done
260+
261+ - name : Data Connect Emulator Stop
262+ continue-on-error : true
263+ run : |
264+ set -euo pipefail
265+ set -v
266+
267+ kill -s SIGINT ${{ steps.data-connect-emulator.outputs.FIREBASE_DATA_CONNECT_EMULATOR_PID }}
268+
269+ loop_count=0
270+ while kill -0 ${{ steps.data-connect-emulator.outputs.FIREBASE_DATA_CONNECT_EMULATOR_PID }} ; do
271+ loop_count=$((loop_count+1))
272+ if [[ $loop_count == 60 ]] ; then
273+ echo "ERROR: timeout waiting for Firebase Data Connect Emulator process to terminate" >&2
274+ exit 1
275+ fi
276+ echo "Waiting for Firebase Data Connect Emulator process to terminate"
277+ sleep 1
278+ done
279+
280+ - name : Upload Log Files
205281 uses : actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
206282 with :
207283 name : integration_test_logs
208284 path : " **/*.log"
209285 if-no-files-found : warn
210286 compression-level : 9
211287
212- - name : Upload Gradle build report artifacts
288+ - name : Upload Gradle Build Reports
213289 uses : actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
214290 with :
215291 name : integration_test_gradle_build_reports
216292 path : firebase-dataconnect/**/build/reports/
217293 if-no-files-found : warn
218294 compression-level : 9
219295
220- - name : Verify "Gradle connectedCheck" step was successful
296+ - name : Verify "Gradle connectedCheck" Step Was Successful
221297 if : steps.connectedCheck.outcome != 'success'
222298 run : |
299+ set -euo pipefail
223300 echo 'Failing because the outcome of the "Gradle connectedCheck" step ("${{ steps.connectedCheck.outcome }}") was not successful'
224301 exit 1
225302
0 commit comments