Skip to content

Commit 8f6dc7a

Browse files
authored
Merge branch 'releases/m163' into releases/m163.release
2 parents 65c0240 + 7b1855d commit 8f6dc7a

File tree

198 files changed

+14718
-1301
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+14718
-1301
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Data Connect Workflow Notifications
2+
description: Notify a GitHub Issue with the results of a workflow.
3+
4+
inputs:
5+
python-version:
6+
required: true
7+
default: "3.13"
8+
github-issue-for-scheduled-runs:
9+
required: true
10+
job-results-file:
11+
required: true
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
17+
with:
18+
python-version: ${{ inputs.python-version }}
19+
20+
- run: pip install -r requirements.txt
21+
shell: bash
22+
working-directory: firebase-dataconnect/ci
23+
24+
- id: issue-id
25+
name: Determine GitHub Issue For Commenting
26+
working-directory: firebase-dataconnect/ci
27+
shell: bash
28+
run: |
29+
args=(
30+
python
31+
calculate_github_issue_for_commenting.py
32+
--issue-output-file=github_issue_number.txt
33+
--github-repository='${{ github.repository }}'
34+
--github-ref='${{ github.ref }}'
35+
--github-event-name='${{ github.event_name }}'
36+
--pr-body-github-issue-key=trksmnkncd_notification_issue
37+
--github-issue-for-scheduled-run='${{ inputs.github-issue-for-scheduled-runs }}'
38+
)
39+
echo "${args[*]}"
40+
"${args[@]}"
41+
42+
set -xv
43+
issue="$(cat github_issue_number.txt)"
44+
echo "issue=$issue" >> "$GITHUB_OUTPUT"
45+
46+
- name: Post Comment on GitHub Issue
47+
if: steps.issue-id.outputs.issue != ''
48+
working-directory: firebase-dataconnect/ci
49+
shell: bash
50+
run: |
51+
args=(
52+
python
53+
post_comment_for_job_results.py
54+
--github-issue='${{ steps.issue-id.outputs.issue }}'
55+
--github-workflow='${{ github.workflow }}'
56+
--github-repository='${{ github.repository }}'
57+
--github-ref='${{ github.ref }}'
58+
--github-event-name='${{ github.event_name }}'
59+
--github-sha='${{ github.sha }}'
60+
--github-repository-html-url='${{ github.event.repository.html_url }}'
61+
--github-run-id='${{ github.run_id }}'
62+
--github-run-number='${{ github.run_number }}'
63+
--github-run-attempt='${{ github.run_attempt }}'
64+
)
65+
66+
while read -r line; do
67+
args=("${args[@]}" "$line")
68+
done <'${{ inputs.job-results-file }}'
69+
70+
echo "${args[*]}"
71+
exec "${args[@]}"

.github/workflows/check-vertexai-responses.yml renamed to .github/workflows/check-firebaseai-responses.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Check Vertex AI Responses
1+
name: Check Firebase AI Responses
22

33
on: pull_request
44

@@ -10,30 +10,30 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1212
- name: Clone mock responses
13-
run: firebase-vertexai/update_responses.sh
13+
run: firebase-ai/update_responses.sh
1414
- name: Find cloned and latest versions
1515
run: |
1616
CLONED=$(git describe --tags)
1717
LATEST=$(git tag --sort=v:refname | tail -n1)
1818
echo "cloned_tag=$CLONED" >> $GITHUB_ENV
1919
echo "latest_tag=$LATEST" >> $GITHUB_ENV
20-
working-directory: firebase-vertexai/src/test/resources/vertexai-sdk-test-data
20+
working-directory: firebase-ai/src/test/resources/vertexai-sdk-test-data
2121
- name: Find comment from previous run if exists
2222
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
2323
id: fc
2424
with:
2525
issue-number: ${{github.event.number}}
26-
body-includes: Vertex AI Mock Responses Check
26+
body-includes: Firebase AI Mock Responses Check
2727
- name: Comment on PR if newer version is available
2828
if: ${{env.cloned_tag != env.latest_tag && !steps.fc.outputs.comment-id}}
2929
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
3030
with:
3131
issue-number: ${{github.event.number}}
3232
body: >
33-
### Vertex AI Mock Responses Check :warning:
33+
### Firebase AI Mock Responses Check :warning:
3434
35-
A newer major version of the mock responses for Vertex AI unit tests is available.
36-
[update_responses.sh](https://github.com/firebase/firebase-android-sdk/blob/main/firebase-vertexai/update_responses.sh)
35+
A newer major version of the mock responses for Firebase AI unit tests is available.
36+
[update_responses.sh](https://github.com/firebase/firebase-android-sdk/blob/main/firebase-ai/update_responses.sh)
3737
should be updated to clone the latest version of the responses: `${{env.latest_tag}}`
3838
- name: Delete comment when version gets updated
3939
if: ${{env.cloned_tag == env.latest_tag && steps.fc.outputs.comment-id}}

.github/workflows/ci_tests.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,14 @@ jobs:
5656
distribution: temurin
5757
cache: gradle
5858

59-
- name: Clone mock responses
59+
- name: Clone vertexai mock responses
6060
if: matrix.module == ':firebase-vertexai'
6161
run: firebase-vertexai/update_responses.sh
6262

63+
- name: Clone ai mock responses
64+
if: matrix.module == ':firebase-ai'
65+
run: firebase-ai/update_responses.sh
66+
6367
- name: Add google-services.json
6468
env:
6569
INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.INTEG_TESTS_GOOGLE_SERVICES }}

.github/workflows/dataconnect.yml

+136-44
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
firebaseToolsVersion:
1010
gradleInfoLog:
1111
type: boolean
12+
pythonVersion:
1213
pull_request:
1314
paths:
1415
- .github/workflows/dataconnect.yml
@@ -24,9 +25,10 @@ env:
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.2.0' }}
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

3133
concurrency:
3234
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -64,6 +66,12 @@ jobs:
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
@@ -74,7 +82,6 @@ jobs:
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

Comments
 (0)