-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
68 lines (62 loc) · 1.81 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
stages:
- build
- test
- containerize
- release
variables:
# Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: "/certs"
GRADLE_USER_HOME: "$CI_PROJECT_DIR/.cache/.gradle"
cache:
paths:
- .cache/.gradle
build4dockerImage:
stage: build
image: registry.gitlab.com/coverified/infrastructure/scala-base:latest
script:
- ./gradlew shadowJar
- ./gradlew projectProperties
artifacts:
reports:
dotenv: build/build.env
paths:
- build/libs/
expire_in: 1 day
test:
stage: test
image: registry.gitlab.com/coverified/infrastructure/scala-base:latest
script:
- ./gradlew reportScoverage checkScoverage
artifacts:
reports:
junit: build/reports/tests/xml/*.xml
cobertura: build/reports/scoverage/cobertura.xml
dependencies: []
buildDockerImage:
stage: containerize
image: docker:20
services:
- docker:20-dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build --pull -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --build-arg PROJECT_NAME --build-arg PROJECT_VERSION --build-arg MAIN_CLASS --build-arg SENTRY_RELEASE=$CI_COMMIT_SHA .
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
- docker push --all-tags $CI_REGISTRY_IMAGE
needs:
- test
- build4dockerImage
cache: {}
release-image:
stage: release
image: docker:20
services:
- docker:20-dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
- docker push --all-tags $CI_REGISTRY_IMAGE
only:
- main
cache: {}