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: (This error is not issue emulator should have to work without auth becuase it is working in some other repos but not on this)
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 ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.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 ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.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?
To run emulators you don't have to authenticate anything Here in this Repo where it is working without auth but on this Repo where I have python it is not working. I wonder why it is working in some place and not in other
UPDATE
I try to set project id via env GCLOUD_PROJECT="your-project-id" and via command flag --project and it still not working. Because issue is not related to id I think some how python pytest is not able to detect that firestore emulator is running. I don't know why this is happening maybe due to language difference firestore is running on npm and test are running in python Maybe GitHub set both things in different places. Because everything is working on NodeJS Repo because firestore and tests are both running on nodeJS I think somehow we have to sync both of them in one place so they can detect each other.