Skip to content

Commit bd20916

Browse files
committed
chore(CI): unify emulator scripts, add auth emulator
1 parent c94b8e9 commit bd20916

6 files changed

+41
-40
lines changed

.github/workflows/firebase_auth.yaml

+15-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
branches:
1010
- master
1111
paths-ignore:
12-
- "docs/**"
12+
- "docs/**"
1313

1414
env:
1515
FLUTTERFIRE_PLUGIN_SCOPE: "*firebase_auth*"
@@ -27,9 +27,13 @@ jobs:
2727
- name: "Install Flutter"
2828
run: ./.github/workflows/scripts/install-flutter.sh stable
2929
- name: "Install Tools"
30-
run: ./.github/workflows/scripts/install-tools.sh
30+
run: |
31+
./.github/workflows/scripts/install-tools.sh
32+
sudo npm i -g firebase-tools
3133
- name: "Build Example"
3234
run: ./.github/workflows/scripts/build-example.sh android
35+
- name: Start Firebase Emulator
36+
run: cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
3337
- name: "Drive Example"
3438
uses: reactivecircus/android-emulator-runner@v2
3539
with:
@@ -51,9 +55,12 @@ jobs:
5155
- name: "Install Tools"
5256
run: |
5357
./.github/workflows/scripts/install-tools.sh
58+
sudo npm i -g firebase-tools
5459
flutter config --enable-macos-desktop
5560
- name: "Build iOS Example"
5661
run: ./.github/workflows/scripts/build-example.sh ios
62+
- name: Start Firebase Emulator
63+
run: cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
5764
- name: "Drive iOS Example"
5865
run: ./.github/workflows/scripts/drive-example.sh ios
5966
- name: "Build MacOS Example"
@@ -62,7 +69,9 @@ jobs:
6269
run: ./.github/workflows/scripts/drive-example.sh macos
6370

6471
web:
65-
runs-on: ubuntu-latest
72+
# Using macos instead of ubuntu as Web app can't connect to Firebase emulator
73+
# when running on ubuntu.
74+
runs-on: macos-latest
6675
timeout-minutes: 15
6776
steps:
6877
- uses: actions/checkout@v1
@@ -74,5 +83,8 @@ jobs:
7483
run: |
7584
./.github/workflows/scripts/install-tools.sh
7685
flutter config --enable-web
86+
sudo npm i -g firebase-tools
87+
- name: Start Firebase Emulator
88+
run: cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
7789
- name: "Drive Example"
7890
run: ./.github/workflows/scripts/drive-example.sh web

.github/workflows/firebase_firestore.yaml

+7-7
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ jobs:
3232
sudo npm i -g firebase-tools
3333
- name: "Build Example"
3434
run: ./.github/workflows/scripts/build-example.sh android
35-
- name: Start Firestore Emulator
36-
run: cd ./.github/workflows/scripts && ./start-firestore-emulator.sh
35+
- name: Start Firebase Emulator
36+
run: cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
3737
- name: "Drive Example"
3838
uses: reactivecircus/android-emulator-runner@v2
3939
with:
@@ -61,8 +61,8 @@ jobs:
6161
flutter config --enable-macos-desktop
6262
- name: "Build iOS Example"
6363
run: ./.github/workflows/scripts/build-example.sh ios
64-
- name: Start Firestore Emulator
65-
run: cd ./.github/workflows/scripts && ./start-firestore-emulator.sh
64+
- name: Start Firebase Emulator
65+
run: cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
6666
- name: "Drive iOS Example"
6767
run: ./.github/workflows/scripts/drive-example.sh ios
6868
- name: "Build MacOS Example"
@@ -73,7 +73,7 @@ jobs:
7373
run: ./.github/workflows/scripts/drive-example.sh macos
7474

7575
web:
76-
# Using macos instead of ubuntu as Web app can't connect to Firebase Firestore emulator
76+
# Using macos instead of ubuntu as Web app can't connect to Firebase emulator
7777
# when running on ubuntu.
7878
runs-on: macos-latest
7979
timeout-minutes: 15
@@ -88,7 +88,7 @@ jobs:
8888
./.github/workflows/scripts/install-tools.sh
8989
sudo npm i -g firebase-tools
9090
flutter config --enable-web
91-
- name: Start Firestore Emulator
92-
run: cd ./.github/workflows/scripts && ./start-firestore-emulator.sh
91+
- name: Start Firebase Emulator
92+
run: cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
9393
- name: "Drive Example"
9494
run: ./.github/workflows/scripts/drive-example.sh web

.github/workflows/firebase_functions.yaml

+7-7
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ jobs:
3131
sudo npm i -g firebase-tools
3232
- name: "Build Example"
3333
run: ./.github/workflows/scripts/build-example.sh android
34-
- name: Start Functions Emulator
35-
run: cd ./.github/workflows/scripts && ./start-functions-emulator.sh
34+
- name: Start Firebase Emulator
35+
run: cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
3636
- name: "Drive Example"
3737
uses: reactivecircus/android-emulator-runner@v2
3838
with:
@@ -60,8 +60,8 @@ jobs:
6060
sudo npm i -g firebase-tools
6161
- name: "Build iOS Example"
6262
run: ./.github/workflows/scripts/build-example.sh ios
63-
- name: Start Functions Emulator
64-
run: cd ./.github/workflows/scripts && ./start-functions-emulator.sh
63+
- name: Start Firebase Emulator
64+
run: cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
6565
- name: "Drive iOS Example"
6666
run: ./.github/workflows/scripts/drive-example.sh ios
6767
- name: "Build MacOS Example"
@@ -70,7 +70,7 @@ jobs:
7070
run: ./.github/workflows/scripts/drive-example.sh macos
7171

7272
web:
73-
# Using macos instead of ubuntu as Web app can't connect to Firebase Functions emulator
73+
# Using macos instead of ubuntu as Web app can't connect to Firebase emulator
7474
# when running on ubuntu.
7575
runs-on: macos-latest
7676
timeout-minutes: 15
@@ -85,7 +85,7 @@ jobs:
8585
./.github/workflows/scripts/install-tools.sh
8686
flutter config --enable-web
8787
sudo npm i -g firebase-tools
88-
- name: Start Functions Emulator
89-
run: cd ./.github/workflows/scripts && ./start-functions-emulator.sh
88+
- name: Start Firebase Emulator
89+
run: cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
9090
- name: "Drive Example"
9191
run: ./.github/workflows/scripts/drive-example.sh web

.github/workflows/scripts/firebase.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@
99
"firestore": {
1010
"port": "8080"
1111
},
12+
"auth": {
13+
"port": "9099"
14+
},
1215
"ui": {
13-
"enabled": false
16+
"enabled": true,
17+
"port": 4000
1418
}
1519
}
1620
}

.github/workflows/scripts/start-functions-emulator.sh renamed to .github/workflows/scripts/start-firebase-emulator.sh

+7-5
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ if [[ ! -d "functions/node_modules" ]]; then
1919
cd functions && npm i && cd ..
2020
fi
2121

22+
EMU_START_COMMAND="firebase emulators:start --only auth,firestore,functions --project react-native-firebase-testing"
23+
2224
IS_CI="${CI}${CONTINUOUS_INTEGRATION}${BUILD_NUMBER}${RUN_ID}"
2325
if [[ -n "${IS_CI}" ]]; then
24-
firebase emulators:start --only functions &
25-
until curl --output /dev/null --head --silent http://localhost:5001; do
26-
echo "Waiting for Functions emulator to come online..."
26+
$EMU_START_COMMAND &
27+
until curl --output /dev/null --silent --fail http://localhost:8080; do
28+
echo "Waiting for Firebase emulator to come online..."
2729
sleep 2
2830
done
29-
echo "Functions emulator is online!"
31+
echo "Firebase emulator is online!"
3032
else
31-
firebase emulators:start --only functions
33+
$EMU_START_COMMAND
3234
fi

.github/workflows/scripts/start-firestore-emulator.sh

-17
This file was deleted.

0 commit comments

Comments
 (0)