fix: use service hostname instead of localhost for PostgreSQL
- Remove port mapping (5432:5432) to avoid port conflicts on runner - Use 'postgres' hostname instead of 'localhost' to access service - Service containers in Actions are accessible via their service name - Fixes 'port is already allocated' error on self-hosted runners
This commit is contained in:
parent
9de7d1120d
commit
21572d8873
1 changed files with 3 additions and 5 deletions
|
|
@ -28,8 +28,6 @@ jobs:
|
|||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
ports:
|
||||
- 5432:5432
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
|
|
@ -78,7 +76,7 @@ jobs:
|
|||
|
||||
- name: Wait for PostgreSQL
|
||||
run: |
|
||||
until pg_isready -h localhost -p 5432 -U postgres; do
|
||||
until pg_isready -h postgres -p 5432 -U postgres; do
|
||||
echo "Waiting for PostgreSQL..."
|
||||
sleep 2
|
||||
done
|
||||
|
|
@ -88,7 +86,7 @@ jobs:
|
|||
run: mix ecto.create
|
||||
env:
|
||||
MIX_ENV: test
|
||||
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/towerops_test
|
||||
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/towerops_test
|
||||
|
||||
- name: Check code formatting
|
||||
run: mix format --check-formatted
|
||||
|
|
@ -105,7 +103,7 @@ jobs:
|
|||
run: mix test --warnings-as-errors
|
||||
env:
|
||||
MIX_ENV: test
|
||||
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/towerops_test
|
||||
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/towerops_test
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue