This repository has been archived by the owner on Feb 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 209
/
.orange-ci.yml
166 lines (150 loc) · 5.16 KB
/
.orange-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
###################
# STAGES
stage-install-dep: &stage_install_deps
- name: install dependencies
jobs:
- name: setup ci environment
script:
- mkdir -p .cache && ln -snf $(pwd)/.cache $HOME/.cache
- export PIP_DOWNLOAD_CACHE=${pwd}/.cache/pip_download_cache && export XDG_CACHE_HOME=${pwd}/.cache/pip
- printf "XDG_CACHE_HOME=$XDG_CACHE_HOME\nPIP_DOWNLOAD_CACHE=$PIP_DOWNLOAD_CACHE\n"
- cat /proc/cpuinfo | grep flags
- "python -c 'import tensorflow as tf; print(tf.__version__); a=tf.constant(1, tf.int32); print(tf.Session().run(a))'"
- nvcc --version
- name: install project deps
env:
INDEX_URL: https://mirrors.tencent.com/pypi/simple/
TRUST_DOM: mirrors.tencent.com
script:
- "pip install cffi==1.12.3 coverage codecov -i ${INDEX_URL} --extra-index-url ${INDEX_URL} --trusted-host ${TRUST_DOM}"
- "pip install -e .[all] -i ${INDEX_URL} --extra-index-url ${INDEX_URL} --trusted-host ${TRUST_DOM}"
- pip uninstall -y torchvision
- pip install https://download.pytorch.org/whl/cu100/torchvision-0.3.0-cp36-cp36m-linux_x86_64.whl
- "python -c 'import torchvision; print(torchvision.__version__)'"
- "python -c 'import torch; print(torch.__version__)'"
stage-pylint: &stage_pylint
- name: check code style
script: pylint gnes/**/*.py --exit-zero
stage-unit-test: &stage_unit_test
- name: run unit test
script: python -m unittest tests/*.py -v
stage-notify-done: &stage_notify
- name: notify the success
jobs:
job1:
- name: make comment
script: echo "🍊 looks good to me 👍" > comment.txt
- name: submit comment
type: git:comment
options:
fromFile: comment.txt
job2:
- name: make notification
script: echo "$SUCCESS_MSG" > notify.md
- name: message
type: wework:message
options:
robot: $BOT_ID
fromFile: notify.md
stage-notify-all: &stage_notify_all
- name: notfiy the success to all
jobs:
- name: make notification
script: echo "$SUCCESS_ALL_MSG" > notify.md
- name: send mail
type: mail:send
options:
title: $SUCCESS_ALL_MSG
to:
- hanhxiao
- larryjfyan
- madwang
- leonjiang
- raccoonliu
- kegokang
type: markdown
fromFile: notify.md
- name: message
type: wework:message
options:
robot: $BOT_ID
fromFile: notify.md
stage-commit-lint: &stage_commit_lint
- name: do commit lint
script:
- npm install --global --save-dev @commitlint/config-conventional @commitlint/cli --registry=http://r.tnpm.oa.com
- "echo \"module.exports = {extends: ['@commitlint/config-conventional']}\" > commitlint.config.js"
- echo $ORANGE_LATEST_COMMIT_MESSAGE | commitlint
stage-coverity: &stage_coverity
- name: do coverity
script:
- coverage run -m unittest discover -s tests/
- coverage report --skip-covered
- codecov --token $CODECOV_TOKEN
stage-docker: &stage_docker
- name: docker push
script:
- ./docker-build.sh
###################
# PIPELINES
pipe-lint: &pipe_lint
docker:
image: node:alpine
network: idc-hk
wework:
title: "🍊⌛🖊️ Check commit lint"
stages:
- <<: *stage_commit_lint
pipe-unit-test: &pipe_unit_test
network: idc-ai-sse4
wework:
title: "🍊⌛🏗 Install GNES and do unit test"
docker:
image: ccr.ccs.tencentyun.com/gnes/ci-base
env:
GNES_ENV_SET: orange-ci
PIP_DOWNLOAD_CACHE: ${pwd}/.cache/pip_download_cache
XDG_CACHE_HOME: ${pwd}/.cache/pip
SUCCESS_MSG: "# 🍊✅😃 All tests passed, good job! \n由$ORANGE_BUILD_USER提交的$ORANGE_MERGE_REQUEST_BRANCH分支刚刚测试通过!\n[点击查看]($ORANGE_EVENT_URL)"
cacheFrom: .orange-ci.cache
stages:
- <<: *stage_install_deps
- <<: *stage_unit_test
- <<: *stage_notify
pipe-coverity: &pipe_coverity
network: idc-ai-sse4
wework:
title: "🍊⌛🏗 Do coverity check on the new master"
docker:
image: ccr.ccs.tencentyun.com/gnes/ci-base
env:
GNES_ENV_SET: orange-ci
PIP_DOWNLOAD_CACHE: ${pwd}/.cache/pip_download_cache
XDG_CACHE_HOME: ${pwd}/.cache/pip
SUCCESS_MSG: "# 🍊✅😃 Report is successfully updated!"
SUCCESS_ALL_MSG: "# 🍊🚀 GNES的Master分支刚刚更新了!\n此次更新由$ORANGE_BUILD_USER提交的$ORANGE_MERGE_REQUEST_BRANCH合并后触发,[点击查看]($ORANGE_EVENT_URL)"
envFrom: https://git.code.oa.com/gnes/secret-keys/blob/master/keys
cacheFrom: .orange-ci.cache
stages:
- <<: *stage_install_deps
- <<: *stage_coverity
- <<: *stage_notify
- <<: *stage_notify_all
pipe-docker: &pipe_docker
network: devnet
services:
- docker
envFrom: https://git.code.oa.com/gnes/secret-keys/blob/master/keys
stages:
- <<: *stage_docker
- <<: *stage_notify_all
master:
merge_request:
- <<: *pipe_lint
- <<: *pipe_unit_test
push:
- <<: *pipe_coverity
- <<: *pipe_docker
"**":
tag_push:
- <<: *pipe_docker