When testing your Firebase application, you need to download the Firebase Emulator. Fortunately, firebase-tools does that automatically for you.
However, when running your tests on a continuous integration environment such as GitHub Actions, you'll see the following warning:
It appears you are running in a CI environment. You can avoid downloading the Pub/Sub Emulator repeatedly by caching the /home/runner/.cache/firebase/emulators directory.
This means, firebase-tools
is downloading the Emulator binary every time you run your CI pipeline. You can avoid this by caching the emulator instead:
jobs:
test:
runs-on: ubuntu-latest
env: FIREBASE_EMULATORS_PATH: ${{ github.workspace }}/emulator-cache
steps:
- name: Cache firebase emulators
uses: actions/cache@v2
with:
path: ${{ env.FIREBASE_EMULATORS_PATH }}
key:
${{ runner.os }}-firebase-emulators-${{
hashFiles('emulator-cache/**') }}
continue-on-error: true
The step above will cache the emulator on GitHub Actions. The next time you run your tests, Firebase won't download the emulator again (unless the binary changed).
Discussion (0)