-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
119 lines (108 loc) · 3.09 KB
/
.gitlab-ci.yml
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
services:
- name: mongo:latest
alias: mongo
- name: rabbitmq:management
alias: rabbitmq
stages:
- test
- build
- publish
- release
variables:
SBT_OPTS: "-Dsbt.global.base=sbt-cache/.sbtboot -Dsbt.boot.directory=sbt-cache/.boot -Dsbt.ivy.home=sbt-cache/.ivy"
MONGO_INITDB_ROOT_USERNAME: doclib
MONGO_INITDB_ROOT_PASSWORD: doclib
RABBITMQ_DEFAULT_USER: doclib
RABBITMQ_DEFAULT_PASS: doclib
RABBITMQ_DEFAULT_VHOST: doclib
MONGO_PORT: 27017
RABBITMQ_PORT: 5672
cache:
key: "${CI_COMMIT_REF_SLUG}"
untracked: false
paths:
- "sbt-cache/.ivy/cache"
- "sbt-cache/.boot"
- "sbt-cache/.sbtboot"
- "sbt-cache/target"
default:
image: registry.gitlab.com/medicines-discovery-catapult/informatics/docker-images/ci/sbt:latest
test:
stage: test
variables:
MONGO_HOST: mongo
RABBITMQ_HOST: rabbitmq
script:
- sleep 5
- curl http://guest:guest@rabbitmq:15672/api/overview
- sbt clean coverage test it/test coverageReport
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
paths:
- target/scala-2.13/scoverage-report/
except:
variables:
- $CI_COMMIT_MESSAGE =~ /^Setting version to.*/
assemble:
stage: build
script:
- sbt assembly
- curl https://repo1.maven.org/maven2/io/netty/netty-all/4.1.49.Final/netty-all-4.1.49.Final.jar -o target/netty.jar
artifacts:
paths:
- target/scala-2.13/consumer.jar
- target/netty.jar
except:
variables:
- $CI_COMMIT_MESSAGE =~ /^Setting version to.*/
publish:
stage: publish
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
before_script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
script:
- /kaniko/executor --context $CI_PROJECT_DIR --build-arg VERSION_HASH=$CI_COMMIT_SHORT_SHA --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
except:
refs:
- main
variables:
- $CI_COMMIT_MESSAGE =~ /^Setting version to.*/
release:
stage: release
script:
- cictl exec release sbt
only:
- main
except:
variables:
- $CI_COMMIT_MESSAGE =~ /^Setting version to.*/
assemble-main:
stage: build
script:
- sbt assembly
- curl https://repo1.maven.org/maven2/io/netty/netty-all/4.1.49.Final/netty-all-4.1.49.Final.jar -o target/netty.jar
artifacts:
paths:
- target/scala-2.13/consumer.jar
- target/netty.jar
only:
refs:
- tags
variables:
- $CI_COMMIT_MESSAGE =~ /^Setting version to.*/
publish-main:
stage: publish
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
before_script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
script:
- /kaniko/executor --context $CI_PROJECT_DIR --build-arg VERSION_HASH=$CI_COMMIT_SHORT_SHA --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME --destination $CI_REGISTRY_IMAGE
only:
refs:
- tags
variables:
- $CI_COMMIT_MESSAGE =~ /^Setting version to.*/