aboutsummaryrefslogtreecommitdiff
blob: 7661939fd6aabb71f218502181327265979e26f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
language: shell
env:
  global:
    - DOCKER_CLI_EXPERIMENTAL=enabled  # required by buildx
    - ORG=gentoo
  jobs:
    - TARGET=portage
    - TARGET=stage3-amd64 LATEST=true
    - TARGET=stage3-amd64-hardened
    - TARGET=stage3-amd64-hardened-nomultilib
    - TARGET=stage3-amd64-musl-hardened
    - TARGET=stage3-amd64-musl-vanilla
    - TARGET=stage3-amd64-nomultilib
    - TARGET=stage3-amd64-systemd
    - TARGET=stage3-amd64-uclibc-hardened
    - TARGET=stage3-amd64-uclibc-vanilla
    - TARGET=stage3-arm64
    - TARGET=stage3-arm64-systemd
    - TARGET=stage3-armv5tel
    - TARGET=stage3-armv6j_hardfp
    - TARGET=stage3-armv7a_hardfp
    - TARGET=stage3-ppc64le
    - TARGET=stage3-s390x
    - TARGET=stage3-x86
    - TARGET=stage3-x86-hardened
    - TARGET=stage3-x86-musl-vanilla
    - TARGET=stage3-x86-systemd
    - TARGET=stage3-x86-uclibc-hardened
    - TARGET=stage3-x86-uclibc-vanilla

before_install:
  # Install latest Docker (>=19.03.0 required by buildx)
  # https://docs.travis-ci.com/user/docker/#installing-a-newer-docker-version
  - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  - sudo apt-get update -qq
  - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
  - docker info
before_script:
  # Create multiarch buildx builder
  - docker buildx create --driver docker-container --use
script:
  # Build image
  - ./build.sh
after_success:
  # Inspect built image
  - docker image inspect "${ORG}/${TARGET/-/:}"
  # Run `emerge --info` for stage builds
  - |
    if [[ "${TARGET}" == stage* ]]; then
      # Check if QEMU emulation support is required
      if [[ ! "${TARGET}" =~ -(amd64|x86)($|-) ]]; then
        # Enable execution of foreign binary formats (i.e., non-amd64/x86)
        docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
      fi
      docker run --rm "${ORG}/${TARGET/-/:}" emerge --info
    fi
  # Push all built images to Docker Hub (cron daily task)
  - |
    if [[ "${TRAVIS_PULL_REQUEST_BRANCH:-${TRAVIS_BRANCH}}" == "master" && "${TRAVIS_EVENT_TYPE}" == "cron" ]]; then
      echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
      REPO="$(cut -d '-' -f 1 <<< ${TARGET})"
      docker push "${ORG}/${REPO}"
    fi