main.yml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. name: CI
  2. on: [push]
  3. jobs:
  4. build:
  5. runs-on: ${{ matrix.os }}
  6. strategy:
  7. matrix:
  8. os: [macOS-latest, ubuntu-latest]
  9. PYTEST_QT_API: [pyqt5, pyqt4v2, pyside2]
  10. PYTHON_VERSION: ['2.7', '3.6']
  11. exclude:
  12. - os: macOS-latest
  13. PYTEST_QT_API: pyqt4v2
  14. - os: macOS-latest
  15. PYTEST_QT_API: pyside2
  16. - PYTHON_VERSION: '3.6'
  17. PYTEST_QT_API: pyqt4v2
  18. steps:
  19. - uses: actions/checkout@v1
  20. - name: Update submodules
  21. run: |
  22. git submodule update --init --recursive
  23. - name: Install system dependencies
  24. run: |
  25. if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
  26. sudo apt-get install -y coreutils
  27. sudo apt-get install -y xvfb herbstluftwm
  28. else
  29. brew install coreutils
  30. brew cask install xquartz
  31. fi
  32. - name: Set up Miniconda
  33. run: |
  34. if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
  35. curl -L -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
  36. else
  37. curl -L -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
  38. fi
  39. bash miniconda.sh -b -p $HOME/miniconda
  40. rm -f miniconda.sh
  41. export PATH="$HOME/miniconda/bin:$PATH"
  42. conda config --set always_yes yes --set changeps1 no
  43. conda update -q conda
  44. conda info -a
  45. - name: Set up Python
  46. env:
  47. PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
  48. run: |
  49. export PATH="$HOME/miniconda/bin:$PATH"
  50. conda install -y python=$PYTHON_VERSION
  51. which python
  52. python --version
  53. pip --version
  54. - name: Install dependencies
  55. run: |
  56. export PATH="$HOME/miniconda/bin:$PATH"
  57. if [ "${{ matrix.PYTEST_QT_API }}" = "pyside2" ]; then
  58. if [ "${{ matrix.PYTHON_VERSION }}" = "2.7" ]; then
  59. conda install -y 'pyside2!=5.12.4' -c conda-forge
  60. else
  61. conda install -y pyside2 -c conda-forge
  62. fi
  63. elif [ "${{ matrix.PYTEST_QT_API }}" = "pyqt4v2" ]; then
  64. conda install -y pyqt=4 -c conda-forge
  65. else # pyqt5
  66. conda install -y pyqt=5
  67. fi
  68. conda install -y help2man
  69. pip install flake8 pytest pytest-qt
  70. - name: Install main
  71. run: |
  72. export PATH="$HOME/miniconda/bin:$PATH"
  73. pip install .
  74. - name: Lint with flake8
  75. run: |
  76. export PATH="$HOME/miniconda/bin:$PATH"
  77. flake8 .
  78. - name: Test with pytest
  79. env:
  80. PYTEST_QT_API: ${{ matrix.PYTEST_QT_API }}
  81. run: |
  82. # open virtual display
  83. if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
  84. export DISPLAY=:99.0
  85. /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
  86. (herbstluftwm )&
  87. else
  88. (sudo Xvfb :99 -ac -screen 0 1024x768x8 )&
  89. fi
  90. # run test
  91. export PATH="$HOME/miniconda/bin:$PATH"
  92. MPLBACKEND='agg' pytest tests -m 'not gpu'
  93. - name: Run examples
  94. env:
  95. MPLBACKEND: agg
  96. run: |
  97. export PATH="$HOME/miniconda/bin:$PATH"
  98. labelme --help
  99. labelme --version
  100. (cd examples/primitives && labelme_json_to_dataset primitives.json && rm -rf primitives_json)
  101. (cd examples/tutorial && rm -rf apc2016_obj3_json && labelme_json_to_dataset apc2016_obj3.json && python load_label_png.py && git checkout -- .)
  102. (cd examples/semantic_segmentation && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  103. (cd examples/instance_segmentation && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  104. (cd examples/video_annotation && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  105. pip install lxml # for bbox_detection/labelme2voc.py
  106. (cd examples/bbox_detection && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  107. pip install cython && pip install pycocotools # for instance_segmentation/labelme2coco.py
  108. (cd examples/instance_segmentation && rm -rf data_dataset_coco && ./labelme2coco.py data_annotated data_dataset_coco --labels labels.txt && git checkout -- .)
  109. - name: Run pyinstaller
  110. run: |
  111. if [ "${{ matrix.PYTEST_QT_API }}" = "pyqt5" -a "${{ matrix.PYTHON_VERSION }}" = "3.6" ]; then
  112. export PATH="$HOME/miniconda/bin:$PATH"
  113. # # Cleanup
  114. # pip uninstall -y $PIP_DEPENDENCIES
  115. # # https://github.com/wkentaro/labelme/issues/183
  116. # if [ $TRAVIS_OS_NAME = "osx" ]; then
  117. # pip uninstall -y Pillow
  118. # conda install -y Pillow
  119. # fi
  120. # Build the standalone executable
  121. pip install 'pyinstaller!=3.4' # 3.4 raises error
  122. # # numpy 1.17 raises error
  123. # # See https://github.com/wkentaro/labelme/issues/465
  124. # pip install 'numpy<1.17'
  125. pyinstaller labelme.spec
  126. dist/labelme --version
  127. fi