-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
178 lines (165 loc) · 4.28 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
variables:
GIT_SUBMODULE_STRATEGY: recursive
CACHE_KEY: "$CI_COMMIT_REF_NAME $CI_COMMIT_SHA"
ORIG_ARTIFACTS1: "$CI_PROJECT_DIR/**/build/libs/*.jar*"
ORIG_ARTIFACTS2: "$CI_PROJECT_DIR/**/build/distributions/*.zip*"
ARTIFACTS1: "$CI_PROJECT_DIR/*.jar*"
ARTIFACTS2: "$CI_PROJECT_DIR/*.zip*"
TEST_REPORTS: "$CI_PROJECT_DIR/*-TestReport.zip"
TEST_DATA: "$CI_PROJECT_DIR/**/build/test-results/*/TEST-*.xml"
JACOCO_DATA: "$CI_PROJECT_DIR/**/build/jacoco/*"
TRANSLATION_REPORTS: "$CI_PROJECT_DIR/**/*.lang.txt"
COVERAGE_REPORTS: "$CI_PROJECT_DIR/*-CoverageReport.zip"
SPOTBUGS_REPORTS: "$CI_PROJECT_DIR/*-SpotbugsReport.zip"
JAVADOCS: "$CI_PROJECT_DIR/*-javadoc.jar"
GRADLE_OPTS: >
-Dorg.gradle.project.branchName="$CI_COMMIT_REF_NAME"
cache:
policy: pull
key: "$CACHE_KEY"
untracked: true
before_script:
- shopt -s globstar
- shopt -s nullglob
stages:
- build
- test
- report
- deploy
build:
stage: build
cache:
policy: push
key: "$CACHE_KEY"
untracked: true
script:
- ./gradlew --console=plain assemble compileTest
- cp $ORIG_ARTIFACTS1 $ORIG_ARTIFACTS2 .
retry: 2
when: on_success
artifacts:
paths:
- $ARTIFACTS1
- $ARTIFACTS2
test:
stage: test
cache:
policy: pull-push
key: "$CACHE_KEY"
untracked: true
needs:
- job: build
artifacts: false
script:
- ./gradlew --continue --console=plain test
retry: 2
when: on_success
artifacts:
when: always
paths:
- $TEST_REPORTS
- $JACOCO_DATA
reports:
junit:
- $TEST_DATA
checkFormatting:
stage: test
needs: []
script:
- ./gradlew --continue --console=plain spotlessCheck
allow_failure: true
when: on_success
checkTranslations:
stage: test
needs: []
script:
- ./gradlew --continue --console=plain checkTranslations
allow_failure: true
when: on_success
artifacts:
when: on_failure
paths:
- $TRANSLATION_REPORTS
coverage:
stage: report
needs:
- job: test
artifacts: true
script:
- ./gradlew --continue --console=plain -x test coverage
coverage: "/Covered (\\d{1,3}\\.\\d{2}%) of instructions for all projects\\./"
allow_failure: true
when: on_success
artifacts:
when: always
paths:
- $COVERAGE_REPORTS
spotbugs:
stage: report
needs:
- job: build
artifacts: false
script:
- ./gradlew --continue --console=plain spotbugs
allow_failure: true
when: on_success
artifacts:
when: always
paths:
- $SPOTBUGS_REPORTS
deploySnapshot:
stage: deploy
needs:
- job: build
artifacts: true
script:
- ./gradlew --console=plain uploadArchives $(echo "$CI_COMMIT_MESSAGE" | grep -qF "[release]" && echo releaseSnapshot)
retry: 2
when: always
except:
- tags
deploy:
stage: deploy
needs:
- job: build
artifacts: true
script:
- ./gradlew --console=plain release
retry: 2
when: always
only:
- tags
sendCoverage:
stage: deploy
needs:
- job: coverage
artifacts: true
script:
- ./gradlew --console=plain sendCoverageToCodacy
retry: 2
when: on_success
pages:
stage: deploy
needs:
- job: build
artifacts: true
- job: test
artifacts: true
- job: checkTranslations
artifacts: true
- job: coverage
artifacts: true
- job: spotbugs
artifacts: true
script:
- for file in $JAVADOCS; do dir="public/javadoc/$(basename "$file" | cut -d. -f1 | rev | cut -d- -f1 --complement | rev)"; mkdir -p "$dir"; unzip "$file" -d "$dir"; done
- for file in $TEST_REPORTS; do dir="public/test/$(basename "$file" | rev | cut -d- -f1 --complement | rev)"; mkdir -p "$dir"; unzip "$file" -d "$dir"; done
- for file in $TRANSLATION_REPORTS; do dir="public/checkTranslations/$(basename "$(dirname "$file")")"; mkdir -p "$dir"; cp "$file" "$dir"; done
- for file in $COVERAGE_REPORTS; do dir="public/coverage/$(basename "$file" | rev | cut -d- -f1 --complement | rev)"; mkdir -p "$dir"; unzip "$file" -d "$dir"; done
- for file in $SPOTBUGS_REPORTS; do dir="public/spotbugs/$(basename "$file" | rev | cut -d- -f1 --complement | rev)"; mkdir -p "$dir"; unzip "$file" -d "$dir"; done
- GradleCommon/scripts/make_directory_listings.sh
- find public -type f -regex '.*\.\(html?\|te?xt\|js\|css\|jpe?g\|png\|gif\)$' -exec gzip -fk9 {} \;
when: always
artifacts:
paths:
- public