.gitlab-ci.yml 2.36 KB
Newer Older
Ben Gamari's avatar
Ben Gamari committed
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:
Ben Gamari's avatar
Ben Gamari committed
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
Matthew Pickering's avatar
Matthew Pickering committed
12
  DOCKER_DRIVER: overlay2
Ben Gamari's avatar
Ben Gamari committed
13
  DOCKER_TLS_CERTDIR: "/certs"
Matthew Pickering's avatar
Matthew Pickering committed
14

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

Ben Gamari's avatar
Ben Gamari committed
26
.build:
Matthew Pickering's avatar
Matthew Pickering committed
27
  stage: build
28 29 30
  only:
   - master
   - merge_requests
Ben Gamari's avatar
Ben Gamari committed
31 32
  before_script:
    - docker info
Matthew Pickering's avatar
Matthew Pickering committed
33
  script:
Ben Gamari's avatar
Ben Gamari committed
34
    - |
Ben Gamari's avatar
Ben Gamari committed
35
      CONTAINER_IMAGE="$CONTAINER_IMAGE_BASE/$IMAGE"
Ben Gamari's avatar
Ben Gamari committed
36
      docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
Ben Gamari's avatar
Ben Gamari committed
37
      docker pull $CONTAINER_IMAGE:latest || true
Ben Gamari's avatar
Ben Gamari committed
38
      docker build --cache-from $CONTAINER_IMAGE:latest --tag $CONTAINER_IMAGE:$CI_COMMIT_SHA --tag $CONTAINER_IMAGE:latest $IMAGE
39 40 41 42
      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
43

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

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

61 62 63 64 65 66 67 68 69
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
70 71 72 73
build-i386-linux-deb8:
  extends: .build
  variables:
    IMAGE: i386-linux-deb8
Ben Gamari's avatar
Ben Gamari committed
74 75 76
  tags:
    - docker
    - x86_64-linux
Ben Gamari's avatar
Ben Gamari committed
77 78 79 80 81

build-i386-linux-deb9:
  extends: .build
  variables:
    IMAGE: i386-linux-deb9
Ben Gamari's avatar
Ben Gamari committed
82 83 84
  tags:
    - docker
    - x86_64-linux
Ben Gamari's avatar
Ben Gamari committed
85 86 87 88 89

build-x86_64-freebsd:
  extends: .build
  variables:
    IMAGE: x86_64-freebsd
Ben Gamari's avatar
Ben Gamari committed
90 91 92
  tags:
    - docker
    - x86_64-linux
Ben Gamari's avatar
Ben Gamari committed
93 94 95 96 97

build-x86_64-linux-centos7:
  extends: .build
  variables:
    IMAGE: x86_64-linux-centos7
Ben Gamari's avatar
Ben Gamari committed
98 99 100
  tags:
    - docker
    - x86_64-linux
Ben Gamari's avatar
Ben Gamari committed
101

Ben Gamari's avatar
Ben Gamari committed
102 103 104 105 106 107 108 109
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
110 111 112 113
build-x86_64-linux-deb8:
  extends: .build
  variables:
    IMAGE: x86_64-linux-deb8
Ben Gamari's avatar
Ben Gamari committed
114 115 116
  tags:
    - docker
    - x86_64-linux
Ben Gamari's avatar
Ben Gamari committed
117 118 119 120 121

build-x86_64-linux-deb9:
  extends: .build
  variables:
    IMAGE: x86_64-linux-deb9
Ben Gamari's avatar
Ben Gamari committed
122 123 124
  tags:
    - docker
    - x86_64-linux
Matthew Pickering's avatar
Matthew Pickering committed
125

Ben Gamari's avatar
Ben Gamari committed
126 127 128 129
build-x86_64-linux-fedora27:
  extends: .build
  variables:
    IMAGE: x86_64-linux-fedora27
Ben Gamari's avatar
Ben Gamari committed
130 131 132
  tags:
    - docker
    - x86_64-linux