Skip to content

Commit 71c8827

Browse files
committed
dataconnect.yml added
1 parent 0711032 commit 71c8827

File tree

1 file changed

+124
-0
lines changed

1 file changed

+124
-0
lines changed

.github/workflows/dataconnect.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Data Connect Integration Tests
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
javaVersion:
7+
androidEmulatorApiLevel:
8+
gradleInfoLog:
9+
type: boolean
10+
pull_request:
11+
paths:
12+
- buildSrc/**
13+
- firebase-common/**
14+
- firebase-dataconnect/**
15+
- .github/workflows/dataconnect.yml
16+
schedule:
17+
- cron: '0 11 * * *' # Run nightly at 11am UTC (3am Pacific, 6am Eastern)
18+
19+
env:
20+
FST_JAVA_VERSION: ${{ inputs.javaVersion || '17' }}
21+
FST_ANDROID_EMULATOR_API_LEVEL: ${{ inputs.androidEmulatorApiLevel || '34' }}
22+
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
25+
cancel-in-progress: true
26+
27+
jobs:
28+
integration-test:
29+
continue-on-error: false
30+
runs-on: ubuntu-latest
31+
32+
services:
33+
postgres:
34+
image: postgres
35+
env:
36+
POSTGRES_PASSWORD: password
37+
options: >-
38+
--health-cmd pg_isready
39+
--health-interval 10s
40+
--health-timeout 5s
41+
--health-retries 5
42+
ports:
43+
- 5432:5432
44+
45+
steps:
46+
- uses: actions/checkout@v3
47+
48+
- uses: actions/setup-java@v4
49+
with:
50+
java-version: ${{ env.FST_JAVA_VERSION }}
51+
distribution: temurin
52+
53+
- name: tool versions
54+
continue-on-error: true
55+
run: |
56+
set +e -v
57+
uname -a
58+
which java
59+
java -version
60+
which javac
61+
javac -version
62+
./gradlew --version
63+
64+
- name: Enable KVM group permissions for Android Emulator
65+
run: |
66+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
67+
| sudo tee /etc/udev/rules.d/99-kvm4all.rules
68+
sudo udevadm control --reload-rules
69+
sudo udevadm trigger --name-match=kvm
70+
71+
- name: AVD cache
72+
uses: actions/cache@v4
73+
id: avd-cache
74+
with:
75+
path: |
76+
~/.android/avd/*
77+
~/.android/adb*
78+
key: avd-cache-zhdsn586je-api${{ env.FST_ANDROID_EMULATOR_API_LEVEL }}-ref${{ github.ref_name }}
79+
restore-keys: |
80+
avd-cache-zhdsn586je-api${{ env.FST_ANDROID_EMULATOR_API_LEVEL }}-ref${{ github.ref_name }}
81+
avd-cache-zhdsn586je-api${{ env.FST_ANDROID_EMULATOR_API_LEVEL }}-
82+
83+
- name: Create AVD and generate snapshot for caching
84+
if: steps.avd-cache.outputs.cache-hit != 'true'
85+
uses: reactivecircus/android-emulator-runner@v2
86+
with:
87+
api-level: ${{ env.FST_ANDROID_EMULATOR_API_LEVEL }}
88+
arch: x86_64
89+
force-avd-creation: false
90+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
91+
disable-animations: false
92+
script: echo "Generated AVD snapshot for caching."
93+
94+
- name: Data Connect Emulator
95+
run: |
96+
set -x
97+
98+
echo "emulator.postgresConnectionUrl=postgresql://postgres:[email protected]:5432?sslmode=disable" > firebase-dataconnect/dataconnect.local.properties
99+
100+
./gradlew \
101+
--no-daemon \
102+
${{ (inputs.gradleInfoLog && '--info') || '' }} \
103+
:firebase-dataconnect:connectors:runDebugDataConnectEmulator \
104+
2>&1 >dataconnect.emulator.log &
105+
106+
sleep 5s
107+
108+
- name: Gradle connectedCheck
109+
uses: reactivecircus/android-emulator-runner@v2
110+
with:
111+
api-level: ${{ env.FST_ANDROID_EMULATOR_API_LEVEL }}
112+
arch: x86_64
113+
force-avd-creation: false
114+
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
115+
disable-animations: true
116+
script: |
117+
set -x && ./gradlew --no-daemon ${{ (inputs.gradleInfoLog && '--info') || '' }} --profile :firebase-dataconnect:connectedCheck :firebase-dataconnect:connectors:connectedCheck'
118+
119+
- uses: actions/upload-artifact@v4
120+
with:
121+
name: logs
122+
path: **/*.log
123+
if-no-files-found: warn
124+
compression-level: 9

0 commit comments

Comments
 (0)