WIP: bookworm, Arm64, (geo)Bundle, improved tagging #462
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build PostGIS images | |
# This is the x86_64/Amd64 build worklow | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '15 5 * * *' | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
make-docker-images: | |
strategy: | |
matrix: | |
include: | |
# | |
# They are created using the ./apply-ci.sh script based on the version.json file, | |
# | |
# These "--skip--" images serve as inputs for the "*-bundle" images, | |
# hence they must be generated within the bundle JOB. | |
# | |
#matrix-include-start | |
- { version: "11-3.3", variant: "alpine3.18", postgres: "11", postgis: "3.3", arch: "amd64 arm64", tags: "11-3.3-alpine3.18 11-3.3.4-alpine3.18 11-3.3-alpine", readme_group: "alpine3.18" } | |
- { version: "11-3.3", variant: "bookworm", postgres: "11", postgis: "3.3", arch: "amd64 arm64", tags: "11-3.3-bookworm 11-3.3.4-bookworm 11-3.3", readme_group: "bookworm" } | |
- { version: "11-3.3", variant: "bullseye", postgres: "11", postgis: "3.3", arch: "amd64 arm64", tags: "11-3.3-bullseye 11-3.3.4-bullseye", readme_group: "bullseye" } | |
- { version: "12-3.4", variant: "alpine3.18", postgres: "12", postgis: "3.4", arch: "amd64 arm64", tags: "12-3.4-alpine3.18 12-3.4.0-alpine3.18 12-3.4-alpine", readme_group: "alpine3.18" } | |
- { version: "12-3.4", variant: "bookworm", postgres: "12", postgis: "3.4", arch: "amd64 arm64", tags: "12-3.4-bookworm 12-3.4.0-bookworm 12-3.4", readme_group: "bookworm" } | |
- { version: "12-3.4", variant: "bullseye", postgres: "12", postgis: "3.4", arch: "amd64 arm64", tags: "12-3.4-bullseye 12-3.4.0-bullseye", readme_group: "bullseye" } | |
- { version: "13-3.4", variant: "alpine3.18", postgres: "13", postgis: "3.4", arch: "amd64 arm64", tags: "13-3.4-alpine3.18 13-3.4.0-alpine3.18 13-3.4-alpine", readme_group: "alpine3.18" } | |
- { version: "13-3.4", variant: "bookworm", postgres: "13", postgis: "3.4", arch: "amd64 arm64", tags: "13-3.4-bookworm 13-3.4.0-bookworm 13-3.4", readme_group: "bookworm" } | |
- { version: "13-3.4", variant: "bullseye", postgres: "13", postgis: "3.4", arch: "amd64 arm64", tags: "13-3.4-bullseye 13-3.4.0-bullseye", readme_group: "bullseye" } | |
- { version: "14-3.4", variant: "alpine3.18", postgres: "14", postgis: "3.4", arch: "amd64 arm64", tags: "14-3.4-alpine3.18 14-3.4.0-alpine3.18 14-3.4-alpine", readme_group: "alpine3.18" } | |
# --skip-- - { version: "14-3.4", variant: "bookworm", postgres: "14", postgis: "3.4", arch: "amd64 arm64", tags: "14-3.4-bookworm 14-3.4.0-bookworm 14-3.4", readme_group: "bookworm" } | |
- { version: "14-3.4", variant: "bullseye", postgres: "14", postgis: "3.4", arch: "amd64 arm64", tags: "14-3.4-bullseye 14-3.4.0-bullseye", readme_group: "bullseye" } | |
- { version: "14-3.4-bundle0", variant: "bookworm", postgres: "14", postgis: "3.4", arch: "amd64 arm64", tags: "14-3.4-bundle0-bookworm 14-3.4.0-bundle0-bookworm 14-3.4-bundle0", readme_group: "bundle0" } | |
- { version: "15-3.4", variant: "alpine3.18", postgres: "15", postgis: "3.4", arch: "amd64 arm64", tags: "15-3.4-alpine3.18 15-3.4.0-alpine3.18 15-3.4-alpine", readme_group: "alpine3.18" } | |
# --skip-- - { version: "15-3.4", variant: "bookworm", postgres: "15", postgis: "3.4", arch: "amd64 arm64", tags: "15-3.4-bookworm 15-3.4.0-bookworm 15-3.4", readme_group: "bookworm" } | |
- { version: "15-3.4", variant: "bullseye", postgres: "15", postgis: "3.4", arch: "amd64 arm64", tags: "15-3.4-bullseye 15-3.4.0-bullseye", readme_group: "bullseye" } | |
- { version: "15-3.4-bundle0", variant: "bookworm", postgres: "15", postgis: "3.4", arch: "amd64 arm64", tags: "15-3.4-bundle0-bookworm 15-3.4.0-bundle0-bookworm 15-3.4-bundle0", readme_group: "bundle0" } | |
- { version: "15-master", variant: "bookworm", postgres: "15", postgis: "master", arch: "amd64 arm64", tags: "15-master-bookworm 15-master", readme_group: "test" } | |
- { version: "15-recent", variant: "bookworm", postgres: "15", postgis: "recent", arch: "amd64 arm64", tags: "15-recent-bookworm 15-recent", readme_group: "recent" } | |
- { version: "16-3.4", variant: "alpine3.18", postgres: "16", postgis: "3.4", arch: "amd64 arm64", tags: "16-3.4-alpine3.18 16-3.4.0-alpine3.18 16-3.4-alpine alpine", readme_group: "alpine3.18" } | |
# --skip-- - { version: "16-3.4", variant: "bookworm", postgres: "16", postgis: "3.4", arch: "amd64 arm64", tags: "16-3.4-bookworm 16-3.4.0-bookworm 16-3.4 latest", readme_group: "bookworm" } | |
- { version: "16-3.4", variant: "bullseye", postgres: "16", postgis: "3.4", arch: "amd64 arm64", tags: "16-3.4-bullseye 16-3.4.0-bullseye", readme_group: "bullseye" } | |
- { version: "16-3.4-bundle0", variant: "bookworm", postgres: "16", postgis: "3.4", arch: "amd64 arm64", tags: "16-3.4-bundle0-bookworm 16-3.4.0-bundle0-bookworm 16-3.4-bundle0 bundle0", readme_group: "bundle0" } | |
- { version: "16-master", variant: "bookworm", postgres: "16", postgis: "master", arch: "amd64 arm64", tags: "16-master-bookworm 16-master", readme_group: "test" } | |
- { version: "16-recent", variant: "bookworm", postgres: "16", postgis: "recent", arch: "amd64 arm64", tags: "16-recent-bookworm 16-recent", readme_group: "recent" } | |
#matrix-include-end | |
name: "${{ matrix.version }}-${{ matrix.variant }} docker image" | |
runs-on: ubuntu-22.04 | |
continue-on-error: ${{ matrix.postgis == 'master' }} | |
env: | |
PLATFORM: linux/amd64 | |
DOCKER_BUILDKIT: '1' | |
BUILDX_PLATFORMS: linux/amd64 | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Install manifest-tool | |
run: | | |
wget https://github.com/estesp/manifest-tool/releases/download/v2.0.8/binaries-manifest-tool-2.0.8.tar.gz | |
mkdir manifest-tool | |
tar -xvzf binaries-manifest-tool-2.0.8.tar.gz -C manifest-tool | |
sudo mv manifest-tool/manifest-tool-linux-amd64 /usr/local/bin/manifest-tool | |
manifest-tool -v | |
- run: pip install lastversion | |
- name: Environment init | |
run: source tools/environment_init.sh | |
- run: make check_version | |
- name: Check if DOCKERHUB_USERNAME exists | |
run: | | |
if [[ -z "${{ secrets.DOCKERHUB_USERNAME }}" ]]; then | |
echo "DOCKERHUB_USERNAME is not set" | |
exit 1 | |
else | |
echo "DOCKERHUB_USERNAME is set" | |
fi | |
- name: Check if DOCKERHUB_ACCESS_TOKEN exists | |
run: | | |
if [[ -z "${{ secrets.DOCKERHUB_ACCESS_TOKEN }}" ]]; then | |
echo "DOCKERHUB_ACCESS_TOKEN is not set" | |
exit 1 | |
else | |
echo "DOCKERHUB_ACCESS_TOKEN is set" | |
fi | |
- name: Source the check_image_exists function | |
run: source tools/environment_init.sh | |
- name: Check if image exists | |
id: check-image | |
run: | | |
if check_image_exists "${{ matrix.version }}-${{ matrix.variant }}$(IMAGE_VERSION_ID)"; then | |
echo "IMAGE_EXISTS=true" >> $GITHUB_ENV | |
else | |
echo "IMAGE_EXISTS=false" >> $GITHUB_ENV | |
fi | |
- name: Exit if image exists | |
if: env.IMAGE_EXISTS == 'true' | |
run: | | |
echo "weekly build exists; no need to re-build. STOP" | |
exit 0 | |
- name: Login to dockerhub | |
uses: docker/login-action@v2 | |
if: ${{ (env.IMAGE_EXISTS == 'false') && (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }} | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} | |
- name: "verify: make -n test-${{ matrix.version }}-${{ matrix.variant }} tags ${{ matrix.tags }}" | |
if: env.IMAGE_EXISTS == 'false' | |
run: make -n test-${{ matrix.version }}-${{ matrix.variant }} | |
- name: "make test-${{ matrix.version }}-${{ matrix.variant }} tags ${{ matrix.tags }}" | |
if: env.IMAGE_EXISTS == 'false' | |
run: make test-${{ matrix.version }}-${{ matrix.variant }} | |
- run: make dockerlist | |
- name: Push docker image to dockerhub | |
if: ${{ (env.IMAGE_EXISTS == 'false') && (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }} | |
env: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_ACCESS_TOKEN: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} | |
run: | | |
make push-${{ matrix.version }}-${{ matrix.variant }} | |
make manifest-${{ matrix.version }}-${{ matrix.variant }} | |
make-manifest: | |
name: update manifest | |
needs: make-docker-images | |
runs-on: ubuntu-22.04 | |
env: | |
PLATFORM: linux/amd64 | |
DOCKER_BUILDKIT: '1' | |
BUILDX_PLATFORMS: linux/amd64 | |
# Todo: wait CircleCI workflow to start updating the manifest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Install manifest-tool | |
run: | | |
wget https://github.com/estesp/manifest-tool/releases/download/v2.0.8/binaries-manifest-tool-2.0.8.tar.gz | |
mkdir manifest-tool | |
tar -xvzf binaries-manifest-tool-2.0.8.tar.gz -C manifest-tool | |
sudo mv manifest-tool/manifest-tool-linux-amd64 /usr/local/bin/manifest-tool | |
manifest-tool -v | |
- run: pip install lastversion | |
- name: Environment init | |
run: source tools/environment_init.sh | |
- run: make check_version | |
- run: sleep 20m # Wait for CircleCI to finish building images; Temporary workarounds | |
- name: Login to dockerhub | |
uses: docker/login-action@v2 | |
if: ${{ (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }} | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} | |
- name: push readme to docker hub api | |
if: ${{ (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }} | |
env: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_ACCESS_TOKEN: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} | |
run: make push-readme | |
- name: Update docker manifest | |
if: ${{ (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }} | |
run: ./manifest.sh | |