Skip to content

Commit 84f8f83

Browse files
committed
Run postgres as service
1 parent a8ed2cc commit 84f8f83

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

.github/workflows/test.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,20 @@ jobs:
1818
fail-fast: false
1919
runs-on: ubuntu-latest
2020
container:
21-
image: postgres:${{ matrix.pg_version }}
21+
image: ubuntu:22.04 # main job container
2222
options: --user root
23-
env:
24-
PGDATA: $HOME/data
25-
PG_BRANCH: ${{ format('REL_{0}_STABLE', matrix.pg_version) }}
23+
services:
24+
postgres:
25+
image: postgres:${{ matrix.pg_version }}
26+
env:
27+
POSTGRES_PASSWORD: postgres
28+
ports:
29+
- 5432:5432
30+
options: >-
31+
--health-cmd "pg_isready -U postgres"
32+
--health-interval 5s
33+
--health-timeout 5s
34+
--health-retries 5
2635
2736
steps:
2837
# Checkout shared_ispell
@@ -59,14 +68,18 @@ jobs:
5968
# Create extension
6069
- name: Create extension
6170
run: |
62-
createdb test
63-
psql -d test -c "CREATE EXTENSION shared_ispell;"
71+
export PGUSER=postgres
72+
export PGPASSWORD=postgres
73+
createdb -h localhost -p 5432 test
74+
psql -h localhost -p 5432 -U postgres -d test -c "CREATE EXTENSION shared_ispell;"
6475
6576
# Run SQL tests
6677
- name: Run SQL tests
6778
run: |
79+
export PGUSER=postgres
80+
export PGPASSWORD=postgres
6881
for f in sql/*.sql; do
6982
echo "Running $f"
70-
psql -d test -f "$f"
83+
psql -h localhost -p 5432 -U postgres -d test -f "$f"
7184
done
7285

0 commit comments

Comments
 (0)