Skip to content

Commit

Permalink
add builx workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ImreSamu committed Sep 6, 2022
1 parent d2806db commit cca3f1b
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 4 deletions.
108 changes: 108 additions & 0 deletions .github/workflows/buildx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: buildx Docker PostGIS CI (experimental)

on:
push:
pull_request:
schedule:
- cron: '15 5 * * 2'

defaults:
run:
shell: bash

jobs:

make-docker-images:
strategy:
fail-fast: false
matrix:
#
platforms: ['linux/arm64','linux/arm/v7','linux/arm/v6','linux/386','linux/ppc64le']
#
# platforms: ['linux/arm64','linux/arm/v7','linux/arm/v6','linux/386','linux/mips64le','linux/ppc64le','linux/s390x']
#
# comments:
# 'linux/arm/v7' - default/debian: Unable to locate package postgresql-14-postgis-3;
# 'linux/arm/v6' - default/debian: Unable to locate package postgresql-14-postgis-3;
# 'linux/s390x' alpine: failed test.
# 'linux/mips64le' alpine failed test.
#
postgres: [14]
postgis: ['3.2']
variant: [alpine]
include:

- postgres: 14
postgis: '3.2'
variant: 'default'
platforms: 'linux/arm64'

- postgres: 14
postgis: '3.2'
variant: 'default'
platforms: 'linux/ppc64le'

name: ${{ matrix.platforms }} ${{ matrix.postgres }}-${{ matrix.postgis }} ${{ matrix.variant }}
runs-on: ubuntu-latest

env:
VERSION: ${{ matrix.postgres }}-${{ matrix.postgis }}
VARIANT: ${{ matrix.variant }}

steps:

- name: Checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: "docker buildx inspect --bootstrap"
run: docker buildx inspect --bootstrap

- name: "docker buildx ls"
run: docker buildx ls

- if: ${{ env.VARIANT == 'alpine' }}
run: docker pull --platform=${{ matrix.platforms }} postgres:${{ matrix.postgres }}-alpine3.16 && docker inspect postgres:${{ matrix.postgres }}-alpine3.16
env:
DOCKER_DEFAULT_PLATFORM: ${{ matrix.platforms }}
PLATFORM: ${{ matrix.platforms }}

- name: Build docker image for ${{ env.VERSION }} ${{ env.VARIANT }} ${{ env.DOCKER_DEFAULT_PLATFORM }}
run: make test
env:
DOCKER_DEFAULT_PLATFORM: ${{ matrix.platforms }}
PLATFORM: ${{ matrix.platforms }}
POSTGRES_TEST_TRIES: 42
POSTGRES_TEST_SLEEP: 2

- name: "docker images"
run: docker images

- if: ${{ env.VARIANT == 'default' }}
run: docker inspect postgis/postgis:${{ env.VERSION }}

- if: ${{ env.VARIANT == 'alpine' }}
run: docker inspect postgis/postgis:${{ env.VERSION }}-${{ env.VARIANT }}

#--- temp security commenting ----#
# - name: Login to dockerhub
# uses: docker/login-action@v1
# if: ${{ (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }}
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
#
# - name: Push docker image to dockerhub
# if: ${{ (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }}
# env:
# DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
# DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
# DOCKERHUB_ACCESS_TOKEN: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
# DOCKER_DEFAULT_PLATFORM: ${{ matrix.platforms }}
# PLATFORM: ${{ matrix.platforms }}
# run: make push
5 changes: 5 additions & 0 deletions 14-3.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
FROM postgres:14-bullseye

RUN uname -a
RUN uname -m
RUN lscpu
RUN cat /proc/cpuinfo

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

ENV POSTGIS_MAJOR 3
Expand Down
15 changes: 13 additions & 2 deletions 14-3.2/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
FROM postgres:14-alpine3.16
FROM --platform= postgres:14-alpine3.16

RUN uname -a
RUN uname -m
RUN cat /proc/cpuinfo

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

Expand Down Expand Up @@ -94,7 +98,13 @@ RUN set -eux \
&& mkdir /tempdb \
&& chown -R postgres:postgres /tempdb \
&& su postgres -c 'pg_ctl -D /tempdb init' \
&& su postgres -c 'pg_ctl -D /tempdb start' \
&& su postgres -c 'pg_ctl -o "--fsync=off" -o "--huge_pages=off" -o "--jit=off" -o "--synchronous_commit=off" -D /tempdb start' \
\
&& su postgres -c 'psql -c "SHOW JIT;"' \
&& su postgres -c 'psql -c "SHOW FSYNC;"' \
&& su postgres -c 'psql -c "SHOW SYNCHRONOUS_COMMIT;"' \
&& su postgres -c 'psql -c "SHOW HUGE_PAGES;"' \
\
&& cd regress \
&& make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \
#&& make -j$(nproc) check RUNTESTFLAGS=--dumprestore PGUSER=postgres \
Expand Down Expand Up @@ -131,3 +141,4 @@ RUN set -eux \

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

4 changes: 4 additions & 0 deletions 15beta3-3.3.0rc2/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
FROM postgres:15beta3-alpine3.16

RUN uname -a
RUN uname -m
RUN cat /proc/cpuinfo

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

ENV POSTGIS_VERSION 3.3.0rc2
Expand Down
12 changes: 10 additions & 2 deletions test/tests/postgis-basics/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ set -e

image="$1"

# buildx debug:
uname -a
uname -m
cat /proc/cpuinfo

export POSTGRES_USER='my cool postgres user'
export POSTGRES_PASSWORD='my cool postgres password'
export POSTGRES_DB='my cool postgres database'
Expand All @@ -24,15 +29,18 @@ psql() {
"$@"
}

tries=10
: ${POSTGRES_TEST_TRIES:=10}
: ${POSTGRES_TEST_SLEEP:=2}

tries="$POSTGRES_TEST_TRIES"
while ! echo 'SELECT 1' | psql &> /dev/null; do
(( tries-- ))
if [ $tries -le 0 ]; then
echo >&2 'postgres failed to accept connections in a reasonable amount of time!'
echo 'SELECT 1' | psql # to hopefully get a useful error message
false
fi
sleep 2
sleep "$POSTGRES_TEST_SLEEP"
done

echo 'SELECT PostGIS_Version()' | psql
Expand Down

0 comments on commit cca3f1b

Please sign in to comment.