ci: add explicit wait for PostgreSQL and database creation step
- Add pg_isready wait loop to ensure PostgreSQL service is fully ready - Run mix ecto.create explicitly before tests to prevent connection errors - Fixes 'connection refused' errors when database service is still starting
This commit is contained in:
parent
139348f2a0
commit
56d9878130
1 changed files with 14 additions and 0 deletions
|
|
@ -58,6 +58,20 @@ jobs:
|
|||
- name: Install dependencies
|
||||
run: mix deps.get
|
||||
|
||||
- name: Wait for PostgreSQL
|
||||
run: |
|
||||
until pg_isready -h localhost -p 5432 -U postgres; do
|
||||
echo "Waiting for PostgreSQL..."
|
||||
sleep 2
|
||||
done
|
||||
echo "PostgreSQL is ready!"
|
||||
|
||||
- name: Setup database
|
||||
run: mix ecto.create
|
||||
env:
|
||||
MIX_ENV: test
|
||||
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/towerops_test
|
||||
|
||||
- name: Check code formatting
|
||||
run: mix format --check-formatted
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue