forked from senbox-org/snap-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
122 lines (110 loc) · 3.43 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
# included templates
include:
# Maven template
- project: "to-be-continuous/maven"
ref: "3.7.1"
file: "templates/gitlab-ci-maven.yml"
# 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"
MVN_SEMREL_RELEASE_DISABLED: "true"
MAVEN_SETTINGS_FILE: $MVN_SETTINGS_FILE
SONAR_BASE_ARGS: sonar:sonar -Dsonar.projectKey=$CI_PROJECT_NAME
# your pipeline stages
stages:
- build
- test
- package-build
- package-test
- infra
- deploy
- acceptance
- publish
- infra-prod
- production
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"'
allow_failure: false
needs: []
script:
- mvn clean package
macos:
stage: test
tags: [mac]
rules:
- if: '$BUILD_FOR_INSTALLER == "false"'
variables:
JAVA_HOME: /Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home
TESTDATA_ROOT: "/Users/otb/testData"
allow_failure: true
needs: []
script:
- mvn -q 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