Skip to content

Commit cca3f1b

Browse files
committed
add builx workflow
1 parent d2806db commit cca3f1b

File tree

5 files changed

+140
-4
lines changed

5 files changed

+140
-4
lines changed

.github/workflows/buildx.yml

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: buildx Docker PostGIS CI (experimental)
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: '15 5 * * 2'
8+
9+
defaults:
10+
run:
11+
shell: bash
12+
13+
jobs:
14+
15+
make-docker-images:
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
#
20+
platforms: ['linux/arm64','linux/arm/v7','linux/arm/v6','linux/386','linux/ppc64le']
21+
#
22+
# platforms: ['linux/arm64','linux/arm/v7','linux/arm/v6','linux/386','linux/mips64le','linux/ppc64le','linux/s390x']
23+
#
24+
# comments:
25+
# 'linux/arm/v7' - default/debian: Unable to locate package postgresql-14-postgis-3;
26+
# 'linux/arm/v6' - default/debian: Unable to locate package postgresql-14-postgis-3;
27+
# 'linux/s390x' alpine: failed test.
28+
# 'linux/mips64le' alpine failed test.
29+
#
30+
postgres: [14]
31+
postgis: ['3.2']
32+
variant: [alpine]
33+
include:
34+
35+
- postgres: 14
36+
postgis: '3.2'
37+
variant: 'default'
38+
platforms: 'linux/arm64'
39+
40+
- postgres: 14
41+
postgis: '3.2'
42+
variant: 'default'
43+
platforms: 'linux/ppc64le'
44+
45+
name: ${{ matrix.platforms }} ${{ matrix.postgres }}-${{ matrix.postgis }} ${{ matrix.variant }}
46+
runs-on: ubuntu-latest
47+
48+
env:
49+
VERSION: ${{ matrix.postgres }}-${{ matrix.postgis }}
50+
VARIANT: ${{ matrix.variant }}
51+
52+
steps:
53+
54+
- name: Checkout
55+
uses: actions/checkout@v3
56+
57+
- name: Set up QEMU
58+
uses: docker/setup-qemu-action@v2
59+
60+
- name: Set up Docker Buildx
61+
uses: docker/setup-buildx-action@v2
62+
63+
- name: "docker buildx inspect --bootstrap"
64+
run: docker buildx inspect --bootstrap
65+
66+
- name: "docker buildx ls"
67+
run: docker buildx ls
68+
69+
- if: ${{ env.VARIANT == 'alpine' }}
70+
run: docker pull --platform=${{ matrix.platforms }} postgres:${{ matrix.postgres }}-alpine3.16 && docker inspect postgres:${{ matrix.postgres }}-alpine3.16
71+
env:
72+
DOCKER_DEFAULT_PLATFORM: ${{ matrix.platforms }}
73+
PLATFORM: ${{ matrix.platforms }}
74+
75+
- name: Build docker image for ${{ env.VERSION }} ${{ env.VARIANT }} ${{ env.DOCKER_DEFAULT_PLATFORM }}
76+
run: make test
77+
env:
78+
DOCKER_DEFAULT_PLATFORM: ${{ matrix.platforms }}
79+
PLATFORM: ${{ matrix.platforms }}
80+
POSTGRES_TEST_TRIES: 42
81+
POSTGRES_TEST_SLEEP: 2
82+
83+
- name: "docker images"
84+
run: docker images
85+
86+
- if: ${{ env.VARIANT == 'default' }}
87+
run: docker inspect postgis/postgis:${{ env.VERSION }}
88+
89+
- if: ${{ env.VARIANT == 'alpine' }}
90+
run: docker inspect postgis/postgis:${{ env.VERSION }}-${{ env.VARIANT }}
91+
92+
#--- temp security commenting ----#
93+
# - name: Login to dockerhub
94+
# uses: docker/login-action@v1
95+
# if: ${{ (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }}
96+
# with:
97+
# username: ${{ secrets.DOCKERHUB_USERNAME }}
98+
# password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
99+
#
100+
# - name: Push docker image to dockerhub
101+
# if: ${{ (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }}
102+
# env:
103+
# DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
104+
# DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
105+
# DOCKERHUB_ACCESS_TOKEN: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
106+
# DOCKER_DEFAULT_PLATFORM: ${{ matrix.platforms }}
107+
# PLATFORM: ${{ matrix.platforms }}
108+
# run: make push

14-3.2/Dockerfile

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
FROM postgres:14-bullseye
22

3+
RUN uname -a
4+
RUN uname -m
5+
RUN lscpu
6+
RUN cat /proc/cpuinfo
7+
38
LABEL maintainer="PostGIS Project - https://postgis.net"
49

510
ENV POSTGIS_MAJOR 3

14-3.2/alpine/Dockerfile

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
FROM postgres:14-alpine3.16
1+
FROM --platform= postgres:14-alpine3.16
2+
3+
RUN uname -a
4+
RUN uname -m
5+
RUN cat /proc/cpuinfo
26

37
LABEL maintainer="PostGIS Project - https://postgis.net"
48

@@ -94,7 +98,13 @@ RUN set -eux \
9498
&& mkdir /tempdb \
9599
&& chown -R postgres:postgres /tempdb \
96100
&& su postgres -c 'pg_ctl -D /tempdb init' \
97-
&& su postgres -c 'pg_ctl -D /tempdb start' \
101+
&& su postgres -c 'pg_ctl -o "--fsync=off" -o "--huge_pages=off" -o "--jit=off" -o "--synchronous_commit=off" -D /tempdb start' \
102+
\
103+
&& su postgres -c 'psql -c "SHOW JIT;"' \
104+
&& su postgres -c 'psql -c "SHOW FSYNC;"' \
105+
&& su postgres -c 'psql -c "SHOW SYNCHRONOUS_COMMIT;"' \
106+
&& su postgres -c 'psql -c "SHOW HUGE_PAGES;"' \
107+
\
98108
&& cd regress \
99109
&& make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \
100110
#&& make -j$(nproc) check RUNTESTFLAGS=--dumprestore PGUSER=postgres \
@@ -131,3 +141,4 @@ RUN set -eux \
131141

132142
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh
133143
COPY ./update-postgis.sh /usr/local/bin
144+

15beta3-3.3.0rc2/alpine/Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
FROM postgres:15beta3-alpine3.16
22

3+
RUN uname -a
4+
RUN uname -m
5+
RUN cat /proc/cpuinfo
6+
37
LABEL maintainer="PostGIS Project - https://postgis.net"
48

59
ENV POSTGIS_VERSION 3.3.0rc2

test/tests/postgis-basics/run.sh

+10-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ set -e
33

44
image="$1"
55

6+
# buildx debug:
7+
uname -a
8+
uname -m
9+
cat /proc/cpuinfo
10+
611
export POSTGRES_USER='my cool postgres user'
712
export POSTGRES_PASSWORD='my cool postgres password'
813
export POSTGRES_DB='my cool postgres database'
@@ -24,15 +29,18 @@ psql() {
2429
"$@"
2530
}
2631

27-
tries=10
32+
: ${POSTGRES_TEST_TRIES:=10}
33+
: ${POSTGRES_TEST_SLEEP:=2}
34+
35+
tries="$POSTGRES_TEST_TRIES"
2836
while ! echo 'SELECT 1' | psql &> /dev/null; do
2937
(( tries-- ))
3038
if [ $tries -le 0 ]; then
3139
echo >&2 'postgres failed to accept connections in a reasonable amount of time!'
3240
echo 'SELECT 1' | psql # to hopefully get a useful error message
3341
false
3442
fi
35-
sleep 2
43+
sleep "$POSTGRES_TEST_SLEEP"
3644
done
3745

3846
echo 'SELECT PostGIS_Version()' | psql

0 commit comments

Comments
 (0)