/
.gitlab-ci.yml
150 lines (139 loc) · 3.88 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
variables:
GIT_SUBMODULE_STRATEGY: recursive
VERSION_LAST_INCREASE: 0
VERSION_MAJOR: 4
VERSION_MINOR: 0
before_script:
- git remote set-url origin https://${CI_USER}:${CI_PUSH_TOKEN}@${GITLAB_HOST_URL}/android/nettest.git
- git config --global user.email '${CI_USER_EMAIL}'
- git config --global user.name '${CI_USER_NAME}'
- git submodule update --init --recursive
- echo $JAVA_HOME
- echo $ANDROID_HOME
- echo $PATH
- chmod +x ./gradlew
- export VERSION_PATCH=$((BUILD_NUMBER-VERSION_LAST_INCREASE))
- export VERSION_CODE=$(( (((VERSION_MAJOR*1000000)+(VERSION_MINOR*10000)+VERSION_PATCH))*10))
- export VERSION_NAME="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH"
- export RELEASE_NOTES="Created from commit $CI_PROJECT_URL/commit/$CI_COMMIT_SHA"
- export BUILD_TIME=$(date +%s%3N)
- echo "${VERSION_PATCH}"
- echo "${VERSION_CODE}"
- echo "${VERSION_NAME}"
- echo "${RELEASE_NOTES}"
- echo "${BUILD_TIME}"
- echo "${GITLAB_HOST_URL}"
stages:
- init
- check
- distribution
- gitTag
distribution:init:
stage: init
script:
- echo "${BUILD_NUMBER}"
- NEW_NUMBER=$((++BUILD_NUMBER))
- echo "next build number $NEW_NUMBER"
- 'curl --request PUT --header "PRIVATE-TOKEN: ${CI_PUSH_TOKEN}" "https://${GITLAB_HOST_URL}/api/v4/projects/${CI_PROJECT_ID}/variables/BUILD_NUMBER" --form "value=${NEW_NUMBER}"'
only:
- develop
check:app-rtr:
stage: check
script:
- ./gradlew :app:ktlint
- ./gradlew :app:lintLocalDevDebug
only:
refs:
- /fix\/.*/
- /feature\/.*/
- /hotfix\/.*/
- /update\/.*/
- /test\/.*/
check:core:
stage: check
script:
- ./gradlew :core:ktlint
- ./gradlew :core:lint
only:
refs:
- /fix\/.*/
- /feature\/.*/
- /hotfix\/.*/
- /update\/.*/
- /test\/.*/
check:controlClient:
stage: check
script:
- ./gradlew :control_client:ktlint
- ./gradlew :control_client:lint
only:
refs:
- /fix\/.*/
- /feature\/.*/
- /hotfix\/.*/
- /update\/.*/
- /test\/.*/
check:openRMBTBuild:
stage: check
script:
- rm -rf private
- ./gradlew app:clean
- ./gradlew app:assembleOpenRmbtDebug
only:
refs:
- /fix\/.*/
- /feature\/.*/
- /hotfix\/.*/
- /update\/.*/
- /test\/.*/
.check:uiTests:
stage: check
interruptible: true
timeout: 15m
allow_failure: true
variables:
TEST_AVD_NAME: Pixel_2_API_26
script:
- export DISPLAY=:0
- chmod a+x ./run-ui-tests.sh
- ./run-ui-tests.sh $TEST_AVD_NAME
tags:
- RTR_UI_TESTS
only:
refs:
- develop
distribution:build-rtr:
stage: distribution
interruptible: true
script:
- echo "version ${VERSION_NAME}(${VERSION_CODE})"
- ./gradlew app:assembleLocalStageDebug -PbuildVersionCode=${VERSION_CODE} -PbuildVersionName=${VERSION_NAME} -PreleaseNotes="${RELEASE_NOTES}"
- ./gradlew app:appDistributionUploadLocalStageDebug -PbuildVersionCode=${VERSION_CODE} -PbuildVersionName=${VERSION_NAME} -PreleaseNotes="${RELEASE_NOTES}"
- ./gradlew app:assembleLocalDemoRelease -PbuildVersionCode=${VERSION_CODE} -PbuildVersionName=${VERSION_NAME} -PreleaseNotes="${RELEASE_NOTES}"
- ./gradlew app:appDistributionUploadLocalDemoRelease -PbuildVersionCode=${VERSION_CODE} -PbuildVersionName=${VERSION_NAME} -PreleaseNotes="${RELEASE_NOTES}"
only:
- develop
artifacts:
name: "local-$VERSION_NAME-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA"
paths:
- app/build/outputs
distribution:docs:
stage: distribution
interruptible: true
script:
- ./gradlew dokka dokkaMarkdown
only:
- develop
artifacts:
name: "docs-$VERSION_NAME-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA"
paths:
- build_results/javadoc
- build_results/markdown
distribution:tag:
stage: gitTag
interruptible: true
script:
- git tag "${VERSION_NAME}"
- git push origin --tags
only:
- develop