99 firebaseToolsVersion :
1010 gradleInfoLog :
1111 type : boolean
12+ pythonVersion :
1213 pull_request :
1314 paths :
1415 - .github/workflows/dataconnect.yml
2425 FDC_JAVA_VERSION : ${{ inputs.javaVersion || '17' }}
2526 FDC_ANDROID_EMULATOR_API_LEVEL : ${{ inputs.androidEmulatorApiLevel || '34' }}
2627 FDC_NODEJS_VERSION : ${{ inputs.nodeJsVersion || '20' }}
27- FDC_FIREBASE_TOOLS_VERSION : ${{ inputs.firebaseToolsVersion || '13.29 .1' }}
28+ FDC_FIREBASE_TOOLS_VERSION : ${{ inputs.firebaseToolsVersion || '14.5 .1' }}
2829 FDC_FIREBASE_TOOLS_DIR : /tmp/firebase-tools
2930 FDC_FIREBASE_COMMAND : /tmp/firebase-tools/node_modules/.bin/firebase
31+ FDC_PYTHON_VERSION : ${{ inputs.pythonVersion || '3.13' }}
3032
3133concurrency :
3234 group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
6466 with :
6567 node-version : ${{ env.FDC_NODEJS_VERSION }}
6668
69+ - uses : actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
70+ with :
71+ python-version : ${{ env.FDC_PYTHON_VERSION }}
72+
73+ - run : pip install -r firebase-dataconnect/ci/requirements.txt
74+
6775 - name : Install Firebase Tools ("firebase" command-line tool)
6876 run : |
6977 set -euo pipefail
7482 npm install --fund=false --audit=false --save --save-exact firebase-tools@${{ env.FDC_FIREBASE_TOOLS_VERSION }}
7583
7684 - name : Restore Gradle Cache
77- id : restore-gradle-cache
7885 uses : actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf # 4.2.2
7986 if : github.event_name != 'schedule'
8087 with :
@@ -170,43 +177,28 @@ jobs:
170177 ~/.android/adb*
171178 key : avd-cache-zhdsn586je-api${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}-${{ github.run_id }}
172179
173- - name : Data Connect Emulator Start
174- id : data-connect-emulator
180+ - name : Start Firebase Emulators
175181 run : |
176- set -euo pipefail
177- set -xv
178-
179- echo 'emulator.postgresConnectionUrl=postgresql://postgres:[email protected] :5432?sslmode=disable' > firebase-dataconnect/dataconnect.local.properties 180-
181- ./gradlew \
182- ${{ (inputs.gradleInfoLog && '--info') || '' }} \
183- :firebase-dataconnect:connectors:runDebugDataConnectEmulator \
184- >firebase.emulator.dataconnect.log 2>&1 &
182+ set -xveuo pipefail
185183
186- echo "FIREBASE_DATA_CONNECT_EMULATOR_PID=$!" >> "$GITHUB_ENV"
187-
188- - name : Firebase Auth Emulator Start
189- id : firebase-auth-emulator
190- run : |
191- set -euo pipefail
192- set -xv
184+ # Use the same dataconnect binary as was used for code generation in gradle assemble
185+ DATACONNECT_EMULATOR_BINARY_PATH="$(find "$PWD"/firebase-dataconnect/connectors/build/intermediates/dataconnect/debug/executable -type f)"
186+ if [[ -z $DATACONNECT_EMULATOR_BINARY_PATH ]] ; then
187+ echo "INTERNAL ERROR v7kg2dfhbc: unable to find data connect binary" >&2
188+ exit 1
189+ fi
190+ export DATACONNECT_EMULATOR_BINARY_PATH
193191
192+ export FIREBASE_DATACONNECT_POSTGRESQL_STRING='postgresql://postgres:[email protected] :5432?sslmode=disable' 194193 cd firebase-dataconnect/emulator
195- ${{ env.FDC_FIREBASE_COMMAND }} emulators:start --only=auth >firebase.emulator.auth.log 2>&1 &
196-
197- echo "FIREBASE_AUTH_EMULATOR_PID=$!" >> "$GITHUB_ENV"
194+ ${{ env.FDC_FIREBASE_COMMAND }} emulators:start --only=auth,dataconnect >firebase.emulators.log 2>&1 &
198195
199- - name : Logcat Log Capture Start
200- id : logcat-capture
196+ - name : Start Logcat Capture
201197 continue-on-error : true
202198 run : |
203- set -euo pipefail
204- set -xv
205-
199+ set -xveuo pipefail
206200 "$ANDROID_HOME/platform-tools/adb" logcat >logcat.log 2>&1 &
207201
208- echo "LOGCAT_PID=$!" >> "$GITHUB_ENV"
209-
210202 - name : Gradle connectedCheck
211203 id : connectedCheck
212204 uses : reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0
@@ -243,6 +235,15 @@ jobs:
243235 if : steps.connectedCheck.outcome != 'success'
244236 run : |
245237 set -euo pipefail
238+
239+ if [[ ! -e logcat.log ]] ; then
240+ echo "WARNING dsdta43sxk: logcat log file not found; skipping scanning for test failures" >&2
241+ else
242+ echo "Scanning logcat output for failure details"
243+ python firebase-dataconnect/ci/logcat_error_report.py --logcat-file=logcat.log
244+ echo
245+ fi
246+
246247 echo 'Failing because the outcome of the "Gradle connectedCheck" step ("${{ steps.connectedCheck.outcome }}") was not successful'
247248 exit 1
248249
@@ -256,30 +257,121 @@ jobs:
256257 - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
257258 with :
258259 show-progress : false
260+ sparse-checkout : ' .github/'
259261 - uses : docker://rhysd/actionlint:1.7.7
260262 with :
261263 args : -color /github/workspace/.github/workflows/dataconnect.yml
262264
265+ python-ci-unit-tests :
266+ continue-on-error : false
267+ runs-on : ubuntu-latest
268+ steps :
269+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
270+ with :
271+ show-progress : false
272+ sparse-checkout : ' firebase-dataconnect/ci/'
273+ - uses : actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
274+ with :
275+ python-version : ${{ env.FDC_PYTHON_VERSION }}
276+ - run : pip install -r firebase-dataconnect/ci/requirements.txt
277+ - name : pytest
278+ working-directory : firebase-dataconnect/ci
279+ run : pytest --verbose --full-trace --color=no --strict-config
280+
281+ python-ci-lint :
282+ continue-on-error : false
283+ runs-on : ubuntu-latest
284+ steps :
285+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
286+ with :
287+ show-progress : false
288+ sparse-checkout : ' firebase-dataconnect/ci/'
289+ - uses : actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
290+ with :
291+ python-version : ${{ env.FDC_PYTHON_VERSION }}
292+ - run : pip install -r firebase-dataconnect/ci/requirements.txt
293+ - name : ruff check
294+ working-directory : firebase-dataconnect/ci
295+ run : ruff check --diff --verbose --no-cache --output-format=github --exit-non-zero-on-fix
296+
297+ python-ci-format :
298+ continue-on-error : false
299+ runs-on : ubuntu-latest
300+ steps :
301+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
302+ with :
303+ show-progress : false
304+ sparse-checkout : ' firebase-dataconnect/ci/'
305+ - uses : actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
306+ with :
307+ python-version : ${{ env.FDC_PYTHON_VERSION }}
308+ - run : pip install -r firebase-dataconnect/ci/requirements.txt
309+ - name : ruff format
310+ working-directory : firebase-dataconnect/ci
311+ run : ruff format --diff --verbose --no-cache
312+
313+ python-ci-type-check :
314+ continue-on-error : false
315+ runs-on : ubuntu-latest
316+ steps :
317+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
318+ with :
319+ show-progress : false
320+ sparse-checkout : ' firebase-dataconnect/ci/'
321+ - uses : actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
322+ with :
323+ python-version : ${{ env.FDC_PYTHON_VERSION }}
324+ - run : pip install -r firebase-dataconnect/ci/requirements.txt
325+ - name : pyright
326+ working-directory : firebase-dataconnect/ci
327+ run : pyright --warnings --stats
328+
329+ # The "send-notifications" job adds a comment to GitHub Issue
330+ # https://github.com/firebase/firebase-android-sdk/issues/6857 with the results of the scheduled
331+ # nightly runs. Interested parties can then subscribe to that issue to be aprised of the outcome
332+ # of the nightly runs.
333+ #
334+ # When testing the comment-adding logic itself, you can add the line
335+ # trksmnkncd_notification_issue=6863
336+ # into the PR's description to instead post a comment to issue #6863, an issue specifically
337+ # created for testing, avoiding spamming the main issue to which others are subscribed.
263338 send-notifications :
264- needs : [integration-test, actionlint-dataconnect-yml]
339+ needs :
340+ - ' integration-test'
341+ - ' actionlint-dataconnect-yml'
342+ - ' python-ci-unit-tests'
343+ - ' python-ci-lint'
344+ - ' python-ci-format'
345+ - ' python-ci-type-check'
265346 if : always()
266347 permissions :
267348 issues : write
268349 runs-on : ubuntu-latest
269350 steps :
270- - name : Post Comment on Issue # 6857
271- if : github.event_name == 'schedule'
272- env :
273- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
274- run : |
275- set -euo pipefail
351+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
352+ with :
353+ show-progress : false
354+ sparse-checkout : |
355+ firebase-dataconnect/ci/
356+ .github/
276357
277- cat >message.txt <<EOF
278- Result of workflow ${{ github.workflow }} at ${{ github.ref }}: ${{ job.status }}
279- ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}
280- job=${{ github.job }} run_id=${{ github.run_id }} run_number=${{ github.run_number }} run_attempt=${{ github.run_attempt }}
358+ - name : gh auth login
359+ run : echo '${{ secrets.GITHUB_TOKEN }}' | gh auth login --with-token
360+
361+ - name : Create Job Results File
362+ run : |
363+ set -xveuo pipefail
364+ cat >'${{ runner.temp }}/job_results.txt' <<EOF
365+ integration-test:${{ needs.integration-test.result }}
366+ actionlint-dataconnect-yml:${{ needs.actionlint-dataconnect-yml.result }}
367+ python-ci-unit-tests:${{ needs.python-ci-unit-tests.result }}
368+ python-ci-lint:${{ needs.python-ci-lint.result }}
369+ python-ci-format:${{ needs.python-ci-format.result }}
370+ python-ci-type-check:${{ needs.python-ci-type-check.result }}
281371 EOF
282372
283- echo "Posting comment on GitHub Issue: https://github.com/firebase/firebase-android-sdk/issues/6857:"
284- cat message.txt
285- gh issue comment 6857 --body-file message.txt -R ${{ github.repository }}
373+ - uses : ./.github/actions/dataconnect-send-notifications
374+ with :
375+ python-version : ${{ env.FDC_PYTHON_VERSION }}
376+ github-issue-for-scheduled-runs : " 6857"
377+ job-results-file : ${{ runner.temp }}/job_results.txt
0 commit comments