Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

#549 Feature/infra 1481 call integration tests

Merged
Ghost merged 1 commits into Deci-AI:master from deci-ai:feature/infra-1481_call_integration_tests
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
  1. version: 2.1
  2. parameters:
  3. orb_version:
  4. type: string
  5. description: Deci ai ORB version https://circleci.com/developer/orbs/orb/deci-ai/circleci-common-orb
  6. default: "10.3.0"
  7. # default: "dev:alpha"
  8. orbs:
  9. deci-common: deci-ai/circleci-common-orb@<< pipeline.parameters.orb_version >>
  10. # This filter operates on SemVer2 tags only
  11. release_tag_filter: &release_tag_filter
  12. filters:
  13. branches:
  14. ignore: /.*/
  15. tags:
  16. only: /^\d+\.\d+\.\d+$/
  17. release_candidate_filter: &release_candidate_filter
  18. filters:
  19. branches:
  20. only: master
  21. jobs:
  22. build:
  23. parameters:
  24. py_version:
  25. type: string
  26. default: latest
  27. package_name:
  28. type: string
  29. docker:
  30. - image: cimg/python:<< parameters.py_version >>
  31. resource_class: large
  32. steps:
  33. - deci-common/checkout_and_skip_build:
  34. check_version_file: true
  35. - deci-common/get_persisted_version_info
  36. - when:
  37. condition:
  38. and:
  39. - not:
  40. equal: [ develop, << pipeline.git.branch >> ]
  41. - not:
  42. equal: [ staging, << pipeline.git.branch >> ]
  43. - not:
  44. equal: [ master, << pipeline.git.branch >> ]
  45. steps:
  46. - run:
  47. name: install Black Flake8 python linter
  48. command: |
  49. pip install --user -r requirements.dev.txt
  50. - run:
  51. name: Lint all python files changed since develop branch
  52. command: |
  53. flake8 --statistics --config scripts/flake8-config setup.py $(git diff --diff-filter ACM origin/master --name-only | grep 'py$' | grep -v 'experimental/' | grep -v 'experimental_models/')
  54. - run:
  55. name: Run Black on changed files against master branch
  56. command: |
  57. black --check setup.py $(git diff --diff-filter ACM origin/master --name-only | grep 'py$' | grep -v 'experimental/' | grep -v 'experimental_models/')
  58. - run:
  59. name: add requirements.txt and requirements.pro.txt to source code
  60. command: |
  61. cp requirements.txt src/super_gradients/requirements.txt
  62. cp requirements.pro.txt src/super_gradients/requirements.pro.txt
  63. - run:
  64. name: install python dependencies
  65. command: |
  66. python3 -m venv venv
  67. . venv/bin/activate
  68. python3 -m pip install pip==22.0.4
  69. cat requirements.txt | cut -f1 -d"#" | xargs -n 1 -L 1 pip install --progress-bar off
  70. - run:
  71. name: edit package version
  72. command: |
  73. echo "${NEW_VERSION}" > version.txt
  74. cat version.txt
  75. - run:
  76. name: setup custom environment variables
  77. command: |
  78. echo 'export PYTHONPATH=/home/circleci/super_gradients' >> $BASH_ENV
  79. echo 'export UPLOAD_LOGS=FALSE' >> $BASH_ENV
  80. - run:
  81. name: install package
  82. no_output_timeout: 30m
  83. command: |
  84. . venv/bin/activate
  85. python3 -m pip install --extra-index-url https://pypi.ngc.nvidia.com .[pro]
  86. - run:
  87. name: run tests with coverage
  88. no_output_timeout: 30m
  89. command: |
  90. . venv/bin/activate
  91. coverage run --source=super_gradients -m unittest tests/deci_core_unit_test_suite_runner.py
  92. coverage report
  93. coverage html # open htmlcov/index.html in a browser
  94. - store_artifacts:
  95. path: htmlcov
  96. - store_artifacts:
  97. path: ~/sg_logs
  98. release_candidate:
  99. parameters:
  100. py_version:
  101. type: string
  102. docker:
  103. - image: cimg/python:<< parameters.py_version >>
  104. steps:
  105. - deci-common/checkout_and_skip_build:
  106. check_version_file: true
  107. - deci-common/get_persisted_version_info
  108. - run:
  109. name: edit package version
  110. command: |
  111. echo $NEW_VERSION > version.txt
  112. - deci-common/pip_upload_package_codeartifact_dev:
  113. codeartifact_repository: "deci-packages"
  114. - deci-common/pip_test_package_installation_codeartifact_dev:
  115. package_name: "super-gradients"
  116. version: $NEW_VERSION
  117. - deci-common/git_config_automation_user
  118. - run:
  119. name: "commit version file"
  120. command: |
  121. git commit version.txt -m "Deci Services - Changed version to $NEW_VERSION"
  122. - deci-common/git_commit_and_tag:
  123. version: $NEW_VERSION
  124. release_version:
  125. parameters:
  126. py_version:
  127. type: string
  128. docker:
  129. - image: cimg/python:<< parameters.py_version >>
  130. steps:
  131. - deci-common/checkout_and_skip_build:
  132. check_version_file: true
  133. - run:
  134. name: verify __version__
  135. command: python3 tests/verify_version.py $CIRCLE_TAG
  136. - run:
  137. name: add requirements.txt and requirements.pro.txt to source code
  138. command: |
  139. cp requirements.txt src/super_gradients/requirements.txt
  140. cp requirements.pro.txt src/super_gradients/requirements.pro.txt
  141. - run:
  142. name: edit package version
  143. command: |
  144. echo $CIRCLE_TAG > version.txt
  145. - deci-common/pip_upload_package_codeartifact_all_accounts:
  146. codeartifact_repository: "deci-packages"
  147. - deci-common/pip_test_package_installation_codeartifact_dev:
  148. package_name: "super-gradients"
  149. version: $CIRCLE_TAG
  150. - deci-common/pip_test_package_installation_codeartifact_prod:
  151. package_name: "super-gradients"
  152. version: $CIRCLE_TAG
  153. - deci-common/pip_upload_package_codeartifact_prod:
  154. codeartifact_repository: "deci-toolkit"
  155. - deci-common/git_commit_and_tag:
  156. version: $CIRCLE_TAG
  157. delete_remote_tag_before_tagging: true
  158. - deci-common/tag_as:
  159. tag_name: "stable"
  160. delete_remote: true
  161. - deci-common/github_create_release:
  162. github_cli_token: $GITHUB_CLI_TOKEN
  163. directory_to_cd_into: "."
  164. tag: $CIRCLE_TAG
  165. notes: "This GitHub Release was done automatically by CircleCI"
  166. recipe_tests:
  167. machine: true
  168. resource_class: deci-ai/sg-gpu-on-premise
  169. parameters:
  170. sg_existing_env_path:
  171. type: string
  172. default: "/env/persistent_env"
  173. sg_new_env_name:
  174. type: string
  175. default: "${CIRCLE_BUILD_NUM}"
  176. sg_new_env_python_version:
  177. type: string
  178. default: "python3.8"
  179. steps:
  180. - checkout
  181. - run:
  182. name: install requirements and run recipe tests
  183. command: |
  184. << parameters.sg_new_env_python_version >> -m venv << parameters.sg_new_env_name >>
  185. source << parameters.sg_new_env_name >>/bin/activate
  186. python3.8 -m pip install --upgrade setuptools pip wheel
  187. python3.8 -m pip install -r requirements.txt
  188. python3.8 -m pip install git+https://github.com/Deci-AI/super-gradients.git@${CIRCLE_BRANCH}
  189. python3.8 -m pip install torch==1.12.0+cu116 torchvision==0.13.0+cu116 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu116
  190. python3.8 src/super_gradients/examples/train_from_recipe_example/train_from_recipe.py --config-name=cifar10_resnet experiment_name=shortened_cifar10_resnet_accuracy_test training_hyperparams.max_epochs=100 training_hyperparams.average_best_models=False multi_gpu=DDP num_gpus=4
  191. python3.8 src/super_gradients/examples/convert_recipe_example/convert_recipe_example.py --config-name=cifar10_conversion_params experiment_name=shortened_cifar10_resnet_accuracy_test
  192. python3.8 src/super_gradients/examples/train_from_recipe_example/train_from_recipe.py --config-name=coco2017_yolox experiment_name=shortened_coco2017_yolox_n_map_test architecture=yolox_n training_hyperparams.loss=yolox_fast_loss training_hyperparams.max_epochs=10 training_hyperparams.average_best_models=False multi_gpu=DDP num_gpus=4
  193. python3.8 src/super_gradients/examples/train_from_recipe_example/train_from_recipe.py --config-name=cityscapes_regseg48 experiment_name=shortened_cityscapes_regseg48_iou_test training_hyperparams.max_epochs=10 training_hyperparams.average_best_models=False multi_gpu=DDP num_gpus=4
  194. coverage run --source=super_gradients -m unittest tests/deci_core_recipe_test_suite_runner.py
  195. - run:
  196. name: Remove new environment when failed
  197. command: "rm -r << parameters.sg_new_env_name >>"
  198. when: on_fail
  199. workflows:
  200. release:
  201. jobs:
  202. - deci-common/persist_version_info:
  203. <<: *release_tag_filter
  204. - deci-common/codeartifact_login:
  205. name: "login_to_codeartifact_release"
  206. repo_name: "deci-packages"
  207. <<: *release_tag_filter
  208. - build:
  209. name: "build3.7"
  210. py_version: "3.7"
  211. package_name: "super-gradients"
  212. requires:
  213. - deci-common/persist_version_info
  214. - login_to_codeartifact_release
  215. <<: *release_tag_filter
  216. - recipe_tests:
  217. <<: *release_tag_filter
  218. - release_version:
  219. py_version: "3.7"
  220. requires:
  221. - "build3.7"
  222. - recipe_tests
  223. <<: *release_tag_filter
  224. - deci-common/pip_upload_package_from_codeartifact_to_global_pypi:
  225. package_name: "super-gradients"
  226. name: "upload_super_gradients_to_pypi"
  227. version: $CIRCLE_TAG
  228. requires:
  229. - "release_version"
  230. context:
  231. - pypi-public
  232. <<: *release_tag_filter
  233. build_and_deploy:
  234. jobs:
  235. - deci-common/persist_version_info
  236. - deci-common/codeartifact_login:
  237. repo_name: "deci-packages"
  238. - build:
  239. name: "build3.7"
  240. py_version: "3.7"
  241. package_name: "super-gradients"
  242. requires:
  243. - deci-common/persist_version_info
  244. - deci-common/codeartifact_login
  245. - release_candidate: # happens on merge
  246. py_version: "3.7"
  247. requires:
  248. - "build3.7"
  249. <<: *release_candidate_filter
Discard
Tip!

Press p or to see the previous file or, n or to see the next file