-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
178 lines (163 loc) · 4.73 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
---
image: d.i-run.fr/irun-compiler:jdk11-20210420.ec649080
variables:
# CHAT_WEBHOOK_URL: Must exists in group variables or projet variables
# GIT_SUBMODULE_STRATEGY: normal
# As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used
# when running from the command line.
# `installAtEnd` and `deployAtEnd` are only effective with recent version of the corresponding plugins.
MAVEN_CLI_OPTS:
"--batch-mode -Dmaven.repo.local=${CI_PROJECT_DIR}/.m2/repository
--errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
GIT_SSH_COMMAND: "ssh -i ${CI_PROJECT_DIR}/git_ssh_private_key"
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- ${CI_PROJECT_DIR}/.m2/repository/
stages:
- build
- test
- release
- deploy
- notify
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- when: always
before_script:
- cat "${GIT_SSH_PRIVATE_KEY}" > "${CI_PROJECT_DIR}/git_ssh_private_key"
- chmod 600 "${CI_PROJECT_DIR}/git_ssh_private_key"
shell-check:
stage: test
script:
- shellcheck .gitlab/*.sh
- |
[[ ! -d .gitlab/scripts ]] || shellcheck .gitlab/scripts/*.sh
maven:build:
stage: build
script:
- find "${CI_PROJECT_DIR}/.m2/repository" -type f -name "*SNAPSHOT*" -delete || true
- .gitlab/install-deps.sh -c $CI_COMMIT_REF_NAME
- mvn ${MAVEN_CLI_OPTS} clean install -DskipTests
artifacts:
when: on_success
expire_in: 1 hour
untracked: true
🖍maven:checkstyle:
stage: test
needs:
- job: maven:build
artifacts: true
cache:
policy: pull
script:
- mvn ${MAVEN_CLI_OPTS} install checkstyle:check -DskipTests
📚maven:javadoc:
stage: test
needs:
- job: maven:build
artifacts: true
cache:
policy: pull
script:
- mvn ${MAVEN_CLI_OPTS} javadoc:javadoc
maven:test:
stage: test
needs:
- job: maven:build
artifacts: true
script: mvn ${MAVEN_CLI_OPTS} test -Pintegration
artifacts:
reports:
junit: [
testy-beat-box/target/surefire-reports/TEST-*.xml,
testy-core-box/target/surefire-reports/TEST-*.xml,
testy-jooq-box/target/surefire-reports/TEST-*.xml,
testy-mongo-box/target/surefire-reports/TEST-*.xml
]
🖍yaml:lint:
stage: test
image: d.i-run.fr/irun-python-tester:20210526.d703e66a
script:
- yamllint --strict .
maven:release:
stage: release
variables:
PIPELINE_NOTIFY_SUCCESS: "true"
needs:
- job: maven:build
artifacts: true
script:
- echo ${GPG_PASSPHRASE} | gpg --batch --import "${GPG_SECRET_KEY}"
- git checkout -B "$CI_COMMIT_REF_NAME"
- mvn -DdryRun=true versions:update-properties
- mvn ${MAVEN_CLI_OPTS} -DdryRun=true release:prepare \
-DtagNameFormat="@{version}" \
-DupdateDependencies=false \
-DscmCommentPrefix="[maven-release][skip CI] " \
-DdevelopmentVersion="$(.gitlab/bumpVersion.sh)" \
- git clean -f
- mvn versions:update-properties
- git commit -a -m "[maven-release][skip CI] Update properties version"
- git clean -f
- |
mvn ${MAVEN_CLI_OPTS} \
release:prepare \
-DtagNameFormat="@{version}" \
-DupdateDependencies=false \
-DscmCommentPrefix="[maven-release][skip CI] " \
-DdevelopmentVersion="$(.gitlab/bumpVersion.sh)" \
release:perform \
-Darguments="-DskipTests=true"
- git clone "[email protected]:${CI_PROJECT_PATH}.git"
- cd "${CI_PROJECT_NAME}"
- git checkout master
- |
git merge --no-ff \
-m "[maven-release][skip CI] Merge release in master" origin/develop~1
- git push origin master
rules:
- if: >
$CI_COMMIT_REF_NAME == "develop"
|| $CI_COMMIT_REF_NAME =~ /^support/
when: manual
allow_failure: true
maven:sonar:
stage: deploy
needs:
- job: maven:build
artifacts: true
allow_failure: true
cache:
policy: pull
script:
- mvn ${MAVEN_CLI_OPTS} test sonar:sonar -Psonar ${SONAR_CONFIG}
rules:
- if: '$CI_COMMIT_REF_NAME == "develop"'
when: always
maven:deploy-snapshot:
stage: deploy
needs:
- job: maven:build
artifacts: true
- job: maven:test
artifacts: true
script: |
mvn ${MAVEN_CLI_OPTS} deploy \
-DskipTests \
-DaltDeploymentRepository="nexus::default::https://nexus.i-run.fr/repository/snapshots/" \
-DaltSnapshotDeploymentRepository="nexus" \
-DaltReleaseDeploymentRepository="ossrh"
rules:
- if: >
$CI_COMMIT_REF_NAME == "develop"
when: always
⚙trigger:unchained:
stage: notify
trigger:
project: nora/rocket/unchained
branch: develop
rules:
- if: '$CI_COMMIT_REF_NAME == "develop"'
when: on_success