@@ -154,13 +154,37 @@ jobs:
154154 env :
155155 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
156156
157- # running containers via `services` only works on linux
158- # https://github.com/actions/runner/issues/1866
159- - name : Setup postgres
157+ # For Linux, use custom Docker image with plpgsql_check
158+ - name : Build and start PostgreSQL with plpgsql_check
159+ if : runner.os == 'Linux'
160+ run : |
161+ docker build -t postgres-plpgsql-check:latest .
162+ docker run -d --name postgres \
163+ -e POSTGRES_USER=postgres \
164+ -e POSTGRES_PASSWORD=postgres \
165+ -e POSTGRES_DB=postgres \
166+ -p 5432:5432 \
167+ postgres-plpgsql-check:latest
168+ # Wait for postgres to be ready
169+ for i in {1..30}; do
170+ if docker exec postgres pg_isready -U postgres; then
171+ break
172+ fi
173+ sleep 1
174+ done
175+ # For Windows, use the action since PostgreSQL Docker image doesn't support Windows containers
176+ - name : Setup postgres (Windows)
177+ if : runner.os == 'Windows'
160178 id : postgres
161179 uses : ikalnytskyi/action-setup-postgres@v7
162180 - name : Print Roles
163- run : psql ${{ steps.postgres.outputs.connection-uri }} -c "select rolname from pg_roles;"
181+ run : |
182+ if [[ "$RUNNER_OS" == "Linux" ]]; then
183+ docker exec postgres psql -U postgres -c "select rolname from pg_roles;"
184+ else
185+ psql ${{ steps.postgres.outputs.connection-uri }} -c "select rolname from pg_roles;"
186+ fi
187+ shell : bash
164188 - name : Run tests
165189 run : cargo test --workspace
166190
0 commit comments