kopia lustrzana https://github.com/kartoza/docker-postgis
219 wiersze
7.5 KiB
YAML
219 wiersze
7.5 KiB
YAML
name: build-latest
|
|
on:
|
|
# workflow_dispatch:
|
|
# inputs:
|
|
# distro:
|
|
# description: Base image distro
|
|
# required: true
|
|
# default: debian
|
|
# imageVersion:
|
|
# description: Base distro image version/release
|
|
# required: true
|
|
# default: bullseye
|
|
# imageVariant:
|
|
# description: Base image variant
|
|
# required: true
|
|
# default: slim
|
|
push:
|
|
pull_request:
|
|
branches:
|
|
- develop
|
|
jobs:
|
|
build-image:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
latest-ref: refs/heads/develop
|
|
defaultRepo: kartoza
|
|
strategy:
|
|
matrix:
|
|
postgresMajorVersion:
|
|
- 13
|
|
postgisMajorVersion:
|
|
- 3
|
|
postgisMinorRelease:
|
|
- 1
|
|
include:
|
|
- distro: debian
|
|
imageVersion: bullseye
|
|
imageVariant: slim
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
- name: Get build cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
# Build inputs are:
|
|
# - Dockerfile recipe
|
|
# - docker-compose.build.yml
|
|
# - build args (.example.env)
|
|
# - base_build directory
|
|
# - scripts directory
|
|
key: buildx-${{ hashFiles('Dockerfile', 'docker-compose.build.yml', '.example.env', 'base_build', 'scripts', 'scenario_tests/utils/requirements.txt') }}-${{ github.sha }}
|
|
restore-keys: |
|
|
buildx-${{ hashFiles('Dockerfile', 'docker-compose.build.yml', '.example.env', 'base_build', 'scripts', 'scenario_tests/utils/requirements.txt') }}-
|
|
|
|
- name: Build all stages
|
|
id: docker_build_base
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
push: false
|
|
load: true
|
|
tags: ${{ secrets.DOCKERHUB_REPO || env.defaultRepo }}/postgis:base-${{ matrix.distro }}-${{ matrix.imageVersion }}-${{ matrix.imageVariant }}
|
|
build-args: |
|
|
DISTRO=${{ matrix.distro }}
|
|
IMAGE_VERSION=${{ matrix.imageVersion }}
|
|
IMAGE_VARIANT=${{ matrix.imageVariant }}
|
|
LANGS=en_US.UTF-8,id_ID.UTF-8
|
|
GENERATE_ALL_LOCALE=0
|
|
POSTGRES_MAJOR_VERSION=${{ matrix.postgresMajorVersion }}
|
|
POSTGIS_MAJOR_VERSION=${{ matrix.postgisMajorVersion }}
|
|
POSTGIS_MINOR_VERSION=${{ matrix.postgresMinorVersion }}
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache
|
|
|
|
run-scenario-tests:
|
|
runs-on: ubuntu-latest
|
|
needs: [ build-image ]
|
|
strategy:
|
|
matrix:
|
|
postgresMajorVersion:
|
|
- 13
|
|
postgisMajorVersion:
|
|
- 3
|
|
postgisMinorRelease:
|
|
- 1
|
|
scenario:
|
|
- datadir_init
|
|
- streaming_replication
|
|
- collations
|
|
- extensions
|
|
- logical_replication
|
|
include:
|
|
- distro: debian
|
|
imageVersion: bullseye
|
|
imageVariant: slim
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
- name: Get build cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
# Build inputs are:
|
|
# - Dockerfile recipe
|
|
# - docker-compose.build.yml
|
|
# - build args (.example.env)
|
|
# - base_build directory
|
|
# - scripts directory
|
|
key: buildx-${{ hashFiles('Dockerfile', 'docker-compose.build.yml', '.example.env', 'base_build', 'scripts', 'scenario_tests/utils/requirements.txt') }}-${{ github.sha }}
|
|
restore-keys: |
|
|
buildx-${{ hashFiles('Dockerfile', 'docker-compose.build.yml', '.example.env', 'base_build', 'scripts', 'scenario_tests/utils/requirements.txt') }}-
|
|
|
|
- name: Build image for testing
|
|
id: docker_build_testing_image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
push: false
|
|
load: true
|
|
tags: kartoza/postgis:manual-build
|
|
build-args: |
|
|
DISTRO=${{ matrix.distro }}
|
|
IMAGE_VERSION=${{ matrix.imageVersion }}
|
|
IMAGE_VARIANT=${{ matrix.imageVariant }}
|
|
LANGS=en_US.UTF-8,id_ID.UTF-8
|
|
GENERATE_ALL_LOCALE=0
|
|
POSTGRES_MAJOR_VERSION=${{ matrix.postgresMajorVersion }}
|
|
POSTGIS_MAJOR_VERSION=${{ matrix.postgisMajorVersion }}
|
|
POSTGIS_MINOR_VERSION=${{ matrix.postgresMinorVersion }}
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
target: postgis-test
|
|
|
|
- name: Run scenario test
|
|
env:
|
|
COMPOSE_INTERACTIVE_NO_CLI: 1
|
|
PRINT_TEST_LOGS: 1
|
|
run: |
|
|
pushd scenario_tests/${{ matrix.scenario }}
|
|
./test.sh
|
|
popd
|
|
|
|
push-internal-pr-images:
|
|
if: github.event_name == 'pull_request' && github.event.pull_request.base.repo.url == github.event.pull_request.head.repo.url
|
|
runs-on: ubuntu-latest
|
|
needs: [ build-image ]
|
|
strategy:
|
|
matrix:
|
|
postgresMajorVersion:
|
|
- 13
|
|
postgisMajorVersion:
|
|
- 3
|
|
postgisMinorRelease:
|
|
- 1
|
|
include:
|
|
- distro: debian
|
|
imageVersion: bullseye
|
|
imageVariant: slim
|
|
steps:
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
|
|
- name: Docker meta
|
|
id: docker_meta
|
|
uses: crazy-max/ghaction-docker-meta@v1
|
|
with:
|
|
images: ${{ secrets.DOCKERHUB_REPO}}/postgis
|
|
tag-latest: false
|
|
|
|
- uses: actions/checkout@v2
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
- name: Get build cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
# Build inputs are:
|
|
# - Dockerfile recipe
|
|
# - docker-compose.build.yml
|
|
# - build args (.example.env)
|
|
# - base_build directory
|
|
# - scripts directory
|
|
key: buildx-${{ hashFiles('Dockerfile', 'docker-compose.build.yml', '.example.env', 'base_build', 'scripts') }}-${{ github.sha }}
|
|
restore-keys: |
|
|
buildx-${{ hashFiles('Dockerfile', 'docker-compose.build.yml', '.example.env', 'base_build', 'scripts') }}-
|
|
|
|
- name: Build image for testing
|
|
id: docker_build_testing_image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
push: true
|
|
tags: ${{ steps.docker_meta.outputs.tags }}-${{ matrix.postgresMajorVersion }}-${{ matrix.postgisMajorVersion }}.${{ matrix.postgisMinorRelease }}
|
|
build-args: |
|
|
DISTRO=${{ matrix.distro }}
|
|
IMAGE_VERSION=${{ matrix.imageVersion }}
|
|
IMAGE_VARIANT=${{ matrix.imageVariant }}
|
|
LANGS=en_US.UTF-8,id_ID.UTF-8
|
|
GENERATE_ALL_LOCALE=0
|
|
POSTGRES_MAJOR_VERSION=${{ matrix.postgresMajorVersion }}
|
|
POSTGIS_MAJOR_VERSION=${{ matrix.postgisMajorVersion }}
|
|
POSTGIS_MINOR_VERSION=${{ matrix.postgresMinorVersion }}
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
target: postgis-test
|