ci: configure database environment variables

This commit is contained in:
ramvignesh-b
2026-05-04 22:23:00 +05:30
parent c7764952d8
commit 0aa9f7bdc3
+14 -6
View File
@@ -6,6 +6,12 @@ on:
pull_request: pull_request:
branches: [ main ] branches: [ main ]
env:
# WHY?: services are executed way before the env can be sourced from .env file
DB_NAME: piku_test_db
DB_USER: test
DB_PASSWORD: password123
jobs: jobs:
setup-environment: setup-environment:
name: Generate Certificates name: Generate Certificates
@@ -64,11 +70,9 @@ jobs:
postgres: postgres:
image: postgres:16-alpine image: postgres:16-alpine
env: env:
POSTGRES_DB: piku POSTGRES_DB: ${{ env.DB_NAME }}
POSTGRES_USER: user POSTGRES_USER: ${{ env.DB_USER }}
POSTGRES_PASSWORD: password123 POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
defaults: defaults:
run: run:
@@ -87,10 +91,14 @@ jobs:
path: certs path: certs
key: certs-${{ runner.os }}-${{ github.sha }} key: certs-${{ runner.os }}-${{ github.sha }}
- name: Setup Environment - name: Setup DB connection Variables
run: | run: |
echo "DB_HOST=postgres" >> $GITHUB_ENV
echo "DB_PORT=5432" >> $GITHUB_ENV
cp ../.env.example ../.env cp ../.env.example ../.env
uv sync uv sync
echo "DB_HOST=postgres" >> ../.env
echo "DB_PORT=5432" >> ../.env
- name: Lint & Test - name: Lint & Test
run: | run: |