|
9 | 9 | firebaseToolsVersion:
|
10 | 10 | gradleInfoLog:
|
11 | 11 | type: boolean
|
| 12 | + pythonVersion: |
12 | 13 | pull_request:
|
13 | 14 | paths:
|
14 | 15 | - .github/workflows/dataconnect.yml
|
|
24 | 25 | FDC_JAVA_VERSION: ${{ inputs.javaVersion || '17' }}
|
25 | 26 | FDC_ANDROID_EMULATOR_API_LEVEL: ${{ inputs.androidEmulatorApiLevel || '34' }}
|
26 | 27 | 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' }} |
28 | 29 | FDC_FIREBASE_TOOLS_DIR: /tmp/firebase-tools
|
29 | 30 | FDC_FIREBASE_COMMAND: /tmp/firebase-tools/node_modules/.bin/firebase
|
| 31 | + FDC_PYTHON_VERSION: ${{ inputs.pythonVersion || '3.13' }} |
30 | 32 |
|
31 | 33 | concurrency:
|
32 | 34 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
74 | 76 | npm install --fund=false --audit=false --save --save-exact firebase-tools@${{ env.FDC_FIREBASE_TOOLS_VERSION }}
|
75 | 77 |
|
76 | 78 | - name: Restore Gradle Cache
|
77 |
| - id: restore-gradle-cache |
78 | 79 | uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf # 4.2.2
|
79 | 80 | if: github.event_name != 'schedule'
|
80 | 81 | with:
|
@@ -170,43 +171,28 @@ jobs:
|
170 | 171 | ~/.android/adb*
|
171 | 172 | key: avd-cache-zhdsn586je-api${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}-${{ github.run_id }}
|
172 | 173 |
|
173 |
| - - name: Data Connect Emulator Start |
174 |
| - id: data-connect-emulator |
| 174 | + - name: Start Firebase Emulators |
175 | 175 | 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 |
| 176 | + set -xveuo pipefail |
180 | 177 |
|
181 |
| - ./gradlew \ |
182 |
| - ${{ (inputs.gradleInfoLog && '--info') || '' }} \ |
183 |
| - :firebase-dataconnect:connectors:runDebugDataConnectEmulator \ |
184 |
| - >firebase.emulator.dataconnect.log 2>&1 & |
185 |
| -
|
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 |
| 178 | + # Use the same dataconnect binary as was used for code generation in gradle assemble |
| 179 | + DATACONNECT_EMULATOR_BINARY_PATH="$(find "$PWD"/firebase-dataconnect/connectors/build/intermediates/dataconnect/debug/executable -type f)" |
| 180 | + if [[ -z $DATACONNECT_EMULATOR_BINARY_PATH ]] ; then |
| 181 | + echo "INTERNAL ERROR v7kg2dfhbc: unable to find data connect binary" >&2 |
| 182 | + exit 1 |
| 183 | + fi |
| 184 | + export DATACONNECT_EMULATOR_BINARY_PATH |
193 | 185 |
|
| 186 | + export FIREBASE_DATACONNECT_POSTGRESQL_STRING='postgresql://postgres:[email protected]:5432?sslmode=disable' |
194 | 187 | 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" |
| 188 | + ${{ env.FDC_FIREBASE_COMMAND }} emulators:start --only=auth,dataconnect >firebase.emulators.log 2>&1 & |
198 | 189 |
|
199 |
| - - name: Logcat Log Capture Start |
200 |
| - id: logcat-capture |
| 190 | + - name: Start Logcat Capture |
201 | 191 | continue-on-error: true
|
202 | 192 | run: |
|
203 |
| - set -euo pipefail |
204 |
| - set -xv |
205 |
| -
|
| 193 | + set -xveuo pipefail |
206 | 194 | "$ANDROID_HOME/platform-tools/adb" logcat >logcat.log 2>&1 &
|
207 | 195 |
|
208 |
| - echo "LOGCAT_PID=$!" >> "$GITHUB_ENV" |
209 |
| -
|
210 | 196 | - name: Gradle connectedCheck
|
211 | 197 | id: connectedCheck
|
212 | 198 | uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d #v2.33.0
|
@@ -256,30 +242,121 @@ jobs:
|
256 | 242 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
257 | 243 | with:
|
258 | 244 | show-progress: false
|
| 245 | + sparse-checkout: '.github/' |
259 | 246 | - uses: docker://rhysd/actionlint:1.7.7
|
260 | 247 | with:
|
261 | 248 | args: -color /github/workspace/.github/workflows/dataconnect.yml
|
262 | 249 |
|
| 250 | + python-ci-unit-tests: |
| 251 | + continue-on-error: false |
| 252 | + runs-on: ubuntu-latest |
| 253 | + steps: |
| 254 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 255 | + with: |
| 256 | + show-progress: false |
| 257 | + sparse-checkout: 'firebase-dataconnect/ci/' |
| 258 | + - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 |
| 259 | + with: |
| 260 | + python-version: ${{ env.FDC_PYTHON_VERSION }} |
| 261 | + - run: pip install -r firebase-dataconnect/ci/requirements.txt |
| 262 | + - name: pytest |
| 263 | + working-directory: firebase-dataconnect/ci |
| 264 | + run: pytest --verbose --full-trace --color=no --strict-config |
| 265 | + |
| 266 | + python-ci-lint: |
| 267 | + continue-on-error: false |
| 268 | + runs-on: ubuntu-latest |
| 269 | + steps: |
| 270 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 271 | + with: |
| 272 | + show-progress: false |
| 273 | + sparse-checkout: 'firebase-dataconnect/ci/' |
| 274 | + - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 |
| 275 | + with: |
| 276 | + python-version: ${{ env.FDC_PYTHON_VERSION }} |
| 277 | + - run: pip install -r firebase-dataconnect/ci/requirements.txt |
| 278 | + - name: ruff check |
| 279 | + working-directory: firebase-dataconnect/ci |
| 280 | + run: ruff check --diff --verbose --no-cache --output-format=github --exit-non-zero-on-fix |
| 281 | + |
| 282 | + python-ci-format: |
| 283 | + continue-on-error: false |
| 284 | + runs-on: ubuntu-latest |
| 285 | + steps: |
| 286 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 287 | + with: |
| 288 | + show-progress: false |
| 289 | + sparse-checkout: 'firebase-dataconnect/ci/' |
| 290 | + - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 |
| 291 | + with: |
| 292 | + python-version: ${{ env.FDC_PYTHON_VERSION }} |
| 293 | + - run: pip install -r firebase-dataconnect/ci/requirements.txt |
| 294 | + - name: ruff format |
| 295 | + working-directory: firebase-dataconnect/ci |
| 296 | + run: ruff format --diff --verbose --no-cache |
| 297 | + |
| 298 | + python-ci-type-check: |
| 299 | + continue-on-error: false |
| 300 | + runs-on: ubuntu-latest |
| 301 | + steps: |
| 302 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 303 | + with: |
| 304 | + show-progress: false |
| 305 | + sparse-checkout: 'firebase-dataconnect/ci/' |
| 306 | + - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 |
| 307 | + with: |
| 308 | + python-version: ${{ env.FDC_PYTHON_VERSION }} |
| 309 | + - run: pip install -r firebase-dataconnect/ci/requirements.txt |
| 310 | + - name: pyright |
| 311 | + working-directory: firebase-dataconnect/ci |
| 312 | + run: pyright --warnings --stats |
| 313 | + |
| 314 | + # The "send-notifications" job adds a comment to GitHub Issue |
| 315 | + # https://github.com/firebase/firebase-android-sdk/issues/6857 with the results of the scheduled |
| 316 | + # nightly runs. Interested parties can then subscribe to that issue to be aprised of the outcome |
| 317 | + # of the nightly runs. |
| 318 | + # |
| 319 | + # When testing the comment-adding logic itself, you can add the line |
| 320 | + # trksmnkncd_notification_issue=6863 |
| 321 | + # into the PR's description to instead post a comment to issue #6863, an issue specifically |
| 322 | + # created for testing, avoiding spamming the main issue to which others are subscribed. |
263 | 323 | send-notifications:
|
264 |
| - needs: [integration-test, actionlint-dataconnect-yml] |
| 324 | + needs: |
| 325 | + - 'integration-test' |
| 326 | + - 'actionlint-dataconnect-yml' |
| 327 | + - 'python-ci-unit-tests' |
| 328 | + - 'python-ci-lint' |
| 329 | + - 'python-ci-format' |
| 330 | + - 'python-ci-type-check' |
265 | 331 | if: always()
|
266 | 332 | permissions:
|
267 | 333 | issues: write
|
268 | 334 | runs-on: ubuntu-latest
|
269 | 335 | 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 |
| 336 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 337 | + with: |
| 338 | + show-progress: false |
| 339 | + sparse-checkout: | |
| 340 | + firebase-dataconnect/ci/ |
| 341 | + .github/ |
276 | 342 |
|
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 }} |
| 343 | + - name: gh auth login |
| 344 | + run: echo '${{ secrets.GITHUB_TOKEN }}' | gh auth login --with-token |
| 345 | + |
| 346 | + - name: Create Job Results File |
| 347 | + run: | |
| 348 | + set -xveuo pipefail |
| 349 | + cat >'${{ runner.temp }}/job_results.txt' <<EOF |
| 350 | + integration-test:${{ needs.integration-test.result }} |
| 351 | + actionlint-dataconnect-yml:${{ needs.actionlint-dataconnect-yml.result }} |
| 352 | + python-ci-unit-tests:${{ needs.python-ci-unit-tests.result }} |
| 353 | + python-ci-lint:${{ needs.python-ci-lint.result }} |
| 354 | + python-ci-format:${{ needs.python-ci-format.result }} |
| 355 | + python-ci-type-check:${{ needs.python-ci-type-check.result }} |
281 | 356 | EOF
|
282 | 357 |
|
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 }} |
| 358 | + - uses: ./.github/actions/dataconnect-send-notifications |
| 359 | + with: |
| 360 | + python-version: ${{ env.FDC_PYTHON_VERSION }} |
| 361 | + github-issue-for-scheduled-runs: "6857" |
| 362 | + job-results-file: ${{ runner.temp }}/job_results.txt |
0 commit comments