Skip to content
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
a0a89a9
dataconnect.yml: improve send-notifications message and allow specify…
dconeybe Apr 15, 2025
38a4068
ci skeleton added
dconeybe Apr 15, 2025
4c9ba07
add copyright
dconeybe Apr 15, 2025
14c4a81
dataconnect.yml: fix typos
dconeybe Apr 15, 2025
7b7cb4c
fixes
dconeybe Apr 15, 2025
ee1e41d
work
dconeybe Apr 15, 2025
25e7a8f
fix typo
dconeybe Apr 15, 2025
44ea96f
fixes
dconeybe Apr 15, 2025
9db3470
notify_issue_test.py added
dconeybe Apr 15, 2025
76a92d0
Merge remote-tracking branch 'origin/main' into CiPostMessageImprovem…
dconeybe Apr 15, 2025
407983a
dataconnect.yml: remove `readonly` modifier to fix error: `pr_number:…
dconeybe Apr 15, 2025
c43e49b
Merge branch 'CiPostMessageImprovements' into CiNotifyPython
dconeybe Apr 15, 2025
97229fb
dataconnect.yml: add `-R ${{ github.repository }}` to `gh` command line
dconeybe Apr 15, 2025
ee19c58
Merge branch 'CiPostMessageImprovements' into CiNotifyPython
dconeybe Apr 15, 2025
c92025e
Merge branch 'main' into dconeybe/dataconnect/CiPostMessageImprovements
dconeybe Apr 16, 2025
4cef939
dataconnect.yml: fix `[[ -v $issue_from_pr_body ]]` to `[[ -v issue_f…
dconeybe Apr 16, 2025
2c0d3d7
Merge branch 'dconeybe/dataconnect/CiPostMessageImprovements' into dc…
dconeybe Apr 16, 2025
e679e1d
calculate_github_issue_for_commenting.py added (incomplete)
dconeybe Apr 16, 2025
dcf440e
work
dconeybe Apr 16, 2025
7dbe558
README.md added
dconeybe Apr 16, 2025
9d434f2
work
dconeybe Apr 16, 2025
dcdaef7
work
dconeybe Apr 16, 2025
34f82ac
post_comment_for_job_results.py added
dconeybe Apr 16, 2025
63fdb92
dataconnect.yaml: use calculate_github_issue_for_commenting.py
dconeybe Apr 16, 2025
efd400c
dataconnect.yml: use post_comment_for_job_results.py
dconeybe Apr 16, 2025
e26a9a5
fix working directory
dconeybe Apr 16, 2025
2ef2763
requirements.txt updated
dconeybe Apr 16, 2025
5713afb
dataconnect_demo_app.yml: post notifications like dataconnect.yml does
dconeybe Apr 16, 2025
d242e67
dataconnect.yml: code cleanup to match dataconnect_demo_app.yml
dconeybe Apr 16, 2025
4d5f215
work
dconeybe Apr 16, 2025
5211fdf
add pr info
dconeybe Apr 16, 2025
41c1500
update workflow files for new command-line args
dconeybe Apr 16, 2025
8ff4c86
post_comment_for_job_results.py: avoid unnecessarily repeating the pr…
dconeybe Apr 16, 2025
e443015
post_comment_for_job_results.py: add backticks around numbers so that…
dconeybe Apr 16, 2025
e3eeb34
Merge remote-tracking branch 'origin/main' into CiNotifyPython
dconeybe Apr 17, 2025
8177f76
README.md updated
dconeybe Apr 17, 2025
f746ee9
dataconnect_demo_app.yml: factor out notification sending into .githu…
dconeybe Apr 17, 2025
0f6d148
dataconnect_demo_app.yml: remove default dir because it's causing com…
dconeybe Apr 17, 2025
65e4571
dataconnect_demo_app.yml: fix path to gradlew
dconeybe Apr 17, 2025
6e85e2f
dataconnect_demo_app.yml: use runner.temp and checkout repo before ca…
dconeybe Apr 17, 2025
7f73aaf
dataconnect_demo_app.yml/dataconnect-send-notifications/action.yml: m…
dconeybe Apr 17, 2025
a18af72
dataconnect.yml: use the composite action
dconeybe Apr 17, 2025
acbabac
include pr title in posted comment
dconeybe Apr 17, 2025
da2594c
include github.event_name in posted comment
dconeybe Apr 17, 2025
717dfdc
util.py: strip leading/trailing whitespace from output before printing
dconeybe Apr 17, 2025
5a352eb
pyproject.toml: remove broken and unneeded line: `markers = [ "parama…
dconeybe Apr 17, 2025
802fa36
fix spelling error in message: specfication
dconeybe Apr 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/actions/dataconnect-send-notifications/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Data Connect Workflow Notifications
description: Notify a GitHub Issue with the results of a workflow.

inputs:
python-version:
required: true
default: "3.13"
github-issue-for-scheduled-runs:
required: true
job-results-file:
required: true

runs:
using: "composite"
steps:
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: ${{ inputs.python-version }}

- run: pip install -r requirements.txt
shell: bash
working-directory: firebase-dataconnect/ci

- id: issue-id
name: Determine GitHub Issue For Commenting
working-directory: firebase-dataconnect/ci
shell: bash
run: |
args=(
python
calculate_github_issue_for_commenting.py
--issue-output-file=github_issue_number.txt
--github-repository='${{ github.repository }}'
--github-ref='${{ github.ref }}'
--github-event-name='${{ github.event_name }}'
--pr-body-github-issue-key=trksmnkncd_notification_issue
--github-issue-for-scheduled-run='${{ inputs.github-issue-for-scheduled-runs }}'
)
echo "${args[*]}"
"${args[@]}"
set -xv
issue="$(cat github_issue_number.txt)"
echo "issue=$issue" >> "$GITHUB_OUTPUT"
- name: Post Comment on GitHub Issue
if: steps.issue-id.outputs.issue != ''
working-directory: firebase-dataconnect/ci
shell: bash
run: |
args=(
python
post_comment_for_job_results.py
--github-issue='${{ steps.issue-id.outputs.issue }}'
--github-workflow='${{ github.workflow }}'
--github-repository='${{ github.repository }}'
--github-ref='${{ github.ref }}'
--github-event-name='${{ github.event_name }}'
--github-sha='${{ github.sha }}'
--github-repository-html-url='${{ github.event.repository.html_url }}'
--github-run-id='${{ github.run_id }}'
--github-run-number='${{ github.run_number }}'
--github-run-attempt='${{ github.run_attempt }}'
)
while read -r line; do
args=("${args[@]}" "$line")
done <'${{ inputs.job-results-file }}'
echo "${args[*]}"
exec "${args[@]}"
122 changes: 108 additions & 14 deletions .github/workflows/dataconnect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
firebaseToolsVersion:
gradleInfoLog:
type: boolean
pythonVersion:
pull_request:
paths:
- .github/workflows/dataconnect.yml
Expand All @@ -27,6 +28,7 @@ env:
FDC_FIREBASE_TOOLS_VERSION: ${{ inputs.firebaseToolsVersion || '13.29.1' }}
FDC_FIREBASE_TOOLS_DIR: /tmp/firebase-tools
FDC_FIREBASE_COMMAND: /tmp/firebase-tools/node_modules/.bin/firebase
FDC_PYTHON_VERSION: ${{ inputs.pythonVersion || '3.13' }}

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -256,30 +258,122 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
show-progress: false
sparse-checkout: '.github/'
- uses: docker://rhysd/actionlint:1.7.7
with:
args: -color /github/workspace/.github/workflows/dataconnect.yml

python-ci-unit-tests:
continue-on-error: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
show-progress: false
sparse-checkout: 'firebase-dataconnect/ci/'
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: ${{ env.FDC_PYTHON_VERSION }}
- run: pip install -r firebase-dataconnect/ci/requirements.txt
- name: pytest
working-directory: firebase-dataconnect/ci
run: pytest --verbose --full-trace --color=no --strict-config

python-ci-lint:
continue-on-error: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
show-progress: false
sparse-checkout: 'firebase-dataconnect/ci/'
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: ${{ env.FDC_PYTHON_VERSION }}
- run: pip install -r firebase-dataconnect/ci/requirements.txt
- name: ruff check
working-directory: firebase-dataconnect/ci
run: ruff check --diff --verbose --no-cache --output-format=github --exit-non-zero-on-fix

python-ci-format:
continue-on-error: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
show-progress: false
sparse-checkout: 'firebase-dataconnect/ci/'
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: ${{ env.FDC_PYTHON_VERSION }}
- run: pip install -r firebase-dataconnect/ci/requirements.txt
- name: ruff format
working-directory: firebase-dataconnect/ci
run: ruff format --diff --verbose --no-cache

python-ci-type-check:
continue-on-error: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
show-progress: false
sparse-checkout: 'firebase-dataconnect/ci/'
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: ${{ env.FDC_PYTHON_VERSION }}
- run: pip install -r firebase-dataconnect/ci/requirements.txt
- name: pyright
working-directory: firebase-dataconnect/ci
run: pyright --warnings --stats

# The "send-notifications" job adds a comment to GitHub Issue
# https://github.com/firebase/firebase-android-sdk/issues/6857 with the results of the scheduled
# nightly runs. Interested parties can then subscribe to that issue to be aprised of the outcome
# of the nightly runs.
#
# When testing the comment-adding logic itself, you can add the line
# trksmnkncd_notification_issue=6863
# into the PR's description to instead post a comment to issue #6863, an issue specifically
# created for testing, avoiding spamming the main issue to which others are subscribed.
send-notifications:
needs: [integration-test, actionlint-dataconnect-yml]
needs:
- 'integration-test'
- 'actionlint-dataconnect-yml'
- 'python-ci-unit-tests'
- 'python-ci-lint'
- 'python-ci-format'
- 'python-ci-type-check'
if: always()
permissions:
issues: write
runs-on: ubuntu-latest
steps:
- name: Post Comment on Issue #6857
if: github.event_name == 'schedule'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
show-progress: false
sparse-checkout: |
firebase-dataconnect/ci/
.github/

- name: gh auth login
run: echo '${{ secrets.GITHUB_TOKEN }}' | gh auth login --with-token

cat >message.txt <<EOF
Result of workflow ${{ github.workflow }} at ${{ github.ref }}: ${{ job.status }}
${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}
job=${{ github.job }} run_id=${{ github.run_id }} run_number=${{ github.run_number }} run_attempt=${{ github.run_attempt }}
- name: Create Job Results File
id: create-job-results-file
run: |
set -xveuo pipefail
cat >'${{ runner.temp }}/job_results.txt' <<EOF
integration-test:${{ needs.integration-test.result }}
actionlint-dataconnect-yml:${{ needs.actionlint-dataconnect-yml.result }}
python-ci-unit-tests:${{ needs.python-ci-unit-tests.result }}
python-ci-lint:${{ needs.python-ci-lint.result }}
python-ci-format:${{ needs.python-ci-format.result }}
python-ci-type-check:${{ needs.python-ci-type-check.result }}
EOF

echo "Posting comment on GitHub Issue: https://github.com/firebase/firebase-android-sdk/issues/6857:"
cat message.txt
gh issue comment 6857 --body-file message.txt -R ${{ github.repository }}
- uses: ./.github/actions/dataconnect-send-notifications
with:
python-version: ${{ env.FDC_PYTHON_VERSION }}
github-issue-for-scheduled-runs: "6857"
job-results-file: ${{ runner.temp }}/job_results.txt
72 changes: 57 additions & 15 deletions .github/workflows/dataconnect_demo_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
javaVersion:
gradleInfoLog:
type: boolean
pythonVersion:
pull_request:
paths:
- firebase-dataconnect/demo/**
Expand All @@ -21,11 +22,7 @@ env:
FDC_JAVA_VERSION: ${{ inputs.javaVersion || '17' }}
FDC_FIREBASE_TOOLS_DIR: ${{ github.workspace }}/firebase-tools
FDC_FIREBASE_COMMAND: ${{ github.workspace }}/firebase-tools/node_modules/.bin/firebase

defaults:
run:
shell: bash
working-directory: firebase-dataconnect/demo
FDC_PYTHON_VERSION: ${{ inputs.pythonVersion || '3.13' }}

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -50,8 +47,8 @@ jobs:
node-version: ${{ env.FDC_NODE_VERSION }}
cache: 'npm'
cache-dependency-path: |
firebase-dataconnect/demo/github_actions_demo_test_cache_key.txt
firebase-dataconnect/demo/github_actions_demo_assemble_firebase_tools_version.txt
github_actions_demo_test_cache_key.txt
github_actions_demo_assemble_firebase_tools_version.txt

- name: cache package-lock.json
id: package_json_lock
Expand Down Expand Up @@ -84,7 +81,7 @@ jobs:
firebase-dataconnect/demo/build.gradle.kts
firebase-dataconnect/demo/gradle.properties
firebase-dataconnect/demo/gradle/wrapper/gradle-wrapper.properties
firebase-dataconnect/demo/github_actions_demo_test_cache_key.txt
github_actions_demo_test_cache_key.txt

- name: tool versions
continue-on-error: true
Expand All @@ -102,12 +99,13 @@ jobs:
run_cmd which node
run_cmd node --version
run_cmd ${{ env.FDC_FIREBASE_COMMAND }} --version
run_cmd ./gradlew --version
run_cmd firebase-dataconnect/demo/gradlew --version

- name: ./gradlew assemble test
- name: gradle assemble test
run: |
set -x
./gradlew \
firebase-dataconnect/demo/gradlew \
--project-dir firebase-dataconnect/demo \
--no-daemon \
${{ (inputs.gradleInfoLog && '--info') || '' }} \
--profile \
Expand Down Expand Up @@ -148,7 +146,7 @@ jobs:
firebase-dataconnect/demo/build.gradle.kts
firebase-dataconnect/demo/gradle.properties
firebase-dataconnect/demo/gradle/wrapper/gradle-wrapper.properties
firebase-dataconnect/demo/github_actions_demo_spotless_cache_key.txt
github_actions_demo_spotless_cache_key.txt

- name: tool versions
continue-on-error: true
Expand All @@ -158,12 +156,56 @@ jobs:
java -version
which javac
javac -version
./gradlew --version
firebase-dataconnect/demo/gradlew --version

- name: ./gradlew spotlessCheck
- name: gradle spotlessCheck
run: |
set -x
./gradlew \
firebase-dataconnect/demo/gradlew \
--project-dir firebase-dataconnect/demo \
--no-daemon \
${{ (inputs.gradleInfoLog && '--info') || '' }} \
spotlessCheck

# The "send-notifications" job adds a comment to GitHub Issue
# https://github.com/firebase/firebase-android-sdk/issues/6891 with the results of the scheduled
# nightly runs. Interested parties can then subscribe to that issue to be aprised of the outcome
# of the nightly runs.
#
# When testing the comment-adding logic itself, you can add the line
# trksmnkncd_notification_issue=6863
# into the PR's description to instead post a comment to issue #6863, an issue specifically
# created for testing, avoiding spamming the main issue to which others are subscribed.
send-notifications:
needs:
- 'test'
- 'spotlessCheck'
if: always()
permissions:
issues: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
show-progress: false
sparse-checkout: |
firebase-dataconnect/ci/
.github/

- name: gh auth login
run: echo '${{ secrets.GITHUB_TOKEN }}' | gh auth login --with-token

- name: Create Job Results File
id: create-job-results-file
run: |
set -xveuo pipefail
cat >'${{ runner.temp }}/job_results.txt' <<EOF
test:${{ needs.test.result }}
spotlessCheck:${{ needs.spotlessCheck.result }}
EOF

- uses: ./.github/actions/dataconnect-send-notifications
with:
python-version: ${{ env.FDC_PYTHON_VERSION }}
github-issue-for-scheduled-runs: "6891"
job-results-file: ${{ runner.temp }}/job_results.txt
22 changes: 22 additions & 0 deletions firebase-dataconnect/ci/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Firebase Data Connect Android SDK Continuous Integration Scripts

These scripts are used by GitHub Actions.

There are GitHub Actions workflows that verify code formatting, lint checks, type annotations,
and running unit tests of code in this directory. Although they are not "required" checks, it
is requested to wait for these checks to pass. See `dataconnect.yaml`.

The minimum required Python version (at the time of writing, April 2025) is 3.13.
See `pyproject.toml` for the most up-to-date requirement.

Before running the scripts, install the required dependencies by running:

```
pip install -r requirements.txt
```

Then, run all of these presubmit checks by running the following command:

```
ruff check && ruff format && pyright && pytest && echo 'SUCCESS!!!!!!!!!!!!!!!'
```
Loading
Loading