Skip to content

Commit 31b781c

Browse files
Fix test (#1642)
Try to fix #1630 - [x] Back to postgis:14-3.3 - [x] Update pmt2_0_0_0.png.txt. We need more research here. It's weired.
1 parent ba2e5d5 commit 31b781c

File tree

3 files changed

+56
-22
lines changed

3 files changed

+56
-22
lines changed

.github/workflows/ci.yml

+53-19
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
PGPASSWORD: postgres
2929
services:
3030
postgres:
31-
image: postgis/postgis:16-3.4
31+
image: postgis/postgis:14-3.3
3232
ports:
3333
# will assign a random free host port
3434
- 5432/tcp
@@ -46,7 +46,7 @@ jobs:
4646
--health-timeout 5s
4747
--health-retries 5
4848
--entrypoint sh
49-
postgis/postgis:16-3.4
49+
postgis/postgis:14-3.3
5050
-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"
5151
steps:
5252
- uses: taiki-e/install-action@v2
@@ -89,7 +89,7 @@ jobs:
8989
# TODO: aarch64-unknown-linux-gnu
9090
services:
9191
postgres:
92-
image: postgis/postgis:15-3.3
92+
image: postgis/postgis:14-3.3
9393
ports:
9494
- 5432/tcp
9595
options: >-
@@ -104,7 +104,7 @@ jobs:
104104
--health-timeout 5s
105105
--health-retries 5
106106
--entrypoint sh
107-
postgis/postgis:15-3.3
107+
postgis/postgis:14-3.3
108108
-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"
109109
110110
steps:
@@ -324,6 +324,13 @@ jobs:
324324
name: Test on ${{ matrix.os }}
325325
runs-on: ${{ matrix.os }}
326326
needs: [ build ]
327+
env:
328+
# PG_* variables are used by psql
329+
PGDATABASE: test
330+
PGHOST: localhost
331+
PGUSER: postgres
332+
PGPASSWORD: postgres
333+
PGPORT: 34837
327334
strategy:
328335
fail-fast: true
329336
matrix:
@@ -337,24 +344,48 @@ jobs:
337344
- target: x86_64-unknown-linux-gnu
338345
os: ubuntu-latest
339346
steps:
340-
- name: Install and run Postgis
341-
uses: nyurik/action-setup-postgis@v2
347+
- name: Install and run Postgis (Windows)
348+
if: matrix.os == 'windows-latest'
349+
uses: nyurik/[email protected]
342350
id: pg
343-
with: { username: 'test', password: 'test', database: 'test' }
351+
with: { username: 'postgres', password: 'postgres', database: 'test',postgres-version: 14, port: 34837, postgis_version: 3.3.3}
352+
- name: Install and run Postgis (Ubuntu)
353+
if: matrix.os == 'ubuntu-latest'
354+
run: |
355+
docker run -d \
356+
-p 34837:5432 \
357+
-e POSTGRES_DB=test \
358+
-e POSTGRES_USER=postgres \
359+
-e POSTGRES_PASSWORD=postgres \
360+
-e PGDATABASE=test \
361+
-e PGUSER=postgres \
362+
-e PGPASSWORD=postgres \
363+
--health-cmd="pg_isready" \
364+
--health-interval=10s \
365+
--health-timeout=5s \
366+
--health-retries=5 \
367+
postgis/postgis:14-3.3 \
368+
postgres \
369+
-c ssl=on \
370+
-c ssl_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem \
371+
-c ssl_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
344372
- name: Start NGINX
345373
uses: nyurik/[email protected]
346374
id: nginx
347375
with: { port: '5412', output-unix-paths: 'yes' }
348376
- name: Checkout sources
349377
uses: actions/checkout@v4
350378
- name: Init database
379+
env:
380+
PGPORT: ${{ env.PGPORT }}
351381
run: |
352-
echo "DATABASE_URL=${{ steps.pg.outputs.connection-uri }}"
353-
echo "Print the same in base64 to bypass Github's obfuscation (uses hardcoded password):"
354-
echo "${{ steps.pg.outputs.connection-uri }}" | base64
382+
if [ "$RUNNER_OS" == "Linux" ]; then
383+
export DATABASE_URL="postgres://${{ env.PGUSER }}:${{ env.PGUSER }}@${{ env.PGHOST }}:${{ env.PGPORT }}/${{ env.PGDATABASE }}?sslmode=require"
384+
else
385+
export PGSERVICE="${{ steps.pg.outputs.service-name }}"
386+
fi
355387
tests/fixtures/initdb.sh
356-
env:
357-
PGSERVICE: ${{ steps.pg.outputs.service-name }}
388+
358389
- name: Copy static files
359390
run: cp -r tests/fixtures/pmtiles2/* ${{ steps.nginx.outputs.html-dir }}
360391
- name: Download build artifact build-${{ matrix.target }}
@@ -371,12 +402,15 @@ jobs:
371402
if [[ "${{ runner.os }}" != "Windows" ]]; then
372403
chmod +x "$MARTIN_BIN" "$MARTIN_CP_BIN" "$MBTILES_BIN"
373404
fi
405+
if [ "$RUNNER_OS" == "Linux" ]; then
406+
export DATABASE_URL="postgres://${{ env.PGUSER }}:${{ env.PGUSER }}@${{ env.PGHOST }}:${{ env.PGPORT }}/${{ env.PGDATABASE }}?sslmode=require"
407+
else
408+
export DATABASE_URL="${{ steps.pg.outputs.connection-uri }}"
409+
fi
374410
tests/test.sh
375-
env:
376-
DATABASE_URL: ${{ steps.pg.outputs.connection-uri }}
377-
#- name: Compare test output results (Linux)
378-
# if: matrix.target == 'x86_64-unknown-linux-gnu'
379-
# run: diff --brief --recursive --new-file tests/output tests/expected
411+
- name: Compare test output results (Linux)
412+
if: matrix.target == 'x86_64-unknown-linux-gnu'
413+
run: diff --brief --recursive --new-file tests/output tests/expected
380414
- name: Download Debian package (Linux)
381415
if: matrix.target == 'x86_64-unknown-linux-gnu'
382416
uses: actions/download-artifact@v4
@@ -393,7 +427,7 @@ jobs:
393427
export MBTILES_BIN=/usr/bin/mbtiles${{ matrix.ext }}
394428
tests/test.sh
395429
env:
396-
DATABASE_URL: ${{ steps.pg.outputs.connection-uri }}
430+
DATABASE_URL: postgres://${{ env.PGUSER }}:${{ env.PGUSER }}@${{ env.PGHOST }}:${{ env.PGPORT }}/${{ env.PGDATABASE }}?sslmode=require
397431
- name: Save test output (on error)
398432
if: failure()
399433
uses: actions/upload-artifact@v4
@@ -420,7 +454,7 @@ jobs:
420454
args: postgres
421455
sslmode: disable
422456
# alpine images don't support SSL, so for this we use the debian images
423-
- img_ver: 15-3.3
457+
- img_ver: 14-3.3
424458
args: 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
425459
sslmode: require
426460
#

docker-compose.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ services:
4747

4848
db-ssl:
4949
# This should match the version of postgres used in the CI workflow
50-
image: postgis/postgis:15-3.3
50+
image: postgis/postgis:14-3.3
5151
command:
5252
- 'postgres'
5353
- '-c'
@@ -75,7 +75,7 @@ services:
7575

7676
db-ssl-cert:
7777
# This should match the version of postgres used in the CI workflow
78-
image: postgis/postgis:15-3.3
78+
image: postgis/postgis:14-3.3
7979
command:
8080
- 'postgres'
8181
- '-c'
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
tests/output/configured/pmt2_0_0_0.png: RIFF (little-endian) data, Web/P image, with alpha, 511+1x511+1
1+
tests/output/configured/pmt2_0_0_0.png: RIFF (little-endian) data, Web/P image

0 commit comments

Comments
 (0)