diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 348f271..4762fd2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,12 @@ on: pull_request: 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: setup-environment: name: Generate Certificates @@ -64,11 +70,9 @@ jobs: postgres: image: postgres:16-alpine env: - POSTGRES_DB: piku - POSTGRES_USER: user - POSTGRES_PASSWORD: password123 - ports: - - 5432:5432 + POSTGRES_DB: ${{ env.DB_NAME }} + POSTGRES_USER: ${{ env.DB_USER }} + POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }} options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 defaults: run: @@ -87,10 +91,14 @@ jobs: path: certs key: certs-${{ runner.os }}-${{ github.sha }} - - name: Setup Environment + - name: Setup DB connection Variables run: | + echo "DB_HOST=postgres" >> $GITHUB_ENV + echo "DB_PORT=5432" >> $GITHUB_ENV cp ../.env.example ../.env uv sync + echo "DB_HOST=postgres" >> ../.env + echo "DB_PORT=5432" >> ../.env - name: Lint & Test run: |