build.yml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. name: build
  2. on:
  3. push:
  4. paths-ignore:
  5. - '**.md'
  6. - 'docs/**'
  7. - '.readthedocs.yml'
  8. - '.gitigore'
  9. - 'LICENSE'
  10. pull_request:
  11. paths-ignore:
  12. - '**.md'
  13. - 'docs/**'
  14. - '.readthedocs.yml'
  15. - '.gitigore'
  16. - 'LICENSE'
  17. concurrency:
  18. group: ${{ github.workflow }}-${{ github.ref }}
  19. cancel-in-progress: true
  20. jobs:
  21. test_linux:
  22. runs-on: ubuntu-18.04
  23. container:
  24. image: pytorch/pytorch:1.6.0-cuda10.1-cudnn7-devel
  25. env:
  26. LC_ALL: C.UTF-8
  27. LANG: C.UTF-8
  28. strategy:
  29. matrix:
  30. python-version: [3.7]
  31. torch: [1.5.0+cu101, 1.8.0+cu101]
  32. include:
  33. - torch: 1.5.0+cu101
  34. torchvision: 0.6.0+cu101
  35. - torch: 1.8.0+cu101
  36. torchvision: 0.9.0+cu101
  37. - torch: 1.8.0+cu101
  38. torchvision: 0.9.0+cu101
  39. python-version: 3.6
  40. - torch: 1.8.0+cu101
  41. torchvision: 0.9.0+cu101
  42. python-version: 3.8
  43. steps:
  44. - uses: actions/checkout@v2
  45. - name: Set up Python ${{ matrix.python-version }}
  46. uses: actions/setup-python@v2
  47. with:
  48. python-version: ${{ matrix.python-version }}
  49. - name: Fetch GPG keys
  50. run: |
  51. apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
  52. apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
  53. - name: Install python-dev
  54. run: apt-get update && apt-get install -y python${{matrix.python-version}}-dev
  55. if: ${{matrix.python-version != '3.9'}}
  56. - name: Install system dependencies
  57. run: apt-get install -y git libgl1 libglib2.0-0
  58. - name: Upgrade setuptools and pip
  59. run: python -m pip install --upgrade setuptools pip
  60. - name: Install wheel # wheel is the default package of local environment but docker environment misses the package so we manually install it
  61. run: python -m pip install wheel
  62. - name: Install PyTorch
  63. run: python -m pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
  64. - name: Build and install
  65. run: rm -rf .eggs && python -m pip install -e .
  66. - name: Validate the installation
  67. run: python -c "import mim"
  68. - name: Install unittest dependencies
  69. run: python -m pip install -r requirements/tests.txt
  70. - name: Run unittests and generate coverage report
  71. run: |
  72. coverage run --branch --source=mim -m pytest tests/
  73. coverage xml
  74. coverage report -m
  75. - name: Run unittests with click < 8.0.0
  76. run: |
  77. python -m pip install click==7.1.2
  78. pytest tests/
  79. if: ${{matrix.python-version == '3.8'}}
  80. - name: Upload coverage to Codecov
  81. uses: codecov/codecov-action@v1.0.10
  82. with:
  83. file: ./coverage.xml
  84. flags: unittests
  85. env_vars: OS,PYTHON
  86. name: codecov-umbrella
  87. fail_ci_if_error: false
  88. test_windows:
  89. runs-on: windows-latest
  90. strategy:
  91. matrix:
  92. python-version: [3.7]
  93. torch: [1.5.0, 1.8.0]
  94. include:
  95. - torch: 1.5.0
  96. torchvision: 0.6.0
  97. - torch: 1.8.0
  98. torchvision: 0.9.0
  99. steps:
  100. - uses: actions/checkout@v2
  101. - name: Set up Python ${{ matrix.python-version }}
  102. uses: actions/setup-python@v2
  103. with:
  104. python-version: ${{ matrix.python-version }}
  105. - name: Upgrade setuptools
  106. run: pip install --upgrade setuptools
  107. - name: Install wheel # wheel is the default package of local environment but docker environment misses the package so we manually install it
  108. run: pip install wheel
  109. - name: Install PyTorch
  110. run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
  111. - name: Build and install
  112. run: pip install -e .
  113. - name: Validate the installation
  114. run: python -c "import mim"
  115. - name: Install unittest dependencies
  116. run: pip install -r requirements/tests.txt
  117. - name: Run unittests and generate coverage report
  118. run: |
  119. coverage run --branch --source=mim -m pytest tests/
  120. coverage xml
  121. coverage report -m
  122. - name: Upload coverage to Codecov
  123. uses: codecov/codecov-action@v1.0.10
  124. with:
  125. file: ./coverage.xml
  126. flags: unittests
  127. env_vars: OS,PYTHON
  128. name: codecov-umbrella
  129. fail_ci_if_error: false
  130. test_macos:
  131. runs-on: macos-latest
  132. strategy:
  133. matrix:
  134. torch: [1.8.0, 1.9.0]
  135. include:
  136. - torch: 1.8.0
  137. torchvision: 0.9.0
  138. - torch: 1.9.0
  139. torchvision: 0.10.0
  140. steps:
  141. - uses: actions/checkout@v2
  142. - name: Set up Python 3.7
  143. uses: actions/setup-python@v2
  144. with:
  145. python-version: 3.7
  146. - name: Install PyTorch
  147. run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} --no-cache-dir
  148. - name: Build and install
  149. run: pip install -e .
  150. - name: Validate the installation
  151. run: python -c "import mim"
  152. - name: Install unittest dependencies
  153. run: pip install -r requirements/tests.txt
  154. - name: Run unittests
  155. run: pytest tests/