-
Notifications
You must be signed in to change notification settings - Fork 98
/
.gitlab-ci.yml
140 lines (129 loc) · 4.34 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
# included templates
include:
# Maven template
- project: "to-be-continuous/maven"
ref: "3.11.1"
file: "templates/gitlab-ci-maven.yml"
stages:
- build
- test
- package-build
- package-test
- infra
- deploy
- acceptance
- publish
- infra-prod
- production
# secret variables
# (define the variables below in your GitLab group/project variables)
# SONAR_TOKEN: SonarQube authentication [token](https://docs.sonarqube.org/latest/user-guide/user-token/) (depends on your authentication method)
# SONAR_LOGIN: SonarQube login (depends on your authentication method)
# SONAR_PASSWORD: SonarQube password (depends on your authentication method)
# MVN_SETTINGS_FILE: File variable at Group level. It is the Maven settings.xml file
# variables
variables:
MAVEN_IMAGE: "ghcr.io/carlossg/maven:3.9.2-azulzulu-11"
MVN_FORBID_SNAPSHOT_DEPENDENCIES_DISABLED: "true"
MAVEN_DEPLOY_SNAPSHOT_WITH_SLUG_ENABLED: "false"
BUILD_FOR_INSTALLER: "false"
MAVEN_DEPLOY_ENABLED: "true"
MAVEN_DEPLOY_ARGS: "deploy"
MVN_SEMREL_RELEASE_DISABLED: "true"
MAVEN_SETTINGS_FILE: $MVN_SETTINGS_FILE
SONAR_BASE_ARGS: |
sonar:sonar -Dsonar.projectKey=${CI_PROJECT_NAME}
-Dsonar.exclusions=${CI_PROJECT_NAME}-coverage
-Dsonar.coverage.jacoco.xmlReportPaths=${CI_PROJECT_NAME}-coverage/target/site/jacoco-aggregate/jacoco.xml
MAVEN_OPTS: >-
-Dhttps.protocols=TLSv1.2
-Dmaven.repo.local=${MAVEN_CFG_DIR}/repository
-Dorg.slf4j.simpleLogger.showDateTime=true
-Djava.awt.headless=true
-Dnetbeans.verify.integrity=false
-Denable.long.tests=true
RELEASE_REF: '/^v?[0-9]+\.[0-9]+\.[0-9]+(-RC[0-9]+)?$/'
mvn-build:
artifacts:
paths:
- "${MAVEN_PROJECT_DIR}/**/target/*.jar"
- "${MAVEN_PROJECT_DIR}/**/target/classes"
- "${MAVEN_PROJECT_DIR}/**/target/*.nbm"
#- "${MAVEN_PROJECT_DIR}/**/target/site/jacoco/jacoco.csv"
- "${MAVEN_PROJECT_DIR}/**/target/site"
- "${MAVEN_PROJECT_DIR}/**/target/surefire-reports"
- "${MAVEN_PROJECT_DIR}/etc"
- "${MAVEN_PROJECT_DIR}/LICENSE.html"
mvn-sonar:
image: "registry.hub.docker.com/library/maven:3.9.1-eclipse-temurin-11"
allow_failure: true
rules:
- if: '$BUILD_FOR_INSTALLER == "false"'
# Used to publish release on Github (only manual action & non blocking)
mvn-release:
rules:
- when: manual
allow_failure: true
windows:
stage: test
tags: [windows]
rules:
- if: '$BUILD_FOR_INSTALLER == "false"'
variables:
GIT_STRATEGY: clone
FF_ENABLE_JOB_CLEANUP: 'true'
FF_USE_WINDOWS_LEGACY_PROCESS_STRATEGY: 'false'
MAVEN_CFG_DIR: C:\\Windows\\System32\\config\\systemprofile\\.m2
JAVA_HOME: C:\\Program Files\\Zulu\\zulu-11
allow_failure: false
needs: []
script:
- mvn clean package
macos:
stage: test
tags: [mac]
image: "registry.hub.docker.com/library/maven:3.9.1-eclipse-temurin-11"
rules:
- if: '$BUILD_FOR_INSTALLER == "false"'
variables:
# JAVA_HOME: /Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home
# JAVA_HOME: /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home
JAVA_HOME: /Library/Java/JavaVirtualMachines/liberica-jdk-11-full.jdk/Contents/Home
TESTDATA_ROOT: "/Users/csro/testData"
needs: []
script:
- mvn clean package
# Report on Github cf https://ecp-ci.gitlab.io/docs/guides/build-status-gitlab.html
.report-status:
image: curlimages/curl
variables:
URL: "https://api.github.com/repos/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}/statuses/${CI_COMMIT_SHA}"
STATUS_NAME: snap-ci
script:
# For complete details on the GitHub API please see:
# https://docs.github.com/en/rest/commits/statuses?apiVersion=2022-11-28#create-a-commit-status
- |-
curl -X POST $URL -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" -d '{"state": "'$CI_JOB_NAME'", "context": "'$STATUS_NAME'", "target_url": "'$CI_PIPELINE_URL'", "description": "The build status"}'
environment:
name: reporting-github
dependencies: []
pending:
stage: .pre
extends:
- .report-status
rules:
- if: '$BUILD_FOR_INSTALLER == "false"'
success:
stage: .post
extends:
- .report-status
rules:
- if: '$BUILD_FOR_INSTALLER == "false"'
when: on_success
failure:
stage: .post
extends:
- .report-status
rules:
- if: '$BUILD_FOR_INSTALLER == "false"'
when: on_failure