Saturday, 21 August 2021

Run Firestore emulator with Python in GitHub Actions

I have a python package which is using Firestore. I'm trying to write GitHub actions before this I was using Travis now I want to shift on GitHub Actions. Everything is working fine on Travis but on GitHub Actions I'm getting error.

Error:

E: google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started

Workflow (not working): Repo FireO Python

name: Python package

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python-version: [3.7]

    steps:
      - uses: actions/checkout@v2
      - name: Set up Python $
        uses: actions/setup-python@v2
        with:
          python-version: $

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          python -m pip install pytest
          python -m pip install -e .

      - name: Setup NodeJS
        uses: actions/setup-node@v2
        with:
          node-version: "14.x"
      - name: Start Firestore emulator
        run: |
          npm i -g firebase firebase-tools
          firebase setup:emulators:firestore
          firebase emulators:start --only firestore &

      - name: Test with pytest
        run: |
          pytest
        env:
          FIRESTORE_EMULATOR_HOST: localhost:8080

I don't know why the firestore emulator is not working. I have another repo where it is working fine.

Working in another Repo WorkFlow Repo FireO NodeJs

    name: Node.js CI

    on:
    push:
        branches: [main]
    pull_request:

    jobs:
    build:
        runs-on: ubuntu-latest

        strategy:
        matrix:
            node-version: [12.x, 14.x, 15.x]
            # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

        steps:
        - uses: actions/checkout@v2
        - name: Use Node.js $
            uses: actions/setup-node@v1
            with:
            node-version: $

        - name: Install Firestore CLI and start emulators
            run: |
                npm i -g firebase firebase-tools
                firebase setup:emulators:firestore
                firebase emulators:start --only firestore &
        - name: Test Fireo Package
            run: |
                npm ci
                npm test
            env:
                FIRESTORE_EMULATOR_HOST: localhost:8080

Can you please point out what I'm missing what is wrong when I try to test it with python?



from Run Firestore emulator with Python in GitHub Actions

No comments:

Post a Comment