Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gcb/builds/resources/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ resource "google_cloudbuild_worker_pool" "pool" {
}
}

resource "google_firestore_database" "default" {
project = var.project
name = "(default)"
location_id = "us-central1"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The location_id is hardcoded to us-central1. Since a region variable is already defined and used for other resources in this file, it should be used here as well to ensure consistency and allow for easier multi-region deployments.

  location_id = var.region

type = "FIRESTORE_NATIVE"
}
12 changes: 12 additions & 0 deletions .gcb/builds/services/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ resource "google_project_service" "cloudfunctions" {
disable_dependent_services = true
}

resource "google_project_service" "firestore" {
project = var.project
service = "firestore.googleapis.com"

timeouts {
create = "30m"
update = "40m"
}

disable_dependent_services = true
}

resource "google_project_service" "iam" {
project = var.project
service = "iam.googleapis.com"
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/dart_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,39 @@ jobs:
- run: docker run -d --rm -p 9000:9000 -p 8888:8888 gcr.io/cloud-devrel-public-resources/storage-testbench:latest
- run: dart test -P storage-testbench .

firestore_emulator_tests:
name: Firestore Emulator Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c4482123f0ab2c02c
- uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e
with:
distribution: 'zulu'
java-version: '25'
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
sdk: ${{ env.DART_VERSION }}
- run: dart pub get
- name: Install Firebase CLI
run: npm install -g firebase-tools
- name: Run Emulators
run: |
const { spawn } = require('child_process');
const cmd = process.platform === 'win32' ? 'npx.cmd' : 'npx';
spawn(
cmd,
['firebase', 'emulators:start'],
{ stdio: 'ignore', detached: true, shell: process.platform === 'win32' }).unref();
shell: node {0}
working-directory: firestore_emulators
- name: Run Tests
env:
GOOGLE_CLOUD_PROJECT: test-project
FIRESTORE_EMULATOR_HOST: 127.0.0.1:8080
STORAGE_EMULATOR_HOST: 127.0.0.1:9199
run: dart test -P firebase-emulator .

generator:
name: Generators
runs-on: ubuntu-latest
Expand Down
74 changes: 0 additions & 74 deletions .github/workflows/gcs_emulator_tests.yaml

This file was deleted.

31 changes: 31 additions & 0 deletions firestore_emulators/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Firebase Emulator Tests

This directory contains configuration for running tests that target
the [Firebase Emulators Suite][].

## Running Tests Locally

To run these tests on your machine, you need to have the emulator running in
one terminal session and execute the tests in another.

### 1. Start the Firebase Emulator

Navigate to this directory and start the emulator:

```bash
firebase emulators:start
```

### 2. Run the Tests

In a separate terminal, navigate to the root of the repository and run the
tests:

```bash
GOOGLE_CLOUD_PROJECT=test-project \
FIRESTORE_EMULATOR_HOST=127.0.0.1:8080 \
STORAGE_EMULATOR_HOST=127.0.0.1:9199 \
dart test -P firebase-emulator .
```

[Firebase Emulators Suite]: https://firebase.google.com/docs/emulator-suite
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"enabled": true,
"port": 4000
},
"singleProjectMode": true
"singleProjectMode": true,
"firestore": {
"port": 8080
}
}
}
Loading
Loading