Skip to content

Commit 31e7e6a

Browse files
committed
Use an action to start postgres
Signed-off-by: tdruez <[email protected]>
1 parent 964b33b commit 31e7e6a

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

.github/workflows/run-unit-tests-macos.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,21 @@ jobs:
2929
with:
3030
python-version: ${{ matrix.python-version }}
3131

32-
- name: Start Postgres container
33-
run: |
34-
docker run -d --name test-postgres -e POSTGRES_USER=scancodeio -e POSTGRES_PASSWORD=scancodeio -e POSTGRES_DB=scancodeio -p 5432:5432 postgres:13
35-
36-
- name: Wait for Postgres to be ready
37-
run: |
38-
until pg_isready -h localhost -p 5432; do sleep 1; done
32+
- name: Set up Python ${{ matrix.python-version }}
33+
uses: ikalnytskyi/action-setup-postgres@v7
34+
id: postgres
35+
with:
36+
postgres-version: "13"
37+
database: ${{ env.POSTGRES_DB }}
38+
username: ${{ env.POSTGRES_USER }}
39+
password: ${{ env.POSTGRES_PASSWORD }}
40+
port: 5432
41+
42+
- run: psql ${{ steps.postgres.outputs.connection-uri }} -c "SELECT 1"
43+
- run: psql service=${{ steps.postgres.outputs.service-name }} -c "SELECT 1"
44+
- run: psql -c "SELECT 1"
45+
env:
46+
PGSERVICE: ${{ steps.postgres.outputs.service-name }}
3947

4048
- name: Install Python dependencies
4149
run: make dev envfile

0 commit comments

Comments
 (0)