ci.yml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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@v1
  28. - uses: goanpeca/setup-miniconda@v1
  29. with:
  30. auto-update-conda: true
  31. python-version: ${{ matrix.python-version }}
  32. - name: Update submodules
  33. shell: bash -l {0}
  34. run: |
  35. git submodule update --init --recursive
  36. - name: Install system dependencies
  37. shell: bash -l {0}
  38. run: |
  39. if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
  40. sudo apt-get install -y coreutils
  41. sudo apt-get install -y xvfb herbstluftwm
  42. elif [ "${{ matrix.os }}" = "macos-latest" ]; then
  43. brew install coreutils
  44. brew cask install xquartz
  45. fi
  46. - name: Set up Python
  47. shell: bash -l {0}
  48. env:
  49. PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
  50. run: |
  51. conda install -y python=$PYTHON_VERSION
  52. which python
  53. python --version
  54. pip --version
  55. - name: Install dependencies
  56. shell: bash -l {0}
  57. run: |
  58. if [ "${{ matrix.PYTEST_QT_API }}" = "pyside2" ]; then
  59. if [ "${{ matrix.PYTHON_VERSION }}" = "2.7" ]; then
  60. conda install -y 'pyside2!=5.12.4' -c conda-forge
  61. else
  62. conda install -y pyside2 -c conda-forge
  63. fi
  64. elif [ "${{ matrix.PYTEST_QT_API }}" = "pyqt4v2" ]; then
  65. conda install -y pyqt=4 -c conda-forge
  66. else # pyqt5
  67. conda install -y pyqt=5
  68. fi
  69. if [ "${{ matrix.os }}" != "windows-latest" ]; then
  70. conda install -y help2man
  71. fi
  72. pip install flake8 pytest pytest-qt
  73. - name: Install main
  74. shell: bash -l {0}
  75. run: |
  76. pip install .
  77. - name: Lint with flake8
  78. shell: bash -l {0}
  79. if: matrix.os != 'windows-latest'
  80. run: |
  81. flake8 .
  82. - name: Test with pytest
  83. shell: bash -l {0}
  84. if: matrix.os != 'windows-latest'
  85. env:
  86. PYTEST_QT_API: ${{ matrix.PYTEST_QT_API }}
  87. run: |
  88. # open virtual display
  89. if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
  90. export DISPLAY=:99.0
  91. /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
  92. (herbstluftwm )&
  93. else
  94. (sudo Xvfb :99 -ac -screen 0 1024x768x8 )&
  95. fi
  96. # run test
  97. MPLBACKEND='agg' pytest tests -m 'not gpu'
  98. - name: Run examples
  99. shell: bash -l {0}
  100. if: matrix.os != 'windows-latest'
  101. env:
  102. MPLBACKEND: agg
  103. run: |
  104. labelme --help
  105. labelme --version
  106. (cd examples/primitives && labelme_json_to_dataset primitives.json && rm -rf primitives_json)
  107. (cd examples/tutorial && rm -rf apc2016_obj3_json && labelme_json_to_dataset apc2016_obj3.json && python load_label_png.py && git checkout -- .)
  108. (cd examples/semantic_segmentation && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  109. (cd examples/instance_segmentation && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  110. (cd examples/video_annotation && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  111. pip install lxml # for bbox_detection/labelme2voc.py
  112. (cd examples/bbox_detection && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  113. pip install cython && pip install pycocotools # for instance_segmentation/labelme2coco.py
  114. (cd examples/instance_segmentation && rm -rf data_dataset_coco && ./labelme2coco.py data_annotated data_dataset_coco --labels labels.txt && git checkout -- .)
  115. - name: Run pyinstaller
  116. shell: bash -l {0}
  117. if: matrix.PYTEST_QT_API == 'pyqt5' && matrix.python-version == '3.7'
  118. run: |
  119. # Build the standalone executable
  120. pip install 'pyinstaller!=3.4'
  121. pip install 'setuptools<45.0.0'
  122. pyinstaller labelme.spec
  123. dist/labelme --version