.gitlab-ci.yml 2.03 KB
Newer Older
Matthew Pickering's avatar
Matthew Pickering committed
1 2 3 4 5 6
image: docker:stable

services:
  - docker:dind

variables:
Ben Gamari's avatar
Ben Gamari committed
7
  CONTAINER_IMAGE_BASE: registry.gitlab.haskell.org/$CI_PROJECT_PATH
Matthew Pickering's avatar
Matthew Pickering committed
8 9 10
  DOCKER_HOST: tcp://docker:2375
  DOCKER_DRIVER: overlay2

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

Ben Gamari's avatar
Ben Gamari committed
22
.build:
Matthew Pickering's avatar
Matthew Pickering committed
23
  stage: build
24 25 26
  only:
   - master
   - merge_requests
Matthew Pickering's avatar
Matthew Pickering committed
27
  script:
Ben Gamari's avatar
Ben Gamari committed
28
    - |
Ben Gamari's avatar
Ben Gamari committed
29
      CONTAINER_IMAGE="$CONTAINER_IMAGE_BASE/$IMAGE"
Ben Gamari's avatar
Ben Gamari committed
30
      docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.haskell.org
Ben Gamari's avatar
Ben Gamari committed
31
      docker pull $CONTAINER_IMAGE:latest || true
Ben Gamari's avatar
Ben Gamari committed
32
      docker build --cache-from $CONTAINER_IMAGE:latest --tag $CONTAINER_IMAGE:$CI_COMMIT_SHA --tag $CONTAINER_IMAGE:latest $IMAGE
33 34 35 36
      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
37

Ben Gamari's avatar
Ben Gamari committed
38 39 40 41
build-linters:
  extends: .build
  variables:
    IMAGE: linters
Ben Gamari's avatar
Ben Gamari committed
42 43 44
  tags:
    - docker
    - x86_64-linux
Ben Gamari's avatar
Ben Gamari committed
45

Ben Gamari's avatar
Ben Gamari committed
46 47 48 49
build-aarch64-linux-deb9:
  extends: .build
  variables:
    IMAGE: aarch64-linux-deb9
50
  allow_failure: true
Ben Gamari's avatar
Ben Gamari committed
51 52 53
  tags:
    - docker
    - aarch64-linux
Ben Gamari's avatar
Ben Gamari committed
54 55 56 57 58

build-i386-linux-deb8:
  extends: .build
  variables:
    IMAGE: i386-linux-deb8
Ben Gamari's avatar
Ben Gamari committed
59 60 61
  tags:
    - docker
    - x86_64-linux
Ben Gamari's avatar
Ben Gamari committed
62 63 64 65 66

build-i386-linux-deb9:
  extends: .build
  variables:
    IMAGE: i386-linux-deb9
Ben Gamari's avatar
Ben Gamari committed
67 68 69
  tags:
    - docker
    - x86_64-linux
Ben Gamari's avatar
Ben Gamari committed
70 71 72 73 74

build-x86_64-freebsd:
  extends: .build
  variables:
    IMAGE: x86_64-freebsd
Ben Gamari's avatar
Ben Gamari committed
75 76 77
  tags:
    - docker
    - x86_64-linux
Ben Gamari's avatar
Ben Gamari committed
78 79 80 81 82

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

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

build-x86_64-linux-deb9:
  extends: .build
  variables:
    IMAGE: x86_64-linux-deb9
Ben Gamari's avatar
Ben Gamari committed
99 100 101
  tags:
    - docker
    - x86_64-linux
Matthew Pickering's avatar
Matthew Pickering committed
102

Ben Gamari's avatar
Ben Gamari committed
103 104 105 106
build-x86_64-linux-fedora27:
  extends: .build
  variables:
    IMAGE: x86_64-linux-fedora27
Ben Gamari's avatar
Ben Gamari committed
107 108 109
  tags:
    - docker
    - x86_64-linux