@@ -79,23 +79,20 @@ jobs:
79
79
lint :
80
80
name : Lint Project
81
81
runs-on : ubuntu-latest
82
+ services :
83
+ postgres :
84
+ image : postgres:latest
85
+ env :
86
+ POSTGRES_USER : postgres
87
+ POSTGRES_PASSWORD : postgres
88
+ POSTGRES_DB : postgres
89
+ ports :
90
+ - 5432:5432
82
91
steps :
83
92
- name : Checkout PR Branch
84
93
uses : actions/checkout@v4
85
94
with :
86
95
submodules : true
87
- - name : Build and start postgres with plpgsql_check
88
- run : |
89
- docker build -t postgres-plpgsql-check:latest .
90
- docker run -d --name postgres \
91
- -e POSTGRES_USER=postgres \
92
- -e POSTGRES_PASSWORD=postgres \
93
- -e POSTGRES_DB=postgres \
94
- -p 5432:5432 \
95
- postgres-plpgsql-check:latest
96
- # Wait for postgres to be ready
97
- sleep 5
98
- docker exec postgres pg_isready -U postgres
99
96
- name : Free Disk Space
100
97
uses : ./.github/actions/free-disk-space
101
98
- name : Install toolchain
@@ -157,33 +154,13 @@ jobs:
157
154
env :
158
155
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
159
156
160
- # Build and run custom postgres image with plpgsql_check
161
- - name : Build and start postgres with plpgsql_check
162
- if : runner.os == 'Linux'
163
- run : |
164
- docker build -t postgres-plpgsql-check:latest .
165
- docker run -d --name postgres \
166
- -e POSTGRES_USER=postgres \
167
- -e POSTGRES_PASSWORD=postgres \
168
- -e POSTGRES_DB=postgres \
169
- -p 5432:5432 \
170
- postgres-plpgsql-check:latest
171
- # Wait for postgres to be ready
172
- sleep 5
173
- docker exec postgres pg_isready -U postgres
174
- - name : Build and start postgres with plpgsql_check (Windows)
175
- if : runner.os == 'Windows'
176
- run : |
177
- docker build -t postgres-plpgsql-check:latest .
178
- docker run -d --name postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres -p 5432:5432 postgres-plpgsql-check:latest
179
- Start-Sleep -Seconds 5
180
- docker exec postgres pg_isready -U postgres
157
+ # running containers via `services` only works on linux
158
+ # https://github.com/actions/runner/issues/1866
159
+ - name : Setup postgres
160
+ id : postgres
161
+ uses : ikalnytskyi/action-setup-postgres@v7
181
162
- name : Print Roles
182
- if : runner.os == 'Linux'
183
- run : docker exec postgres psql -U postgres -c "select rolname from pg_roles;"
184
- - name : Print Roles (Windows)
185
- if : runner.os == 'Windows'
186
- run : docker exec postgres psql -U postgres -c "select rolname from pg_roles;"
163
+ run : psql ${{ steps.postgres.outputs.connection-uri }} -c "select rolname from pg_roles;"
187
164
- name : Run tests
188
165
run : cargo test --workspace
189
166
@@ -192,23 +169,20 @@ jobs:
192
169
Test JS Bindings
193
170
# use the same image we use for compiling
194
171
runs-on : ubuntu-22.04
172
+ services :
173
+ postgres :
174
+ image : postgres:latest
175
+ env :
176
+ POSTGRES_USER : postgres
177
+ POSTGRES_PASSWORD : postgres
178
+ POSTGRES_DB : postgres
179
+ ports :
180
+ - 5432:5432
195
181
steps :
196
182
- name : Checkout PR branch
197
183
uses : actions/checkout@v4
198
184
with :
199
185
submodules : true
200
- - name : Build and start postgres with plpgsql_check
201
- run : |
202
- docker build -t postgres-plpgsql-check:latest .
203
- docker run -d --name postgres \
204
- -e POSTGRES_USER=postgres \
205
- -e POSTGRES_PASSWORD=postgres \
206
- -e POSTGRES_DB=postgres \
207
- -p 5432:5432 \
208
- postgres-plpgsql-check:latest
209
- # Wait for postgres to be ready
210
- sleep 5
211
- docker exec postgres pg_isready -U postgres
212
186
- name : Free Disk Space
213
187
uses : ./.github/actions/free-disk-space
214
188
- name : Install toolchain
@@ -231,23 +205,20 @@ jobs:
231
205
codegen :
232
206
name : Check Codegen
233
207
runs-on : ubuntu-22.04
208
+ services :
209
+ postgres :
210
+ image : postgres:latest
211
+ env :
212
+ POSTGRES_USER : postgres
213
+ POSTGRES_PASSWORD : postgres
214
+ POSTGRES_DB : postgres
215
+ ports :
216
+ - 5432:5432
234
217
steps :
235
218
- name : Checkout PR branch
236
219
uses : actions/checkout@v4
237
220
with :
238
221
submodules : true
239
- - name : Build and start postgres with plpgsql_check
240
- run : |
241
- docker build -t postgres-plpgsql-check:latest .
242
- docker run -d --name postgres \
243
- -e POSTGRES_USER=postgres \
244
- -e POSTGRES_PASSWORD=postgres \
245
- -e POSTGRES_DB=postgres \
246
- -p 5432:5432 \
247
- postgres-plpgsql-check:latest
248
- # Wait for postgres to be ready
249
- sleep 5
250
- docker exec postgres pg_isready -U postgres
251
222
- name : Free Disk Space
252
223
uses : ./.github/actions/free-disk-space
253
224
- name : Install toolchain
0 commit comments