.gitlab-ci.yml 2.56 KB
Newer Older
1
image: docker:19.03.1
Matthew Pickering's avatar
Matthew Pickering committed
2

Ben Gamari's avatar
Ben Gamari committed
3 4 5 6
stages:
  - lint
  - build

Matthew Pickering's avatar
Matthew Pickering committed
7
services:
8
  - docker:19.03.1-dind
Matthew Pickering's avatar
Matthew Pickering committed
9 10

variables:
Ben Gamari's avatar
Ben Gamari committed
11
  CONTAINER_IMAGE_BASE: registry.gitlab.haskell.org/$CI_PROJECT_PATH
12 13
  # Disable use of overlay2 due to https://github.com/moby/moby/issues/39663
  #DOCKER_DRIVER: overlay2
14
  DOCKER_DRIVER: vfs
Ben Gamari's avatar
Ben Gamari committed
15
  DOCKER_TLS_CERTDIR: "/certs"
Matthew Pickering's avatar
Matthew Pickering committed
16

Matthew Pickering's avatar
Matthew Pickering committed
17
lint:
Ben Gamari's avatar
Ben Gamari committed
18
  stage: lint
Matthew Pickering's avatar
Matthew Pickering committed
19
  image: hadolint/hadolint:latest-debian
Ben Gamari's avatar
Ben Gamari committed
20 21
  tags:
    - x86_64-linux
Matthew Pickering's avatar
Matthew Pickering committed
22 23 24 25 26 27
  only:
    - merge_requests
    - master
  script:
    - find . -name "Dockerfile" -print0 | xargs -0 -n1 hadolint

Ben Gamari's avatar
Ben Gamari committed
28
.build:
Matthew Pickering's avatar
Matthew Pickering committed
29
  stage: build
30 31 32
  only:
   - master
   - merge_requests
Ben Gamari's avatar
Ben Gamari committed
33 34
  before_script:
    - docker info
Matthew Pickering's avatar
Matthew Pickering committed
35
  script:
Ben Gamari's avatar
Ben Gamari committed
36
    - |
Ben Gamari's avatar
Ben Gamari committed
37
      CONTAINER_IMAGE="$CONTAINER_IMAGE_BASE/$IMAGE"
Ben Gamari's avatar
Ben Gamari committed
38
      docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
Ben Gamari's avatar
Ben Gamari committed
39
      docker pull $CONTAINER_IMAGE:latest || true
Ben Gamari's avatar
Ben Gamari committed
40
      docker build --cache-from $CONTAINER_IMAGE:latest --tag $CONTAINER_IMAGE:$CI_COMMIT_SHA --tag $CONTAINER_IMAGE:latest $IMAGE
41 42 43 44
      if [ -z "$CI_MERGE_REQUEST_ID" ]; then
        docker push $CONTAINER_IMAGE:$CI_COMMIT_SHA
        docker push $CONTAINER_IMAGE:latest
      fi
Ben Gamari's avatar
Ben Gamari committed
45

Ben Gamari's avatar
Ben Gamari committed
46 47 48 49
build-linters:
  extends: .build
  variables:
    IMAGE: linters
Ben Gamari's avatar
Ben Gamari committed
50 51 52
  tags:
    - docker
    - x86_64-linux
Ben Gamari's avatar
Ben Gamari committed
53

Ben Gamari's avatar
Ben Gamari committed
54 55 56 57
build-aarch64-linux-deb9:
  extends: .build
  variables:
    IMAGE: aarch64-linux-deb9
58
  allow_failure: true
Ben Gamari's avatar
Ben Gamari committed
59 60 61
  tags:
    - docker
    - aarch64-linux
Ben Gamari's avatar
Ben Gamari committed
62

63 64 65 66 67 68 69 70 71
build-armv7-linux-deb9:
  extends: .build
  variables:
    IMAGE: armv7-linux-deb9
  allow_failure: true
  tags:
    - docker
    - armv7-linux

Ben Gamari's avatar
Ben Gamari committed
72 73 74 75
build-i386-linux-deb9:
  extends: .build
  variables:
    IMAGE: i386-linux-deb9
Ben Gamari's avatar
Ben Gamari committed
76 77 78
  tags:
    - docker
    - x86_64-linux
Ben Gamari's avatar
Ben Gamari committed
79 80 81 82 83

build-x86_64-freebsd:
  extends: .build
  variables:
    IMAGE: x86_64-freebsd
Ben Gamari's avatar
Ben Gamari committed
84 85 86
  tags:
    - docker
    - x86_64-linux
Ben Gamari's avatar
Ben Gamari committed
87 88 89 90 91

build-x86_64-linux-centos7:
  extends: .build
  variables:
    IMAGE: x86_64-linux-centos7
Ben Gamari's avatar
Ben Gamari committed
92 93 94
  tags:
    - docker
    - x86_64-linux
Ben Gamari's avatar
Ben Gamari committed
95

Ben Gamari's avatar
Ben Gamari committed
96 97 98 99 100 101 102 103
build-x86_64-linux-alpine:
  extends: .build
  variables:
    IMAGE: x86_64-linux-alpine
  tags:
    - docker
    - x86_64-linux

Ben Gamari's avatar
Ben Gamari committed
104 105 106 107
build-x86_64-linux-deb8:
  extends: .build
  variables:
    IMAGE: x86_64-linux-deb8
Ben Gamari's avatar
Ben Gamari committed
108 109 110
  tags:
    - docker
    - x86_64-linux
Ben Gamari's avatar
Ben Gamari committed
111 112 113 114 115

build-x86_64-linux-deb9:
  extends: .build
  variables:
    IMAGE: x86_64-linux-deb9
Ben Gamari's avatar
Ben Gamari committed
116 117 118
  tags:
    - docker
    - x86_64-linux
Matthew Pickering's avatar
Matthew Pickering committed
119

Ben Gamari's avatar
Ben Gamari committed
120 121 122 123 124 125 126 127
build-x86_64-linux-deb10:
  extends: .build
  variables:
    IMAGE: x86_64-linux-deb10
  tags:
    - docker
    - x86_64-linux

Ben Gamari's avatar
Ben Gamari committed
128 129 130 131
build-x86_64-linux-fedora27:
  extends: .build
  variables:
    IMAGE: x86_64-linux-fedora27
Ben Gamari's avatar
Ben Gamari committed
132 133 134
  tags:
    - docker
    - x86_64-linux
Peter Trommler's avatar
Peter Trommler committed
135 136 137 138 139 140

build-ppc64le-linux-opensuse151:
  extends: .build
  tags:
    - podman
    - ppc64le-linux