28
28
PGPASSWORD : postgres
29
29
services :
30
30
postgres :
31
- image : postgis/postgis:16 -3.4
31
+ image : postgis/postgis:15 -3.3
32
32
ports :
33
33
# will assign a random free host port
34
34
- 5432/tcp
46
46
--health-timeout 5s
47
47
--health-retries 5
48
48
--entrypoint sh
49
- postgis/postgis:16 -3.4
49
+ postgis/postgis:postgis:15 -3.3
50
50
-c "exec docker-entrypoint.sh postgres -c ssl=on -c ssl_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem -c ssl_key_file=/etc/ssl/private/ssl-cert-snakeoil.key"
51
51
steps :
52
52
- uses : taiki-e/install-action@v2
@@ -314,6 +314,35 @@ jobs:
314
314
name : Test on ${{ matrix.os }}
315
315
runs-on : ${{ matrix.os }}
316
316
needs : [ build ]
317
+ env :
318
+ # PG_* variables are used by psql
319
+ PGDATABASE : test
320
+ PGHOST : localhost
321
+ PGUSER : postgres
322
+ PGPASSWORD : postgres
323
+ services :
324
+ if : matrix.os == 'ubuntu-latest'
325
+ postgres :
326
+ image : postgis/postgis:15-3.3
327
+ ports :
328
+ # will assign a random free host port
329
+ - 5432/tcp
330
+ # Sadly there is currently no way to pass arguments to the service image other than this hack
331
+ # See also https://stackoverflow.com/a/62720566/177275
332
+ options : >-
333
+ -e POSTGRES_DB=test
334
+ -e POSTGRES_USER=postgres
335
+ -e POSTGRES_PASSWORD=postgres
336
+ -e PGDATABASE=test
337
+ -e PGUSER=postgres
338
+ -e PGPASSWORD=postgres
339
+ --health-cmd pg_isready
340
+ --health-interval 10s
341
+ --health-timeout 5s
342
+ --health-retries 5
343
+ --entrypoint sh
344
+ postgis/postgis:postgis:15-3.3
345
+ -c "exec docker-entrypoint.sh postgres -c ssl=on -c ssl_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem -c ssl_key_file=/etc/ssl/private/ssl-cert-snakeoil.key"
317
346
strategy :
318
347
fail-fast : true
319
348
matrix :
@@ -327,24 +356,29 @@ jobs:
327
356
- target : x86_64-unknown-linux-gnu
328
357
os : ubuntu-latest
329
358
steps :
330
- - name : Install and run Postgis
331
- uses : nyurik/action-setup-postgis@v2
359
+ - name : Install and run Postgis (windows)
360
+ if : matrix.os == 'windows-latest'
361
+
332
362
id : pg
333
- with : { username: 'test', password: 'test', database: 'test' }
363
+ with : { username: 'test', password: 'test', database: 'test',postgres-version: 15, postgis_version: 3.3.3 }
334
364
- name : Start NGINX
335
365
336
366
id : nginx
337
367
with : { port: '5412', output-unix-paths: 'yes' }
338
368
- name : Checkout sources
339
369
uses : actions/checkout@v4
340
- - name : Init database
370
+ - name : Set DATABASE_URL
371
+ id : set-db-url
341
372
run : |
342
- echo "DATABASE_URL=${{ steps.pg.outputs.connection-uri }}"
343
- echo "Print the same in base64 to bypass Github's obfuscation (uses hardcoded password):"
344
- echo "${{ steps.pg.outputs.connection-uri }}" | base64
345
- tests/fixtures/initdb.sh
373
+ if [[ "${{ runner.os }}" == "Windows" ]]; then
374
+ echo "DATABASE_URL=${{ steps.pg.outputs.connection-uri }}" >> $GITHUB_ENV
375
+ else
376
+ echo "DATABASE_URL=postgres://${{ env.PGUSER }}:${{ env.PGPASSWORD }}@${{ env.PGHOST }}:${{ job.services.postgres.ports[5432] }}/${{ env.PGDATABASE }}?sslmode=require" >> $GITHUB_ENV
377
+ fi
378
+ - name : Init database
379
+ run : tests/fixtures/initdb.sh
346
380
env :
347
- PGSERVICE : ${{ steps.pg.outputs.service-name }}
381
+ DATABASE_URL : ${{ env.DATABASE_URL }}
348
382
- name : Copy static files
349
383
run : cp -r tests/fixtures/pmtiles2/* ${{ steps.nginx.outputs.html-dir }}
350
384
- name : Download build artifact build-${{ matrix.target }}
@@ -363,7 +397,7 @@ jobs:
363
397
fi
364
398
tests/test.sh
365
399
env :
366
- DATABASE_URL : ${{ steps.pg.outputs.connection-uri }}
400
+ DATABASE_URL : ${{ env.DATABASE_URL }}
367
401
- name : Compare test output results (Linux)
368
402
if : matrix.target == 'x86_64-unknown-linux-gnu'
369
403
run : diff --brief --recursive --new-file tests/output tests/expected
@@ -383,7 +417,7 @@ jobs:
383
417
export MBTILES_BIN=/usr/bin/mbtiles${{ matrix.ext }}
384
418
tests/test.sh
385
419
env :
386
- DATABASE_URL : ${{ steps.pg.outputs.connection-uri }}
420
+ DATABASE_URL : ${{ env.DATABASE_URL }}
387
421
- name : Save test output (on error)
388
422
if : failure()
389
423
uses : actions/upload-artifact@v4
0 commit comments