-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.gitlab-ci.yml
111 lines (103 loc) · 2.91 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
image:
name: maven:3.9-eclipse-temurin-11
variables:
MAVEN_OPTS: "-Xmx1536m"
JAVA_TOOL_OPTIONS: "-Duser.language=fr -Duser.country=FR -Duser.timezone=Europe/Paris -Dfile.encoding=UTF-8"
stages:
- build
- verify
- dependencies
- deploy
- analyze
maven-build:
stage: build
environment: staging
script:
- "mvn spotless:check"
- "mvn -U -DskipTests clean package"
rules:
- if: $CHECK_DEPENDENCIES == "true"
when: never
- when: always
tags:
- docker
maven-verify:postgresql12:
stage: verify
script:
- mvn -U verify
artifacts:
when: always
paths:
- "**/target/surefire-reports/TEST-*.xml"
reports:
junit:
- "**/target/surefire-reports/TEST-*.xml"
tags:
- docker
services:
- name: postgres:12
alias: postgresql
variables:
POSTGRES_USER: igloo_test
POSTGRES_PASSWORD: igloo_test
TEST_DB_USER: igloo_test
TEST_DB_PASSWORD: igloo_test
TEST_DB_SCHEMA: public
TEST_DB_NAME: igloo_test
TEST_DB_TYPE: postgresql
TEST_DB_HOST: postgresql
TEST_DB_PORT: 5432
maven-dependencies:
stage: dependencies
environment: staging
script:
- "source gitlab-ci.build.conf"
- "./ci/maven-dependencies.sh"
rules:
- if: $CHECK_DEPENDENCIES == "true"
tags:
- docker
maven-deploy:
stage: deploy
environment: staging
script:
- "mvn -U deploy -DskipTests -DperformRelease -Ddistribution=igloo-release"
rules:
- if: $CHECK_DEPENDENCIES == "true"
when: never
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_COMMIT_BRANCH == "dev"
- if: $CI_COMMIT_BRANCH =~ /^ft-.*-deploy$/
- if: $CI_COMMIT_BRANCH =~ /^hf-.*$/
tags:
- docker
sonar-analyze:
stage: analyze
environment: staging
script:
# override sonar.projectKey / sonar.projectName for not-master not-main branches
- |
SONAR_OPTS=( "-Dsonar.host.url=https://sonar.tools.kobalt.fr" )
if [ "$CI_COMMIT_REF_NAME" != "master" -a "$CI_COMMIT_REF_NAME" != "main" ]; then
PROJECT_NAME="$( mvn -q help:evaluate -DforceStdout -Dexpression=project.name )"
PROJECT_ARTIFACT_ID="$( mvn -q help:evaluate -DforceStdout -Dexpression=project.artifactId )"
PROJECT_GROUP_ID="$( mvn -q help:evaluate -DforceStdout -Dexpression=project.groupId )"
SONAR_OPTS+=("-Dsonar.projectKey=$PROJECT_GROUP_ID:$PROJECT_ARTIFACT_ID:$CI_COMMIT_REF_NAME")
SONAR_OPTS+=("-Dsonar.projectName=$PROJECT_NAME ($CI_COMMIT_REF_NAME)")
fi
- mvn -U clean verify sonar:sonar
-DskipTests
-Dsonar.qualitygate.wait=true
"${SONAR_OPTS[@]}"
rules:
- if: $CHECK_DEPENDENCIES == "true"
when: never
- if: $CI_COMMIT_BRANCH == "dev"
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_COMMIT_BRANCH =~ "main"
- if: $CI_COMMIT_BRANCH =~ "igloo-boot"
- if: $CI_COMMIT_BRANCH =~ "igloo-boot-dev"
- if: $CI_COMMIT_BRANCH =~ /^hf-.*$/
allow_failure: true
tags:
- docker