-
Notifications
You must be signed in to change notification settings - Fork 6
/
.gitlab-ci.yml
105 lines (92 loc) · 2.5 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
# Stages (ie phases) that can be used by jobs
stages:
- init
- build
- test
- plan
- deploy
- cleanup
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_REF_PROTECTED == "true"
include:
- project: infrastructure/devops/aop-addons-ci
file:
- /templates/AOP-Addons/Default.yml
ref: main
rules:
- if: '$CI_PIPELINE_SOURCE != "schedule" && $CI_COMMIT_BRANCH !~ /^\d+\.\d+$/ && $CI_COMMIT_TAG == null'
.global-env:
image: axelor/app-builder:6.1
variables:
GIT_SUBMODULE_STRATEGY: recursive
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
# Add wrapper and caches folders in cache
.global_cache: &global_cache
paths:
- .gradle
- build
policy: pull-push
.global_cache_pull: &global_cache_pull
<<: *global_cache
policy: pull
# Build artifacts
build:
extends: .global-env
stage: build
cache:
- *global_cache
allow_failure: false
script:
- ./gradlew -xtest -xspotlessApply -xlicenseFormat clean build
interruptible: true
rules:
- if: '$CI_PIPELINE_SOURCE != "schedule" && ($CI_COMMIT_BRANCH =~ /^\d+\.\d+$/ || $CI_COMMIT_TAG)'
# Check code formatting
spotless:
extends: .global-env
stage: test
cache:
- *global_cache_pull
allow_failure: true
script:
- ./gradlew spotlessCheck
interruptible: true
rules:
- if: '$CI_PIPELINE_SOURCE != "schedule"'
.publish_template: &publish_configuration
extends: .global-env
stage: plan
cache:
- *global_cache_pull
script:
- ./gradlew -xtest -xspotlessApply -xlicenseFormat clean build publish -PaddonsMavenUsername=${NEXUS_ADDONS_DEPLOYMENT_USER} -PaddonsMavenPassword=${NEXUS_ADDONS_DEPLOYMENT_PASSWORD} -P${PUBLISH_TYPE}
publish snapshot:
<<: *publish_configuration
variables:
PUBLISH_TYPE: "snapshotRelease"
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
publish release:
<<: *publish_configuration
variables:
PUBLISH_TYPE: "finalRelease"
rules:
- if: '$CI_COMMIT_TAG'
create release:
stage: plan
image: registry.gitlab.com/gitlab-org/release-cli:latest
cache:
- *global_cache_pull
allow_failure: true
rules:
- if: '$CI_COMMIT_TAG'
script:
- echo "create release for $CI_COMMIT_TAG"
- |
RELEASE_DESCRIPTION=$(sed -n "/^## ${CI_COMMIT_TAG}/,/^## /p" CHANGELOG.md | sed '$d;$d')
release-cli create --name "$CI_COMMIT_TAG" --description "$RELEASE_DESCRIPTION" --tag-name "$CI_COMMIT_TAG" --ref "$CI_COMMIT_TAG"