This repository was archived by the owner on Aug 13, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
107 lines (98 loc) · 3.08 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
107 lines (98 loc) · 3.08 KB
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
default:
image: maven:3-openjdk-8
# Cache downloaded dependencies and plugins between builds.
# The key here separates one cache per branch/tag ($CI_COMMIT_REF_SLUG)
cache:
key: "maven-$CI_COMMIT_REF_SLUG"
paths:
- .m2/repository
stages:
- build
- verify
- publish
variables:
MAVEN_OPTS: >-
-Dhttps.protocols=TLSv1.2
-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository
-Dorg.slf4j.simpleLogger.showDateTime=true
-Djava.awt.headless=true
MAVEN_ARGS: >-
--batch-mode
--errors
--fail-at-end
--no-transfer-progress
--show-version
--update-snapshots
-DdeployAtEnd=true
BUILD_TYPE:
description: "Select build type. While snapshot publishes artifacts to repository 'as is', release also bumps artifacts' version before and after they are published."
value: "snapshot"
options:
- "snapshot"
- "release"
RELEASE_PROPERTIES:
description: "Set release.properties for maven-release-plugin. Only used when BUILD_TYPE 'release' is selected."
value: |-
scm.tag=my-proj-1.2
project.rel.org.myCompany:projectA=1.2
project.dev.org.myCompany:projectA=1.3-SNAPSHOT
maven-install:
stage: build
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $BUILD_TYPE == 'snapshot'
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
script:
- mvn --settings $CI_MAVEN_SETTINGS $MAVEN_ARGS install
artifacts:
when: always
reports:
# Store JUnit reports (recursive pattern for multi-module projects)
junit:
- "**/target/*-reports/TEST-*.xml"
maven-verify-db-it:
stage: verify
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $BUILD_TYPE == 'snapshot'
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
services:
- name: docker:dind
command: [ "--tls=false" ]
parallel:
matrix:
- MAVEN_PROFILE: jpa
- MAVEN_PROFILE: hibernate3
- MAVEN_PROFILE: hibernate5
variables:
# Instruct Testcontainers to use the daemon of DinD.
DOCKER_HOST: "tcp://docker:2375"
# Instruct Docker not to start over TLS.
DOCKER_TLS_CERTDIR: ""
# Improve performance with overlays.
DOCKER_DRIVER: overlay2
script:
- cd discussment-db-it
- mvn --settings $CI_MAVEN_SETTINGS $MAVEN_ARGS -P$MAVEN_PROFILE verify
artifacts:
when: always
reports:
# Store JUnit reports (recursive pattern for multi-module projects)
junit:
- "**/target/*-reports/TEST-*.xml"
maven-deploy:
stage: publish
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $BUILD_TYPE == 'snapshot'
script:
- mvn --settings $CI_MAVEN_SETTINGS $MAVEN_ARGS -Dmaven.test.skip=true -Dmaven.install.skip=true deploy
maven-release:
stage: publish
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $BUILD_TYPE == 'release'
before_script:
- |
if [[ ! -z $RELEASE_PROPERTIES ]]; then
echo $RELEASE_PROPERTIES > release.properties
fi
script:
- mvn --settings $CI_MAVEN_SETTINGS $MAVEN_ARGS release:prepare -DdryRun
- mvn --settings $CI_MAVEN_SETTINGS $MAVEN_ARGS release:perform -DdryRun