Skip to content

Commit 39e5a80

Browse files
authored
chore(ci): nightly build and test setup (#18225)
1 parent 2711b61 commit 39e5a80

2 files changed

Lines changed: 454 additions & 0 deletions

File tree

.github/workflows/nightly.yaml

Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
name: nightly-ci
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: false
6+
7+
on:
8+
# schedule:
9+
# - cron: '0 4 * * *'
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
issues: write
15+
16+
jobs:
17+
pipeline-e2e-android:
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 45
20+
env:
21+
AVD_ARCH: x86_64
22+
AVD_API_LEVEL: 34
23+
AVD_TARGET: google_apis
24+
steps:
25+
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
26+
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
27+
name: Install Node.js 20
28+
with:
29+
node-version: '20'
30+
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
31+
with:
32+
distribution: 'temurin'
33+
java-version: '21'
34+
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
35+
with:
36+
channel: 'stable'
37+
cache: true
38+
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
39+
pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:"
40+
- uses: bluefireteam/melos-action@c7dcb921b33cc520cace360b95d02b37bf09cdaa
41+
with:
42+
run-bootstrap: false
43+
melos-version: '5.3.0'
44+
- name: Inject Firebase config for pipeline E2E
45+
env:
46+
FIREBASE_OPTIONS_DART: ${{ secrets.PIPELINE_E2E_FIREBASE_OPTIONS_DART }}
47+
GOOGLE_SERVICES_JSON: ${{ secrets.PIPELINE_E2E_GOOGLE_SERVICES_JSON }}
48+
GOOGLE_SERVICE_INFO_PLIST: ${{ secrets.PIPELINE_E2E_GOOGLE_SERVICE_INFO_PLIST }}
49+
run: |
50+
echo "$FIREBASE_OPTIONS_DART" > packages/cloud_firestore/cloud_firestore/pipeline_example/lib/firebase_options.dart
51+
echo "$GOOGLE_SERVICES_JSON" > packages/cloud_firestore/cloud_firestore/pipeline_example/android/app/google-services.json
52+
echo "$GOOGLE_SERVICE_INFO_PLIST" > packages/cloud_firestore/cloud_firestore/pipeline_example/ios/Runner/GoogleService-Info.plist
53+
- name: Bootstrap package
54+
run: melos bootstrap --scope "cloud_firestore*"
55+
- name: Enable KVM
56+
run: |
57+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
58+
sudo udevadm control --reload-rules
59+
sudo udevadm trigger --name-match=kvm
60+
- name: Gradle cache
61+
uses: gradle/actions/setup-gradle@v4
62+
- name: Free Disk Space (Ubuntu)
63+
uses: AdityaGarg8/remove-unwanted-software@90e01b21170618765a73370fcc3abbd1684a7793
64+
with:
65+
remove-dotnet: true
66+
remove-haskell: true
67+
remove-codeql: true
68+
remove-docker-images: true
69+
remove-large-packages: true
70+
- name: AVD cache
71+
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
72+
continue-on-error: true
73+
id: avd-cache
74+
with:
75+
path: |
76+
~/.android/avd/*
77+
~/.android/adb*
78+
key: avd-${{ runner.os }}-${{ env.AVD_API_LEVEL }}-${{ env.AVD_TARGET }}-${{ env.AVD_ARCH }}
79+
- name: Start AVD then run pipeline E2E tests
80+
uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b
81+
with:
82+
api-level: ${{ env.AVD_API_LEVEL }}
83+
target: ${{ env.AVD_TARGET }}
84+
arch: ${{ env.AVD_ARCH }}
85+
emulator-build: 14214601
86+
working-directory: packages/cloud_firestore/cloud_firestore/pipeline_example
87+
script: |
88+
flutter test integration_test/pipeline/pipeline_live_test.dart --timeout 10x --dart-define=CI=true -d emulator-5554
89+
- name: Ensure Appium is shut down
90+
run: |
91+
pgrep -f appium && pkill -f appium || echo "No Appium process found"
92+
- name: Save Android Emulator Cache
93+
if: github.ref == 'refs/heads/main'
94+
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
95+
continue-on-error: true
96+
with:
97+
key: ${{ steps.avd-cache.outputs.cache-primary-key }}
98+
path: |
99+
~/.android/avd/*
100+
~/.android/adb*
101+
102+
pipeline-e2e-web:
103+
runs-on: macos-latest
104+
timeout-minutes: 25
105+
steps:
106+
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
107+
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
108+
name: Install Node.js 20
109+
with:
110+
node-version: '20'
111+
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
112+
with:
113+
channel: 'stable'
114+
cache: true
115+
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
116+
pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:"
117+
- uses: bluefireteam/melos-action@c7dcb921b23cc520cace360b95d02b37bf09cdaa
118+
with:
119+
run-bootstrap: false
120+
melos-version: '5.3.0'
121+
- name: Inject Firebase config for pipeline E2E
122+
env:
123+
FIREBASE_OPTIONS_DART: ${{ secrets.PIPELINE_E2E_FIREBASE_OPTIONS_DART }}
124+
GOOGLE_SERVICES_JSON: ${{ secrets.PIPELINE_E2E_GOOGLE_SERVICES_JSON }}
125+
GOOGLE_SERVICE_INFO_PLIST: ${{ secrets.PIPELINE_E2E_GOOGLE_SERVICE_INFO_PLIST }}
126+
run: |
127+
echo "$FIREBASE_OPTIONS_DART" > packages/cloud_firestore/cloud_firestore/pipeline_example/lib/firebase_options.dart
128+
echo "$GOOGLE_SERVICES_JSON" > packages/cloud_firestore/cloud_firestore/pipeline_example/android/app/google-services.json
129+
echo "$GOOGLE_SERVICE_INFO_PLIST" > packages/cloud_firestore/cloud_firestore/pipeline_example/ios/Runner/GoogleService-Info.plist
130+
- name: Bootstrap package
131+
run: melos bootstrap --scope "cloud_firestore*"
132+
- name: Run pipeline E2E tests (Chrome)
133+
working-directory: packages/cloud_firestore/cloud_firestore/pipeline_example
134+
run: |
135+
chromedriver --port=4444 --trace-buffer-size=100000 &
136+
flutter drive --target=./integration_test/pipeline/pipeline_live_test.dart --driver=./test_driver/integration_test.dart -d chrome --dart-define=CI=true | tee output.log
137+
output=$(<output.log)
138+
if [[ "$output" =~ \[E\] ]]; then
139+
echo "All tests did not pass. Please check the logs for more information."
140+
exit 1
141+
fi
142+
shell: bash
143+
144+
pipeline-e2e-ios:
145+
runs-on: macos-15
146+
timeout-minutes: 50
147+
steps:
148+
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
149+
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
150+
name: Install Node.js 20
151+
with:
152+
node-version: '20'
153+
- name: Xcode
154+
run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
155+
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
156+
with:
157+
distribution: 'temurin'
158+
java-version: '21'
159+
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
160+
with:
161+
channel: 'stable'
162+
cache: true
163+
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
164+
pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:"
165+
- name: Enable Swift Package Manager for iOS
166+
run: flutter config --enable-swift-package-manager
167+
- uses: bluefireteam/melos-action@c7dcb921b23cc520cace360b95d02b37bf09cdaa
168+
with:
169+
run-bootstrap: false
170+
melos-version: '5.3.0'
171+
- name: Inject Firebase config for pipeline E2E
172+
env:
173+
FIREBASE_OPTIONS_DART: ${{ secrets.PIPELINE_E2E_FIREBASE_OPTIONS_DART }}
174+
GOOGLE_SERVICES_JSON: ${{ secrets.PIPELINE_E2E_GOOGLE_SERVICES_JSON }}
175+
GOOGLE_SERVICE_INFO_PLIST: ${{ secrets.PIPELINE_E2E_GOOGLE_SERVICE_INFO_PLIST }}
176+
run: |
177+
echo "$FIREBASE_OPTIONS_DART" > packages/cloud_firestore/cloud_firestore/pipeline_example/lib/firebase_options.dart
178+
echo "$GOOGLE_SERVICES_JSON" > packages/cloud_firestore/cloud_firestore/pipeline_example/android/app/google-services.json
179+
echo "$GOOGLE_SERVICE_INFO_PLIST" > packages/cloud_firestore/cloud_firestore/pipeline_example/ios/Runner/GoogleService-Info.plist
180+
- name: Bootstrap package
181+
run: melos bootstrap --scope "cloud_firestore*"
182+
- name: Prepare iOS project for Swift Package Manager
183+
working-directory: packages/cloud_firestore/cloud_firestore/pipeline_example/ios
184+
run: |
185+
if [ -f Podfile ]; then pod deintegrate; fi
186+
rm -f Podfile Podfile.lock
187+
rm -rf Pods
188+
- uses: futureware-tech/simulator-action@e89aa8f93d3aec35083ff49d2854d07f7186f7f5
189+
id: simulator
190+
with:
191+
model: "iPhone 16"
192+
- name: Build iOS (simulator)
193+
working-directory: packages/cloud_firestore/cloud_firestore/pipeline_example
194+
run: |
195+
flutter build ios --no-codesign --simulator --debug --target=./integration_test/pipeline/pipeline_live_test.dart --dart-define=CI=true
196+
- name: Run pipeline E2E tests (iOS)
197+
working-directory: packages/cloud_firestore/cloud_firestore/pipeline_example
198+
env:
199+
SIMULATOR: ${{ steps.simulator.outputs.udid }}
200+
run: |
201+
perl -e 'alarm 360; exec @ARGV' -- flutter test integration_test/pipeline/pipeline_live_test.dart -d "$SIMULATOR" --timeout 10x --dart-define=CI=true || {
202+
echo "First attempt failed or timed out. Rebooting simulator and retrying..."
203+
xcrun simctl shutdown "$SIMULATOR" || true
204+
xcrun simctl boot "$SIMULATOR"
205+
xcrun simctl bootstatus "$SIMULATOR" -b
206+
flutter test integration_test/pipeline/pipeline_live_test.dart -d "$SIMULATOR" --timeout 10x --dart-define=CI=true
207+
}
208+
209+
update-dashboard:
210+
runs-on: ubuntu-latest
211+
if: always()
212+
needs: [pipeline-e2e-android, pipeline-e2e-web, pipeline-e2e-ios]
213+
steps:
214+
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
215+
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
216+
with:
217+
channel: 'stable'
218+
- name: Update Dashboard Issue
219+
env:
220+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
221+
ANDROID_STATUS: ${{ needs.pipeline-e2e-android.result }}
222+
WEB_STATUS: ${{ needs.pipeline-e2e-web.result }}
223+
IOS_STATUS: ${{ needs.pipeline-e2e-ios.result }}
224+
REPO: ${{ github.repository }}
225+
run: |
226+
dart .github/workflows/scripts/nightly_issue_dashboard.dart

0 commit comments

Comments
 (0)