Skip to content

dataconnect: dataconnect.yml: some minor improvements #6838

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 5, 2025
55 changes: 39 additions & 16 deletions .github/workflows/dataconnect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,16 @@ jobs:
with:
node-version: ${{ env.FDC_NODEJS_VERSION }}

- name: install firebase-tools
- name: Install Firebase Tools ("firebase" command-line tool)
run: |
set -euo pipefail
set -v
mkdir -p ${{ env.FDC_FIREBASE_TOOLS_DIR }}
cd ${{ env.FDC_FIREBASE_TOOLS_DIR }}
echo '{}' > package.json
npm install --fund=false --audit=false --save --save-exact firebase-tools@${{ env.FDC_FIREBASE_TOOLS_VERSION }}

- name: Restore Gradle cache
- name: Restore Gradle Cache
id: restore-gradle-cache
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf # 4.2.2
if: github.event_name != 'schedule'
Expand All @@ -84,9 +85,11 @@ jobs:
restore-keys: |
gradle-cache-jqnvfzw6w7-

- name: tool versions
- name: Print Command-Line Tool Versions
continue-on-error: true
run: |
set -euo pipefail

function run_cmd {
echo "==============================================================================="
echo "Running Command: $*"
Expand All @@ -105,6 +108,7 @@ jobs:

- name: Gradle assembleDebugAndroidTest
run: |
set -euo pipefail
set -v

# Speed up build times and also avoid configuring firebase-crashlytics-ndk
Expand All @@ -117,7 +121,7 @@ jobs:
${{ (inputs.gradleInfoLog && '--info') || '' }} \
:firebase-dataconnect:assembleDebugAndroidTest

- name: Save Gradle cache
- name: Save Gradle Cache
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf # 4.2.2
if: github.event_name == 'schedule'
with:
Expand All @@ -126,14 +130,15 @@ jobs:
~/.gradle/wrapper
key: gradle-cache-jqnvfzw6w7-${{ github.run_id }}

- name: Enable KVM group permissions for Android Emulator
- name: Enable KVM Group Permissions for Android Emulator
run: |
set -euo pipefail
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
| sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: Restore AVD cache
- name: Restore AVD Cache
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf # 4.2.2
if: github.event_name != 'schedule'
id: restore-avd-cache
Expand All @@ -156,7 +161,7 @@ jobs:
disable-animations: true
script: 'echo "Generated AVD snapshot for caching; event_name=${{ github.event_name }}, cache-matched-key=${{ steps.restore-avd-cache.outputs.cache-matched-key }}"'

- name: Save AVD cache
- name: Save AVD Cache
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf # 4.2.2
if: github.event_name == 'schedule'
with:
Expand All @@ -165,9 +170,11 @@ jobs:
~/.android/adb*
key: avd-cache-zhdsn586je-api${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}-${{ github.run_id }}

- name: Data Connect Emulator
- name: Data Connect Emulator Start
id: data-connect-emulator
run: |
set -x
set -euo pipefail
set -xv

echo 'emulator.postgresConnectionUrl=postgresql://postgres:[email protected]:5432?sslmode=disable' > firebase-dataconnect/dataconnect.local.properties

Expand All @@ -176,14 +183,29 @@ jobs:
:firebase-dataconnect:connectors:runDebugDataConnectEmulator \
>firebase.emulator.dataconnect.log 2>&1 &

- name: Firebase Auth Emulator
echo "FIREBASE_DATA_CONNECT_EMULATOR_PID=$!" >> "$GITHUB_ENV"

- name: Firebase Auth Emulator Start
id: firebase-auth-emulator
run: |
set -x
set -euo pipefail
set -xv

cd firebase-dataconnect/emulator
${{ env.FDC_FIREBASE_COMMAND }} emulators:start --only=auth >firebase.emulator.auth.log 2>&1 &

- name: Capture Logcat Logs
run: adb logcat >logcat.log &
echo "FIREBASE_AUTH_EMULATOR_PID=$!" >> "$GITHUB_ENV"

- name: Logcat Log Capture Start
id: logcat-capture
continue-on-error: true
run: |
set -euo pipefail
set -xv

"$ANDROID_HOME/platform-tools/adb" logcat >logcat.log 2>&1 &

echo "LOGCAT_PID=$!" >> "$GITHUB_ENV"

- name: Gradle connectedCheck
id: connectedCheck
Expand All @@ -201,25 +223,26 @@ jobs:
script: |
set -eux && ./gradlew ${{ (inputs.gradleInfoLog && '--info') || '' }} :firebase-dataconnect:connectedCheck :firebase-dataconnect:connectors:connectedCheck

- name: Upload log file artifacts
- name: Upload Log Files
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
with:
name: integration_test_logs
path: "**/*.log"
if-no-files-found: warn
compression-level: 9

- name: Upload Gradle build report artifacts
- name: Upload Gradle Build Reports
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
with:
name: integration_test_gradle_build_reports
path: firebase-dataconnect/**/build/reports/
if-no-files-found: warn
compression-level: 9

- name: Verify "Gradle connectedCheck" step was successful
- name: Verify "Gradle connectedCheck" Step Was Successful
if: steps.connectedCheck.outcome != 'success'
run: |
set -euo pipefail
echo 'Failing because the outcome of the "Gradle connectedCheck" step ("${{ steps.connectedCheck.outcome }}") was not successful'
exit 1

Expand Down
Loading