test.yml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. version: 2.1
  2. # the default pipeline parameters, which will be updated according to
  3. # the results of the path-filtering orb
  4. parameters:
  5. lint_only:
  6. type: boolean
  7. default: true
  8. jobs:
  9. lint:
  10. docker:
  11. - image: cimg/python:3.7.4
  12. steps:
  13. - checkout
  14. - run:
  15. name: Install pre-commit hook
  16. command: |
  17. pip install pre-commit
  18. pre-commit install
  19. - run:
  20. name: Linting
  21. command: pre-commit run --all-files
  22. - run:
  23. name: Check docstring coverage
  24. command: |
  25. pip install interrogate
  26. interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-regex "__repr__" --fail-under 80 mmpose
  27. build_cpu:
  28. parameters:
  29. # The python version must match available image tags in
  30. # https://circleci.com/developer/images/image/cimg/python
  31. python:
  32. type: string
  33. torch:
  34. type: string
  35. torchvision:
  36. type: string
  37. docker:
  38. - image: cimg/python:<< parameters.python >>
  39. resource_class: large
  40. steps:
  41. - checkout
  42. - run:
  43. name: Install Libraries
  44. command: |
  45. sudo apt-get update
  46. sudo apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 libturbojpeg git
  47. - run:
  48. name: Configure Python & pip
  49. command: |
  50. pip install --upgrade pip
  51. pip install wheel
  52. - run:
  53. name: Install PyTorch
  54. command: |
  55. python -V
  56. pip install torch==<< parameters.torch >>+cpu torchvision==<< parameters.torchvision >>+cpu -f https://download.pytorch.org/whl/torch_stable.html
  57. - run:
  58. name: Install mmpose dependencies
  59. command: |
  60. pip install -U numpy
  61. pip install git+https://github.com/open-mmlab/mmengine.git@main
  62. pip install -U openmim
  63. mim install 'mmcv >= 2.0.0'
  64. pip install git+https://github.com/open-mmlab/mmdetection.git@dev-3.x
  65. pip install -r requirements/tests.txt
  66. pip install -r requirements/albu.txt
  67. pip install -r requirements/poseval.txt
  68. - run:
  69. name: Build and install
  70. command: |
  71. pip install -e .
  72. - run:
  73. name: Run unittests
  74. command: |
  75. coverage run --branch --source mmpose -m pytest tests/
  76. coverage xml
  77. coverage report -m
  78. build_cuda:
  79. parameters:
  80. torch:
  81. type: string
  82. cuda:
  83. type: enum
  84. enum: ["11.0", "11.7"]
  85. cudnn:
  86. type: integer
  87. default: 8
  88. machine:
  89. image: ubuntu-2004-cuda-11.4:202110-01
  90. # docker_layer_caching: true
  91. resource_class: gpu.nvidia.small
  92. steps:
  93. - checkout
  94. - run:
  95. # Cloning repos in VM since Docker doesn't have access to the private key
  96. name: Clone Repos
  97. command: |
  98. git clone -b main --depth 1 https://github.com/open-mmlab/mmengine.git /home/circleci/mmengine
  99. git clone -b dev-3.x --depth 1 https://github.com/open-mmlab/mmdetection.git /home/circleci/mmdetection
  100. - run:
  101. name: Build Docker image
  102. command: |
  103. docker build .circleci/docker -t mmpose:gpu --build-arg PYTORCH=<< parameters.torch >> --build-arg CUDA=<< parameters.cuda >> --build-arg CUDNN=<< parameters.cudnn >>
  104. docker run --gpus all -t -d -v /home/circleci/project:/mmpose -v /home/circleci/mmengine:/mmengine -v /home/circleci/mmdetection:/mmdetection -w /mmpose --name mmpose mmpose:gpu
  105. - run:
  106. name: Install mmpose dependencies
  107. command: |
  108. docker exec mmpose apt install git -y
  109. docker exec mmpose pip install -U numpy
  110. docker exec mmpose pip install -e /mmengine
  111. docker exec mmpose pip install -U openmim
  112. docker exec mmpose mim install 'mmcv >= 2.0.0'
  113. docker exec mmpose pip install -e /mmdetection
  114. docker exec mmpose pip install -r requirements/tests.txt
  115. docker exec mmpose pip install -r requirements/albu.txt
  116. docker exec mmpose pip install -r requirements/poseval.txt
  117. - run:
  118. name: Build and install
  119. command: |
  120. docker exec mmpose pip install -e .
  121. - run:
  122. name: Run unittests
  123. command: |
  124. docker exec mmpose pytest tests/
  125. workflows:
  126. pr_stage_lint:
  127. when: << pipeline.parameters.lint_only >>
  128. jobs:
  129. - lint:
  130. name: lint
  131. filters:
  132. branches:
  133. ignore:
  134. - dev-1.x
  135. - main
  136. pr_stage_test:
  137. when:
  138. not:
  139. << pipeline.parameters.lint_only >>
  140. jobs:
  141. - lint:
  142. name: lint
  143. filters:
  144. branches:
  145. ignore:
  146. - dev-1.x
  147. - main
  148. - build_cpu:
  149. name: minimum_version_cpu
  150. torch: 1.7.1
  151. torchvision: 0.8.2
  152. python: 3.7.4
  153. requires:
  154. - lint
  155. - build_cpu:
  156. name: maximum_version_cpu
  157. torch: 2.0.0
  158. torchvision: 0.15.1
  159. python: 3.9.0
  160. requires:
  161. - minimum_version_cpu
  162. - hold:
  163. type: approval
  164. requires:
  165. - maximum_version_cpu
  166. - build_cuda:
  167. name: mainstream_version_gpu
  168. torch: 1.7.1
  169. # Use double quotation mark to explicitly specify its type
  170. # as string instead of number
  171. cuda: "11.0"
  172. requires:
  173. - hold
  174. - build_cuda:
  175. name: maximum_version_gpu
  176. torch: 2.0.0
  177. cuda: "11.7"
  178. cudnn: 8
  179. requires:
  180. - hold
  181. merge_stage_test:
  182. when:
  183. not:
  184. << pipeline.parameters.lint_only >>
  185. jobs:
  186. - build_cuda:
  187. name: minimum_version_gpu
  188. torch: 1.7.1
  189. # Use double quotation mark to explicitly specify its type
  190. # as string instead of number
  191. cuda: "11.0"
  192. filters:
  193. branches:
  194. only:
  195. - dev-1.x
  196. - main