.gitlab-ci.yml 1.6 KB
Newer Older
Sebastian Schüpbach's avatar
Sebastian Schüpbach committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
stages:
  - test
  - build
  - publish

default:
  image: hseeberger/scala-sbt:8u252_1.3.10_2.12.11

variables:
  SBT_OPTS: "-Dsbt.global.base=sbt-cache/sbtboot -Dsbt.boot.directory=sbt-cache/boot -Dsbt.ivy.home=sbt-cache/ivy"
  DOCKER_TLS_CERTDIR: ""

cache:
  key: "$CI_BUILD_REF_NAME"
  paths:
    - "sbt-cache/ivy/cache"
    - "sbt-cache/boot"
    - "sbt-cache/sbtboot"
    - "sbt-cache/target"


test:
  stage: test
Sebastian Schüpbach's avatar
Sebastian Schüpbach committed
24
  tags: [mbr]
Sebastian Schüpbach's avatar
Sebastian Schüpbach committed
25
26
27
28
29
30
  script:
    - sbt test


assembly:
  stage: build
Sebastian Schüpbach's avatar
Sebastian Schüpbach committed
31
  tags: [mbr]
Sebastian Schüpbach's avatar
Sebastian Schüpbach committed
32
33
34
35
36
  script:
    - sbt assembly
  artifacts:
    paths:
      - target/scala-2.12/app.jar
37
    expire_in: 60 min
Sebastian Schüpbach's avatar
Sebastian Schüpbach committed
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82


.build-image:
  stage: publish
  image: docker:stable
  services:
    - docker:dind
  script:
    - docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASSWORD" "$REGISTRY"
    - docker build --pull -t "$IMAGE_TAG" .
    - docker push "$IMAGE_TAG"
    - docker logout
  cache:
    paths: []

tagged-image:
  extends: .build-image
  variables:
    IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"
    REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
    REGISTRY_USER: "$CI_REGISTRY_USER"
    REGISTRY: "$CI_REGISTRY"
  only:
    - tags

master-branch-image:
  extends: .build-image
  variables:
    IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest"
    REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
    REGISTRY_USER: "$CI_REGISTRY_USER"
    REGISTRY: "$CI_REGISTRY"
  only:
    - master

feature-branch-image:
  extends: .build-image
  variables:
    IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
    REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
    REGISTRY_USER: "$CI_REGISTRY_USER"
    REGISTRY: "$CI_REGISTRY"
  except:
    - master
    - tags