-
Notifications
You must be signed in to change notification settings - Fork 4.1k
138 lines (135 loc) · 5.35 KB
/
android.yaml
File metadata and controls
138 lines (135 loc) · 5.35 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
name: e2e-android
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
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'
jobs:
android:
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
working_directory:
['tests', 'packages/cloud_firestore/cloud_firestore/example']
env:
AVD_ARCH: x86_64
AVD_API_LEVEL: 34
AVD_TARGET: google_apis
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
name: Install Node.js 20
with:
node-version: '20'
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
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@668228422ae6a00e4ad889ee87cd7109ec5666a7
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@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
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@v4
- 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: AVD cache
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7
continue-on-error: true
id: avd-cache
with:
# Must match the save path exactly
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ runner.os }}-${{ env.AVD_API_LEVEL }}-${{ env.AVD_TARGET }}-${{ env.AVD_ARCH }}
- name: Start AVD then run E2E tests
uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b
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@668228422ae6a00e4ad889ee87cd7109ec5666a7
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@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
key: ${{ steps.avd-cache.outputs.cache-primary-key }}
# Must match the restore path exactly
path: |
~/.android/avd/*
~/.android/adb*