-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
154 lines (142 loc) · 3.36 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
variables:
GIT_SUBMODULE_STRATEGY: recursive
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"
# JACOCO_DATA: "$CI_PROJECT_DIR/**/build/jacoco/*"
JACOCO_DATA1: "$CI_PROJECT_DIR/build/jacoco/*"
JACOCO_DATA2: "$CI_PROJECT_DIR/*/build/jacoco/*"
JACOCO_DATA3: "$CI_PROJECT_DIR/*/*/build/jacoco/*"
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:
key: "$CI_COMMIT_REF_NAME $CI_COMMIT_SHA"
untracked: true
before_script:
- shopt -s globstar
- shopt -s nullglob
stages:
- build
- test
- report
- deploy
build:
stage: build
cache:
policy: push
script:
- ./gradlew --console=plain assemble
- cp $ORIG_ARTIFACTS1 $ORIG_ARTIFACTS2 .
retry: 2
when: on_success
artifacts:
paths:
- $ARTIFACTS1
- $ARTIFACTS2
test:
stage: test
cache:
policy: pull-push
script:
- ./gradlew --continue --console=plain test
retry: 2
when: on_success
artifacts:
when: always
paths:
- $TEST_REPORTS
# - $JACOCO_DATA
- $JACOCO_DATA1
- $JACOCO_DATA2
- $JACOCO_DATA3
checkFormatting:
stage: test
cache:
policy: pull
script:
- ./gradlew --continue --console=plain spotlessCheck
allow_failure: true
when: on_success
coverage:
stage: report
cache:
policy: pull
dependencies:
- test
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
cache:
policy: pull
script:
- ./gradlew --continue --console=plain spotbugs
allow_failure: true
when: on_success
artifacts:
when: always
paths:
- $SPOTBUGS_REPORTS
deploySnapshot:
stage: deploy
cache:
policy: pull
dependencies:
- build
script:
- ./gradlew --console=plain uploadArchives
retry: 2
when: always
except:
- tags
deploy:
stage: deploy
cache:
policy: pull
dependencies:
- build
script:
- ./gradlew --console=plain release
retry: 2
when: always
only:
- tags
sendCoverage:
stage: deploy
cache:
policy: pull
dependencies:
- coverage
script:
- ./gradlew --console=plain sendCoverageToCodacy
when: always
pages:
stage: deploy
cache:
policy: pull
dependencies:
- build
- test
- coverage
- spotbugs
script:
- for file in $JAVADOCS; do dir=public/javadoc/$(basename $file | rev | cut -d- -f-3 --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 $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
when: always
artifacts:
paths:
- public