ci.yml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. name: ci
  2. on:
  3. push:
  4. branches:
  5. - master
  6. pull_request:
  7. jobs:
  8. build:
  9. runs-on: ${{ matrix.os }}
  10. strategy:
  11. matrix:
  12. os: [macos-latest, ubuntu-latest, windows-latest]
  13. python-version: ['3.7', '2.7']
  14. PYTEST_QT_API: [pyqt5, pyqt4v2, pyside2]
  15. exclude:
  16. - os: macos-latest
  17. PYTEST_QT_API: pyqt4v2
  18. - os: macos-latest
  19. PYTEST_QT_API: pyside2
  20. - os: windows-latest
  21. PYTEST_QT_API: pyqt4v2
  22. - os: windows-latest
  23. PYTEST_QT_API: pyside2
  24. - python-version: '3.7'
  25. PYTEST_QT_API: pyqt4v2
  26. steps:
  27. - uses: actions/checkout@v2
  28. with:
  29. submodules: true
  30. - uses: goanpeca/setup-miniconda@v1
  31. with:
  32. auto-update-conda: true
  33. python-version: ${{ matrix.python-version }}
  34. - name: Install system dependencies
  35. shell: bash -l {0}
  36. run: |
  37. if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
  38. sudo apt-get install -y coreutils
  39. sudo apt-get install -y xvfb herbstluftwm
  40. elif [ "${{ matrix.os }}" = "macos-latest" ]; then
  41. brew install coreutils
  42. brew cask install xquartz
  43. fi
  44. - name: Set up Python
  45. shell: bash -l {0}
  46. env:
  47. PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
  48. run: |
  49. conda install -q -y python=$PYTHON_VERSION
  50. which python
  51. python --version
  52. pip --version
  53. - name: Install dependencies
  54. shell: bash -l {0}
  55. run: |
  56. if [ "${{ matrix.PYTEST_QT_API }}" = "pyside2" ]; then
  57. if [ "${{ matrix.PYTHON_VERSION }}" = "2.7" ]; then
  58. conda install -q -y 'pyside2!=5.12.4' -c conda-forge
  59. else
  60. conda install -q -y pyside2 -c conda-forge
  61. fi
  62. elif [ "${{ matrix.PYTEST_QT_API }}" = "pyqt4v2" ]; then
  63. conda install -q -y pyqt=4 -c conda-forge
  64. else # pyqt5
  65. conda install -q -y pyqt=5
  66. fi
  67. if [ "${{ matrix.os }}" != "windows-latest" ]; then
  68. conda install -q -y help2man
  69. fi
  70. pip install hacking pytest pytest-qt
  71. - name: Install main
  72. shell: bash -l {0}
  73. run: |
  74. pip install .
  75. - name: Lint with flake8
  76. shell: bash -l {0}
  77. if: matrix.os != 'windows-latest'
  78. run: |
  79. flake8 .
  80. # - name: Black
  81. # shell: bash -l {0}
  82. # if: matrix.os != 'windows-latest' && matrix.python-version != '2.7'
  83. # run: |
  84. # pip install black
  85. # black --check .
  86. - name: Test with pytest
  87. shell: bash -l {0}
  88. if: matrix.os != 'windows-latest'
  89. env:
  90. PYTEST_QT_API: ${{ matrix.PYTEST_QT_API }}
  91. run: |
  92. # open virtual display
  93. if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
  94. export DISPLAY=:99.0
  95. /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX +render -noreset
  96. (herbstluftwm )&
  97. else
  98. (sudo Xvfb :99 -ac -screen 0 1024x768x8 )&
  99. fi
  100. # run test
  101. MPLBACKEND='agg' pytest tests -m 'not gpu'
  102. - name: Run examples
  103. shell: bash -l {0}
  104. if: matrix.os != 'windows-latest'
  105. env:
  106. MPLBACKEND: agg
  107. run: |
  108. labelme --help
  109. labelme --version
  110. (cd examples/primitives && labelme_json_to_dataset primitives.json && rm -rf primitives_json)
  111. (cd examples/tutorial && rm -rf apc2016_obj3_json && labelme_json_to_dataset apc2016_obj3.json && python load_label_png.py && git checkout -- .)
  112. (cd examples/semantic_segmentation && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  113. (cd examples/instance_segmentation && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  114. (cd examples/video_annotation && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  115. pip install lxml # for bbox_detection/labelme2voc.py
  116. (cd examples/bbox_detection && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  117. pip install cython && pip install pycocotools # for instance_segmentation/labelme2coco.py
  118. (cd examples/instance_segmentation && rm -rf data_dataset_coco && ./labelme2coco.py data_annotated data_dataset_coco --labels labels.txt && git checkout -- .)
  119. - name: Run pyinstaller
  120. shell: bash -l {0}
  121. if: matrix.PYTEST_QT_API == 'pyqt5' && matrix.python-version == '3.7'
  122. run: |
  123. # Build the standalone executable
  124. pip install 'pyinstaller!=3.4'
  125. pip install 'setuptools<45.0.0'
  126. pyinstaller labelme.spec
  127. dist/labelme --version