ci: use service hostname — runner networking fixed to per-workflow bridge
This commit is contained in:
parent
6807d41aa4
commit
5dbd1d4dc8
1 changed files with 5 additions and 7 deletions
|
|
@ -12,17 +12,15 @@ jobs:
|
||||||
# CI stand-in for bin/test's ephemeral Postgres: the nix container runs
|
# CI stand-in for bin/test's ephemeral Postgres: the nix container runs
|
||||||
# as root and initdb refuses to run as root, so the DB lives in a
|
# as root and initdb refuses to run as root, so the DB lives in a
|
||||||
# service container instead and the suite connects via TEST_DATABASE_URL.
|
# service container instead and the suite connects via TEST_DATABASE_URL.
|
||||||
# The runner puts job containers on the host network while services sit
|
# Job and service share the per-workflow bridge network (the runner's
|
||||||
# on the per-workflow bridge, so the `postgres` hostname doesn't resolve
|
# container.network must stay "" — with "host" the service network is
|
||||||
# from the job — the service publishes 5432 and the suite dials loopback.
|
# never created and services fail to start).
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:17-alpine
|
image: postgres:17-alpine
|
||||||
env:
|
env:
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
POSTGRES_HOST_AUTH_METHOD: trust
|
POSTGRES_HOST_AUTH_METHOD: trust
|
||||||
POSTGRES_DB: asxpio_test
|
POSTGRES_DB: asxpio_test
|
||||||
ports:
|
|
||||||
- 5432:5432
|
|
||||||
steps:
|
steps:
|
||||||
- name: Prepare container for actions
|
- name: Prepare container for actions
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -35,7 +33,7 @@ jobs:
|
||||||
- name: Wait for Postgres
|
- name: Wait for Postgres
|
||||||
run: |
|
run: |
|
||||||
for i in $(seq 1 30); do
|
for i in $(seq 1 30); do
|
||||||
nix develop -c pg_isready -h 127.0.0.1 -U postgres && exit 0
|
nix develop -c pg_isready -h postgres -U postgres && exit 0
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
echo "Postgres service never became ready" >&2
|
echo "Postgres service never became ready" >&2
|
||||||
|
|
@ -43,5 +41,5 @@ jobs:
|
||||||
|
|
||||||
- name: Run test suite
|
- name: Run test suite
|
||||||
env:
|
env:
|
||||||
TEST_DATABASE_URL: postgres://postgres@127.0.0.1:5432/asxpio_test
|
TEST_DATABASE_URL: postgres://postgres@postgres:5432/asxpio_test
|
||||||
run: nix develop -c bundle exec rake test
|
run: nix develop -c bundle exec rake test
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue