-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
134 lines (122 loc) · 3.06 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
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/*"
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
script:
- ./gradlew --console=plain assemble
- cp $ORIG_ARTIFACTS1 $ORIG_ARTIFACTS2 .
retry: 2
when: on_success
artifacts:
paths:
- $ARTIFACTS1
- $ARTIFACTS2
test:
stage: test
script:
- ./gradlew --continue --console=plain test
retry: 2
when: on_success
artifacts:
when: always
paths:
- $TEST_REPORTS
# - $JACOCO_DATA
- $JACOCO_DATA1
- $JACOCO_DATA2
checkFormatting:
stage: test
script:
- ./gradlew --continue --console=plain spotlessCheck
allow_failure: true
when: on_success
coverage:
stage: report
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
script:
- ./gradlew --continue --console=plain spotbugs
allow_failure: true
when: on_success
artifacts:
when: always
paths:
- $SPOTBUGS_REPORTS
deploySnapshot:
stage: deploy
dependencies:
- build
script:
- ./gradlew --console=plain uploadArchives
retry: 2
when: always
except:
- tags
deploy:
stage: deploy
dependencies:
- build
script:
- ./gradlew --console=plain release
retry: 2
when: always
only:
- tags
sendCoverage:
stage: deploy
dependencies:
- coverage
script:
- ./gradlew --console=plain sendCoverageToCodacy
when: always
pages:
stage: deploy
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