tests.yml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. name: Tests
  2. on:
  3. pull_request:
  4. push:
  5. branches:
  6. - nightly
  7. - main
  8. - release/*
  9. workflow_dispatch:
  10. jobs:
  11. unittests-linux:
  12. strategy:
  13. matrix:
  14. python-version:
  15. - "3.8"
  16. - "3.9"
  17. - "3.10"
  18. - "3.11"
  19. runner: ["linux.12xlarge"]
  20. gpu-arch-type: ["cpu"]
  21. include:
  22. - python-version: 3.8
  23. runner: linux.g5.4xlarge.nvidia.gpu
  24. gpu-arch-type: cuda
  25. gpu-arch-version: "11.8"
  26. fail-fast: false
  27. uses: pytorch/test-infra/.github/workflows/linux_job.yml@release/2.1
  28. with:
  29. repository: pytorch/vision
  30. runner: ${{ matrix.runner }}
  31. gpu-arch-type: ${{ matrix.gpu-arch-type }}
  32. gpu-arch-version: ${{ matrix.gpu-arch-version }}
  33. timeout: 120
  34. script: |
  35. set -euo pipefail
  36. export PYTHON_VERSION=${{ matrix.python-version }}
  37. export GPU_ARCH_TYPE=${{ matrix.gpu-arch-type }}
  38. export GPU_ARCH_VERSION=${{ matrix.gpu-arch-version }}
  39. ./.github/scripts/unittest.sh
  40. unittests-macos:
  41. strategy:
  42. matrix:
  43. python-version:
  44. - "3.8"
  45. - "3.9"
  46. - "3.10"
  47. - "3.11"
  48. runner: ["macos-12"]
  49. include:
  50. - python-version: "3.8"
  51. runner: macos-m1-12
  52. fail-fast: false
  53. uses: pytorch/test-infra/.github/workflows/macos_job.yml@release/2.1
  54. with:
  55. repository: pytorch/vision
  56. # We need an increased timeout here, since the macos-12 runner is the free one from GH
  57. # and needs roughly 2 hours to just run the test suite
  58. timeout: 240
  59. runner: ${{ matrix.runner }}
  60. script: |
  61. set -euo pipefail
  62. export PYTHON_VERSION=${{ matrix.python-version }}
  63. export GPU_ARCH_TYPE=cpu
  64. export GPU_ARCH_VERSION=''
  65. ./.github/scripts/unittest.sh
  66. unittests-windows:
  67. strategy:
  68. matrix:
  69. python-version:
  70. - "3.8"
  71. - "3.9"
  72. - "3.10"
  73. - "3.11"
  74. runner: ["windows.4xlarge"]
  75. gpu-arch-type: ["cpu"]
  76. include:
  77. - python-version: "3.8"
  78. runner: windows.g5.4xlarge.nvidia.gpu
  79. gpu-arch-type: cuda
  80. gpu-arch-version: "11.8"
  81. fail-fast: false
  82. uses: pytorch/test-infra/.github/workflows/windows_job.yml@release/2.1
  83. with:
  84. repository: pytorch/vision
  85. runner: ${{ matrix.runner }}
  86. gpu-arch-type: ${{ matrix.gpu-arch-type }}
  87. gpu-arch-version: ${{ matrix.gpu-arch-version }}
  88. timeout: 120
  89. script: |
  90. set -euxo pipefail
  91. export PYTHON_VERSION=${{ matrix.python-version }}
  92. export VC_YEAR=2019
  93. export VSDEVCMD_ARGS=""
  94. export GPU_ARCH_TYPE=${{ matrix.gpu-arch-type }}
  95. export GPU_ARCH_VERSION=${{ matrix.gpu-arch-version }}
  96. ./.github/scripts/unittest.sh
  97. onnx:
  98. uses: pytorch/test-infra/.github/workflows/linux_job.yml@release/2.1
  99. with:
  100. repository: pytorch/vision
  101. script: |
  102. set -euo pipefail
  103. export PYTHON_VERSION=3.8
  104. export GPU_ARCH_TYPE=cpu
  105. export GPU_ARCH_VERSION=''
  106. ./.github/scripts/setup-env.sh
  107. # Prepare conda
  108. CONDA_PATH=$(which conda)
  109. eval "$(${CONDA_PATH} shell.bash hook)"
  110. conda activate ci
  111. echo '::group::Install ONNX'
  112. pip install --progress-bar=off onnx onnxruntime
  113. echo '::endgroup::'
  114. echo '::group::Install testing utilities'
  115. pip install --progress-bar=off pytest
  116. echo '::endgroup::'
  117. echo '::group::Run ONNX tests'
  118. pytest --junit-xml="${RUNNER_TEST_RESULTS_DIR}/test-results.xml" -v --durations=25 test/test_onnx.py
  119. echo '::endgroup::'
  120. unittests-extended:
  121. uses: pytorch/test-infra/.github/workflows/linux_job.yml@release/2.1
  122. with:
  123. repository: pytorch/vision
  124. script: |
  125. set -euo pipefail
  126. export PYTHON_VERSION=3.8
  127. export GPU_ARCH_TYPE=cpu
  128. export GPU_ARCH_VERSION=''
  129. ./.github/scripts/setup-env.sh
  130. # Prepare conda
  131. CONDA_PATH=$(which conda)
  132. eval "$(${CONDA_PATH} shell.bash hook)"
  133. conda activate ci
  134. echo '::group::Pre-download model weights'
  135. pip install --progress-bar=off aiohttp aiofiles tqdm
  136. python scripts/download_model_urls.py
  137. echo '::endgroup::'
  138. echo '::group::Install testing utilities'
  139. pip install --progress-bar=off pytest
  140. echo '::endgroup::'
  141. echo '::group::Run extended unittests'
  142. export PYTORCH_TEST_WITH_EXTENDED=1
  143. pytest --junit-xml="${RUNNER_TEST_RESULTS_DIR}/test-results.xml" -v --durations=25 test/test_extended_*.py
  144. echo '::endgroup::'