Skip to content

Commit e6d8af4

Browse files
committed
chore: add pipeline e2e test workflow and script for cloud_firestore
1 parent 0b14f1b commit e6d8af4

File tree

2 files changed

+147
-0
lines changed

2 files changed

+147
-0
lines changed
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: pipeline-e2e
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
pull_request:
9+
paths:
10+
- 'packages/cloud_firestore/cloud_firestore/pipeline_example/**'
11+
- 'packages/cloud_firestore/cloud_firestore/lib/**'
12+
push:
13+
branches:
14+
- main
15+
paths:
16+
- 'packages/cloud_firestore/cloud_firestore/pipeline_example/**'
17+
- 'packages/cloud_firestore/cloud_firestore/lib/**'
18+
19+
jobs:
20+
pipeline-e2e-android:
21+
if: ${{ secrets.PIPELINE_E2E_FIREBASE_OPTIONS_DART != '' }}
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 45
24+
env:
25+
AVD_ARCH: x86_64
26+
AVD_API_LEVEL: 34
27+
AVD_TARGET: google_apis
28+
steps:
29+
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
30+
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
31+
name: Install Node.js 20
32+
with:
33+
node-version: '20'
34+
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
35+
with:
36+
distribution: 'temurin'
37+
java-version: '21'
38+
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
39+
with:
40+
channel: 'stable'
41+
cache: true
42+
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
43+
pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:"
44+
- uses: bluefireteam/melos-action@c7dcb921b23cc520cace360b95d02b37bf09cdaa
45+
with:
46+
run-bootstrap: false
47+
melos-version: '5.3.0'
48+
- name: Inject Firebase config for pipeline E2E
49+
env:
50+
FIREBASE_OPTIONS_DART: ${{ secrets.PIPELINE_E2E_FIREBASE_OPTIONS_DART }}
51+
GOOGLE_SERVICES_JSON: ${{ secrets.PIPELINE_E2E_GOOGLE_SERVICES_JSON }}
52+
GOOGLE_SERVICE_INFO_PLIST: ${{ secrets.PIPELINE_E2E_GOOGLE_SERVICE_INFO_PLIST }}
53+
run: |
54+
echo "$FIREBASE_OPTIONS_DART" > packages/cloud_firestore/cloud_firestore/pipeline_example/lib/firebase_options.dart
55+
echo "$GOOGLE_SERVICES_JSON" > packages/cloud_firestore/cloud_firestore/pipeline_example/android/app/google-services.json
56+
echo "$GOOGLE_SERVICE_INFO_PLIST" > packages/cloud_firestore/cloud_firestore/pipeline_example/ios/Runner/GoogleService-Info.plist
57+
- name: Bootstrap package
58+
run: melos bootstrap --scope "cloud_firestore*"
59+
- name: Enable KVM
60+
run: |
61+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
62+
sudo udevadm control --reload-rules
63+
sudo udevadm trigger --name-match=kvm
64+
- name: Gradle cache
65+
uses: gradle/actions/setup-gradle@v4
66+
- name: Free Disk Space (Ubuntu)
67+
uses: AdityaGarg8/remove-unwanted-software@90e01b21170618765a73370fcc3abbd1684a7793
68+
with:
69+
remove-dotnet: true
70+
remove-haskell: true
71+
remove-codeql: true
72+
remove-docker-images: true
73+
remove-large-packages: true
74+
- name: AVD cache
75+
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
76+
continue-on-error: true
77+
id: avd-cache
78+
with:
79+
path: |
80+
~/.android/avd/*
81+
~/.android/adb*
82+
key: avd-${{ runner.os }}-${{ env.AVD_API_LEVEL }}-${{ env.AVD_TARGET }}-${{ env.AVD_ARCH }}
83+
- name: Start AVD then run pipeline E2E tests
84+
uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b
85+
with:
86+
api-level: ${{ env.AVD_API_LEVEL }}
87+
target: ${{ env.AVD_TARGET }}
88+
arch: ${{ env.AVD_ARCH }}
89+
emulator-build: 14214601
90+
working-directory: packages/cloud_firestore/cloud_firestore/pipeline_example
91+
script: |
92+
flutter test integration_test/pipeline/pipeline_live_test.dart --timeout 10x --dart-define=CI=true -d emulator-5554
93+
- name: Ensure Appium is shut down
94+
run: |
95+
pgrep -f appium && pkill -f appium || echo "No Appium process found"
96+
- name: Save Android Emulator Cache
97+
if: github.ref == 'refs/heads/main'
98+
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
99+
continue-on-error: true
100+
with:
101+
key: ${{ steps.avd-cache.outputs.cache-primary-key }}
102+
path: |
103+
~/.android/avd/*
104+
~/.android/adb*
105+
106+
pipeline-e2e-web:
107+
if: ${{ secrets.PIPELINE_E2E_FIREBASE_OPTIONS_DART != '' }}
108+
runs-on: ubuntu-latest
109+
timeout-minutes: 25
110+
steps:
111+
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
112+
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
113+
name: Install Node.js 20
114+
with:
115+
node-version: '20'
116+
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
117+
with:
118+
channel: 'stable'
119+
cache: true
120+
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
121+
pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:"
122+
- uses: bluefireteam/melos-action@c7dcb921b23cc520cace360b95d02b37bf09cdaa
123+
with:
124+
run-bootstrap: false
125+
melos-version: '5.3.0'
126+
- name: Inject Firebase config for pipeline E2E
127+
env:
128+
FIREBASE_OPTIONS_DART: ${{ secrets.PIPELINE_E2E_FIREBASE_OPTIONS_DART }}
129+
GOOGLE_SERVICES_JSON: ${{ secrets.PIPELINE_E2E_GOOGLE_SERVICES_JSON }}
130+
GOOGLE_SERVICE_INFO_PLIST: ${{ secrets.PIPELINE_E2E_GOOGLE_SERVICE_INFO_PLIST }}
131+
run: |
132+
echo "$FIREBASE_OPTIONS_DART" > packages/cloud_firestore/cloud_firestore/pipeline_example/lib/firebase_options.dart
133+
echo "$GOOGLE_SERVICES_JSON" > packages/cloud_firestore/cloud_firestore/pipeline_example/android/app/google-services.json
134+
echo "$GOOGLE_SERVICE_INFO_PLIST" > packages/cloud_firestore/cloud_firestore/pipeline_example/ios/Runner/GoogleService-Info.plist
135+
- name: Bootstrap package
136+
run: melos bootstrap --scope "cloud_firestore*"
137+
- name: Run pipeline E2E tests (Chrome)
138+
working-directory: packages/cloud_firestore/cloud_firestore/pipeline_example
139+
run: |
140+
flutter test integration_test/pipeline/pipeline_live_test.dart --timeout 10x --dart-define=CI=true -d chrome

melos.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,13 @@ scripts:
172172
description: |
173173
Run all e2e tests for cloud_firestore.
174174
175+
test:e2e:pipeline:
176+
run: |
177+
cd packages/cloud_firestore/cloud_firestore/pipeline_example
178+
flutter test integration_test/pipeline/pipeline_live_test.dart
179+
description: |
180+
Run pipeline e2e tests.
181+
175182
test:e2e:firebase_performance:
176183
run: |
177184
cd packages/firebase_performance/firebase_performance/example

0 commit comments

Comments
 (0)