-
Notifications
You must be signed in to change notification settings - Fork 9
/
.gitlab-ci.yml
60 lines (55 loc) · 1.31 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
variables:
MVN_ENV_OPTS: '-Xms64m -Xmx512m -Dmaven.repo.local=.mvn/repository'
MVN_BUILD_OPTS: '-B -Dfrontend-build -Ddocker-build'
MVN_GOALS: 'clean verify'
DOCKER_USERNAME: toComplete
DOCKER_PASSWORD: toComplete
DOCKER_REPO: fcrespel
DOCKER_IMAGE: karaplan
services:
- docker:dind
stages:
- build
- test
- publish
build:
stage: build
image: eclipse-temurin:17-jdk
cache:
key: ${CI_PROJECT_PATH_SLUG}
paths:
- .mvn/repository
variables:
MAVEN_OPTS: ${MVN_ENV_OPTS}
script:
- ./mvnw ${MVN_BUILD_OPTS} ${MVN_GOALS} -DskipTests
artifacts:
paths:
- target
expire_in: 1h
test:
stage: test
image: eclipse-temurin:17-jdk
dependencies:
- build
cache:
key: ${CI_PROJECT_PATH_SLUG}
paths:
- .mvn/repository
variables:
MAVEN_OPTS: ${MVN_ENV_OPTS}
script:
- ./mvnw ${MVN_BUILD_OPTS} test
artifacts:
reports:
junit: target/surefire-reports/*.xml
publish:
stage: publish
image: docker
dependencies:
- build
before_script:
- docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}
script:
- docker build -t ${DOCKER_REPO}/${DOCKER_IMAGE}:${CI_COMMIT_REF_SLUG} target/docker-build
- docker push ${DOCKER_REPO}/${DOCKER_IMAGE}:${CI_COMMIT_REF_SLUG}