-
Notifications
You must be signed in to change notification settings - Fork 4.1k
196 lines (190 loc) · 7.46 KB
/
Copy pathandroid.yaml
File metadata and controls
196 lines (190 loc) · 7.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
name: e2e-android
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-android
cancel-in-progress: true
permissions:
contents: read
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'website/**'
- '**/example/**'
- '!**/example/integration_test/**'
- '**/flutterfire_ui/**'
- '**.md'
push:
branches:
- main
paths-ignore:
- 'docs/**'
- 'website/**'
- '**/example/**'
- '!**/example/integration_test/**'
- '**/flutterfire_ui/**'
- '**.md'
workflow_call:
inputs:
nightly_test_mode:
type: boolean
default: false
permissions:
contents: read
jobs:
android:
permissions:
contents: read
runs-on: ubuntu-latest
timeout-minutes: ${{ inputs.nightly_test_mode && 5 || 45 }}
strategy:
fail-fast: false
matrix:
working_directory:
['tests', 'packages/cloud_firestore/cloud_firestore/example']
exclude:
- working_directory: ${{ inputs.nightly_test_mode && 'packages/cloud_firestore/cloud_firestore/example' || 'none' }}
env:
AVD_ARCH: x86_64
AVD_API_LEVEL: 34
AVD_TARGET: google_apis
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
name: Install Node.js 20
with:
node-version: '20'
- uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520
with:
distribution: 'temurin'
java-version: '21'
- name: 'Install Tools'
run: |
sudo npm i -g firebase-tools
echo "FIREBASE_TOOLS_VERSION=$(npm firebase --version)" >> $GITHUB_ENV
- name: Firebase Emulator Cache
id: firebase-emulator-cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
continue-on-error: true
with:
# The firebase emulators are pure javascript and java, OS-independent
enableCrossOsArchive: true
# Must match the save path exactly
path: ~/.cache/firebase/emulators
key: firebase-emulators-v3-${{ env.FIREBASE_TOOLS_VERSION }}
restore-keys: firebase-emulators-v3
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2
with:
channel: 'stable'
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:"
- uses: bluefireteam/melos-action@705015c3d2bc4ab94201ac24accb2bbe070cf533
with:
run-bootstrap: false
melos-version: '5.3.0'
- name: 'Bootstrap package'
run: melos bootstrap --scope tests && melos bootstrap --scope "cloud_firestore*"
- name: Start Firebase Emulator
run: cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
- name: Enable KVM
run: |
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: Gradle cache
uses: gradle/actions/setup-gradle@90ddb51e90a5fd9ba75f40cf85156b7b41bf76a3
- name: Free Disk Space (Ubuntu)
uses: AdityaGarg8/remove-unwanted-software@90e01b21170618765a73370fcc3abbd1684a7793
with:
remove-dotnet: true
remove-haskell: true
remove-codeql: true
remove-docker-images: true
remove-large-packages: true
- name: Prepare AVD home on /mnt
# GitHub-hosted runners mount a ~74GB volume at /mnt. Create it before AVD cache
# restore and android-emulator-runner (avdmanager needs the space at create time).
run: |
sudo mkdir -p /mnt/avd
sudo chown "$USER:$USER" /mnt/avd
df -h / /mnt
- name: AVD cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
continue-on-error: true
id: avd-cache
with:
# Must match the save path exactly
path: |
/mnt/avd/*
~/.android/adb*
key: avd-${{ runner.os }}-${{ env.AVD_API_LEVEL }}-${{ env.AVD_TARGET }}-${{ env.AVD_ARCH }}
- name: Link AVD home to /mnt
# android-emulator-runner exportVariables ANDROID_AVD_HOME to $HOME/.android/avd
run: |
mkdir -p "$HOME/.android"
rm -rf "$HOME/.android/avd"
ln -s /mnt/avd "$HOME/.android/avd"
- name: Start AVD then run E2E tests
uses: reactivecircus/android-emulator-runner@e89f39f1abbbd05b1113a29cf4db69e7540cae5a
env:
ANDROID_AVD_HOME: /mnt/avd
with:
api-level: ${{ env.AVD_API_LEVEL }}
target: ${{ env.AVD_TARGET }}
arch: ${{ env.AVD_ARCH }}
emulator-build: 14214601
working-directory: ${{ matrix.working_directory }}
script: |
flutter test integration_test/e2e_test.dart --timeout 10x --dart-define=CI=true -d emulator-5554
- name: Ensure Appium is shut down
# Required because of below issue where emulator failing to shut down properly causes tests to fail
# https://github.com/ReactiveCircus/android-emulator-runner/issues/385
run: |
pgrep -f appium && pkill -f appium || echo "No Appium process found"
- name: Save Firestore Emulator Cache
# Branches can read main cache but main cannot read branch cache. Avoid LRU eviction with main-only cache.
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae
with:
# The firebase emulators are pure javascript and java, OS-independent
enableCrossOsArchive: true
key: ${{ steps.firebase-emulator-cache.outputs.cache-primary-key }}
# Must match the restore path exactly
path: ~/.cache/firebase/emulators
- name: Save Android Emulator Cache
# Branches can read main cache but main cannot read branch cache. Avoid LRU eviction with main-only cache.
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae
with:
key: ${{ steps.avd-cache.outputs.cache-primary-key }}
# Must match the restore path exactly
path: |
/mnt/avd/*
~/.android/adb*
agp9-compatibility:
permissions:
contents: read
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520
with:
distribution: 'temurin'
java-version: '21'
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2
with:
channel: 'stable'
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:"
- uses: bluefireteam/melos-action@705015c3d2bc4ab94201ac24accb2bbe070cf533
with:
run-bootstrap: false
melos-version: '5.3.0'
- name: 'Bootstrap tests package'
run: melos bootstrap --scope tests
- name: Gradle cache
uses: gradle/actions/setup-gradle@0b6dd653ba04f4f93bf581ec31e66cbd7dcb644d
- name: 'Build tests app with AGP 9'
run: bash ./.github/workflows/scripts/agp9-compatibility.sh