Skip to content

Commit

Permalink
rovision Firestore on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
danieltrolezi committed Oct 21, 2024
1 parent db51da5 commit 3193771
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
9 changes: 5 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ APP_KEY=
APP_DEBUG=true

DB_CONNECTION=firestore
FIRESTORE_PROJECT_ID=
FIRESTORE_EMULATOR_HOST=firestore:8080 # [ONLY LOCAL]

REDIS_CONNECTION=default
REDIS_HOST=redis
Expand All @@ -26,8 +24,11 @@ DISCORD_PUBLIC_KEY=
DISCORD_BOT_TOKEN=
DISCORD_API_HOST=https://discord.com

# [FOR JOB DEPLOYMENT/ONLY LOCAL]
GCP_PROJECT_ID=
# [ONLY LOCAL\FIRESTORE]
FIRESTORE_EMULATOR_HOST=firestore:8080

# [ONLY LOCAL/JOB DEPLOYMENT]
GCP_PROJECT_ID=codelab92
GCP_PROJECT_NUMBER=
GCP_REGION=
GCP_CLOUD_RUN_SERVICE=
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/tests-n-cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ jobs:
- uses: shivammathur/setup-php@v2
with:
php-version: '8.3'

- name: Start Firestore Emulator
uses: w9jds/firebase-action@master
with:
args: emulators:start --only firestore --project ${{ vars.GCP_PROJECT_ID }}
env:
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}

- uses: actions/checkout@v4

Expand All @@ -38,12 +45,16 @@ jobs:
- name: Run Code Sniffer
run: composer phpcs

- name: Wait for Redis
- name: Wait for Redis and Firestore
run: sleep 10

- name: Check Redis Connectivity
run: |
nc -zv localhost 6379
- name: Check Firestore Connectivity
run: |
nc -zv localhost 8080
- name: Run Tests
run: composer test
2 changes: 1 addition & 1 deletion Dockerfile.firestore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM node:18-alpine

ARG FIRESTORE_PROJECT_ID
ARG FIRESTORE_PROJECT_ID=codelab92
ENV FIRESTORE_PROJECT_ID=${FIRESTORE_PROJECT_ID}

RUN apk add --no-cache openjdk11 \
Expand Down
2 changes: 1 addition & 1 deletion config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
],

'firestore' => [
'project_id' => env('FIRESTORE_PROJECT_ID'),
'project_id' => env('FIRESTORE_PROJECT_ID', 'codelab92'),
'database' => env('FIRESTORE_DATABASE', 'gamewatch')
]
],
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ services:
build:
context: .
dockerfile: Dockerfile.firestore
args:
FIRESTORE_PROJECT_ID: ${FIRESTORE_PROJECT_ID}
ports:
- '8080:8080'
- '4000:4000'
Expand Down

0 comments on commit 3193771

Please sign in to comment.