Skip to content

chore(deps): bump google-cloud-firestore from 2.23.0 to 2.25.0 #190

chore(deps): bump google-cloud-firestore from 2.23.0 to 2.25.0

chore(deps): bump google-cloud-firestore from 2.23.0 to 2.25.0 #190

Workflow file for this run

name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
dockerfile-lint:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v6
- name: Dockerfile lint
id: hadolint
uses: hadolint/hadolint-action@v3.3.0
with:
dockerfile: Dockerfile
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Shellcheck
run: shellcheck entrypoint.sh
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
push: false
load: true
tags: google-cloud-emulator-docker:test
cache-from: type=gha,scope=gced
cache-to: type=gha,mode=max,scope=gced
test-create-pubsub-topic:
runs-on: ubuntu-latest
needs: build
defaults:
run:
working-directory: examples/create_pubsub_topic
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v3
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Build Docker image
run: docker compose --progress=plain build
env:
COMPOSE_BAKE: true
- name: start emulator
run: docker compose up -d --wait
- name: test
run: |
curl -s http://localhost:8085/v1/projects/test-project/topics | \
jq -e '. == {
"topics": [
{
"name": "projects/test-project/topics/email-notifications"
},
{
"name": "projects/test-project/topics/push-notifications"
}
]
}'
test-create-firestore-collection:
runs-on: ubuntu-latest
needs: build
defaults:
run:
working-directory: examples/create_firestore_collection
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v3
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Build Docker image
run: docker compose --progress=plain build
env:
COMPOSE_BAKE: true
- name: start emulator
run: docker compose up -d --wait
- name: test collections creation
run: |
# Test users collection
users_count=$(curl -s \
"http://localhost:8080/v1/projects/test-project/databases/(default)/documents/users" | \
jq '.documents | length')
if [ "$users_count" != "2" ]; then
echo "ERROR: Expected 2 users documents, got $users_count"
exit 1
fi
# Test products collection
products_count=$(curl -s \
"http://localhost:8080/v1/projects/test-project/databases/(default)/documents/products" | \
jq '.documents | length')
if [ "$products_count" != "2" ]; then
echo "ERROR: Expected 2 products documents, got $products_count"
exit 1
fi
echo "Test passed: Both collections created with expected documents"
test-delayed-initialization:
runs-on: ubuntu-latest
needs: build
defaults:
run:
working-directory: tests/delayed_initialization
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v3
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Build Docker image
run: docker compose --progress=plain build
env:
COMPOSE_BAKE: true
- name: start emulator
run: docker compose up -d --wait
- name: Verify initialization and health check sequence
run: |
container_id=$(docker compose ps -q pubsub-emulator)
# 各タイムスタンプを取得
init_start=$(docker exec $container_id cat /tmp/init-started)
init_complete=$(docker exec $container_id cat /tmp/delayed-init-completed)
# Docker inspect からヘルスチェック履歴を取得
health_history=$(docker inspect \
--format='{{json .State.Health.Log}}' \
$container_id)
# 最初に成功したヘルスチェックの時刻を抽出
first_healthy_time=$(echo $health_history | \
jq -r '.[] | select(.ExitCode==0) | .Start' | \
head -1 | \
cut -d'.' -f1)
first_healthy_time=$(date -d "$first_healthy_time" +%s)
echo "Initialization started at: $(date -d @$init_start)"
echo "Initialization completed at: $(date -d @$init_complete)"
echo "First successful health check at: $(date -d @$first_healthy_time)"
# 初期化完了後にヘルスチェックが成功していることを確認
if [ $first_healthy_time -lt $init_complete ]; then
echo "ERROR: Health check succeeded before initialization completed!"
exit 1
fi
echo "Test passed: Health check succeeded only after initialization completed."
test-create-datastore-entities:
runs-on: ubuntu-latest
needs: build
defaults:
run:
working-directory: examples/create_datastore_entities
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v3
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Build Docker image
run: docker compose --progress=plain build
env:
COMPOSE_BAKE: true
- name: start emulator
run: docker compose up -d --wait
- name: test
run: |
# Query for created entities using Datastore REST API
curl -s "http://localhost:8081/v1/projects/test-project:runQuery" \
-H "Content-Type: application/json" \
-d '{
"query": {
"kind": [{"name": "User"}]
}
}' | jq -e '.batch.entityResults | length == 2'
curl -s "http://localhost:8081/v1/projects/test-project:runQuery" \
-H "Content-Type: application/json" \
-d '{
"query": {
"kind": [{"name": "Product"}]
}
}' | jq -e '.batch.entityResults | length == 2'
curl -s "http://localhost:8081/v1/projects/test-project:runQuery" \
-H "Content-Type: application/json" \
-d '{
"query": {
"kind": [{"name": "Order"}]
}
}' | jq -e '.batch.entityResults | length == 2'
test-create-bigtable-table:
runs-on: ubuntu-latest
needs: build
defaults:
run:
working-directory: examples/create_bigtable_table
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v3
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Build Docker image
run: docker compose --progress=plain build
env:
COMPOSE_BAKE: true
- name: start emulator
run: docker compose up -d --wait
- name: test
run: |
# Use cbt command inside the Docker container
container_name=$(docker compose ps -q bigtable-emulator)
# Configure cbt to use the emulator (inside container)
docker exec $container_name bash -c '
echo "project = test-project" > ~/.cbtrc
echo "instance = test-instance" >> ~/.cbtrc
echo "creds = dummy" >> ~/.cbtrc
'
# List tables to verify creation
echo "Listing tables:"
tables=$(docker exec $container_name \
bash -c '$(gcloud beta emulators bigtable env-init) && cbt ls' | \
grep -E "^(analytics|user-data)$" | \
sort)
expected_tables=$(echo -e "analytics\nuser-data")
if [ "$tables" = "$expected_tables" ]; then
echo "Test passed: Expected tables found"
else
echo "Test failed: Expected tables not found"
echo "Expected: $expected_tables"
echo "Found: $tables"
exit 1
fi