mirror of
https://github.com/ramvignesh-b/pi-ku.git
synced 2026-05-04 20:43:48 +00:00
ci: configure database environment variables
This commit is contained in:
@@ -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: |
|
||||||
|
|||||||
Reference in New Issue
Block a user