language: minimal

dist: bionic

os: linux

services:
  - docker

arch: amd64

env:
  global:
    - CONTAINER_NAME=github-docker-builder
  jobs:
    - IMAGE=alpine IMAGE_TAG=latest
    - IMAGE=archlinux IMAGE_TAG=latest
    # 18.04 (Bionic) is the oldest one we want to attempt builds with.
    - IMAGE=ubuntu IMAGE_TAG=bionic
    - IMAGE=ubuntu IMAGE_TAG=latest
    - IMAGE=ubuntu IMAGE_TAG=rolling
    # Something broke here.  Commenting it out to see if it's just broken at the head.
    #- IMAGE=ubuntu IMAGE_TAG=devel
    - IMAGE=fedora IMAGE_TAG=latest
    - IMAGE=fedora IMAGE_TAG=rawhide

jobs:
  include:
    - arch: i386
      env: IMAGE=debian IMAGE_TAG=stable
    - arch: arm64
      env: IMAGE=ubuntu IMAGE_TAG=rolling
    # Disabled - the docker is failing to boot ver early with this output:
    # Unpacking locales (2.31-0ubuntu9) ...
    # dpkg: error processing archive /var/cache/apt/archives/locales_2.31-0ubuntu9_all.deb (--unpack):
    #   unable to install new version of './usr/share/doc/locales': Invalid cross-device link
    # dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
    # Errors were encountered while processing:
    #  /var/cache/apt/archives/locales_2.31-0ubuntu9_all.deb
    #- arch: ppc64le
    #  env: IMAGE=ubuntu IMAGE_TAG=rolling
    - arch: s390x
      env: IMAGE=ubuntu IMAGE_TAG=rolling

before_install:
  - docker run -d --rm --cap-add SYS_PTRACE --name $CONTAINER_NAME -e LC_ALL="C" -e LANG="C" -v $(pwd):/build -w /build $IMAGE_PREFIX$IMAGE:$IMAGE_TAG tail -f /dev/null
  - docker ps
  - docker exec -e CI_BUILD=1 -e IMAGE=$IMAGE -e IMAGE_TAG=$IMAGE_TAG -t $CONTAINER_NAME sh .github/preinstall.sh
  - docker exec -e CI_BUILD=1 -e IMAGE=$IMAGE -e IMAGE_TAG=$IMAGE_TAG -t $CONTAINER_NAME bash .github/update-packages.sh

install:
  - docker exec -e CI_BUILD=1 -e IMAGE=$IMAGE -e IMAGE_TAG=$IMAGE_TAG -t $CONTAINER_NAME bash .github/install.sh
  - docker exec -e CI_BUILD=1 -e IMAGE=$IMAGE -e IMAGE_TAG=$IMAGE_TAG -t $CONTAINER_NAME bash .github/install-post.sh

script:
  - docker exec -e CI_BUILD=1 -e IMAGE=$IMAGE -e IMAGE_TAG=$IMAGE_TAG -t $CONTAINER_NAME bash .github/build.sh
  - docker kill $CONTAINER_NAME

# vim: set ts=2 sts=2 sw=2 et:
