ci.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. name: ci
  2. on:
  3. push:
  4. branches:
  5. - main
  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.9']
  14. PYTEST_QT_API: [pyqt5, pyside2]
  15. steps:
  16. - uses: actions/checkout@v2
  17. with:
  18. submodules: true
  19. - uses: conda-incubator/setup-miniconda@v2
  20. with:
  21. auto-update-conda: true
  22. python-version: ${{ matrix.python-version }}
  23. # - name: Install system dependencies
  24. # shell: bash -l {0}
  25. # run: |
  26. # if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
  27. # sudo apt-get install -y coreutils
  28. # sudo apt-get install -y xvfb herbstluftwm
  29. # elif [ "${{ matrix.os }}" = "macos-latest" ]; then
  30. # brew install coreutils
  31. # brew install --cask xquartz
  32. # fi
  33. - name: Set up Python
  34. shell: bash -l {0}
  35. run: |
  36. conda install -q -y python=${{ matrix.python-version }}
  37. which python
  38. python --version
  39. pip --version
  40. - name: Install dependencies
  41. shell: bash -l {0}
  42. run: |
  43. if [ "${{ matrix.PYTEST_QT_API }}" = "pyside2" ]; then
  44. conda install -q -y pyside2 -c conda-forge
  45. # should be installed via pip
  46. # else
  47. # conda install -q -y pyqt=5
  48. fi
  49. pip install -r requirements-dev.txt
  50. - name: Install main
  51. shell: bash -l {0}
  52. run: |
  53. pip install .
  54. - name: Lint with flake8
  55. shell: bash -l {0}
  56. if: matrix.os != 'windows-latest'
  57. run: |
  58. flake8 .
  59. - name: Black
  60. shell: bash -l {0}
  61. if: matrix.os != 'windows-latest'
  62. run: |
  63. black --line-length 79 --check --diff labelme/
  64. - name: Test with pytest
  65. shell: bash -l {0}
  66. if: matrix.os != 'windows-latest' && !(matrix.os == 'macos-latest' && matrix.PYTEST_QT_API == 'pyside2')
  67. env:
  68. PYTEST_QT_API: ${{ matrix.PYTEST_QT_API }}
  69. MPLBACKEND: 'agg'
  70. run: |
  71. # # open virtual display
  72. # if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
  73. # export DISPLAY=:99.0
  74. # /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
  75. # (herbstluftwm )&
  76. # else
  77. # (sudo Xvfb :99 -ac -screen 0 1024x768x8 )&
  78. # fi
  79. pytest -vs -m 'not gui' tests/
  80. - name: Run examples
  81. shell: bash -l {0}
  82. if: matrix.os != 'windows-latest'
  83. env:
  84. MPLBACKEND: agg
  85. run: |
  86. labelme --help
  87. labelme --version
  88. (cd examples/primitives && labelme_json_to_dataset primitives.json && rm -rf primitives_json)
  89. (cd examples/tutorial && rm -rf apc2016_obj3_json && labelme_json_to_dataset apc2016_obj3.json && python load_label_png.py && git checkout -- .)
  90. (cd examples/semantic_segmentation && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  91. (cd examples/instance_segmentation && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  92. (cd examples/video_annotation && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  93. pip install lxml # for bbox_detection/labelme2voc.py
  94. (cd examples/bbox_detection && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  95. pip install cython && pip install pycocotools # for instance_segmentation/labelme2coco.py
  96. (cd examples/instance_segmentation && rm -rf data_dataset_coco && ./labelme2coco.py data_annotated data_dataset_coco --labels labels.txt && git checkout -- .)
  97. - name: Run pyinstaller
  98. shell: bash -l {0}
  99. if: matrix.PYTEST_QT_API == 'pyqt5'
  100. run: |
  101. # Build the standalone executable
  102. pip install pyinstaller
  103. pyinstaller labelme.spec
  104. dist/labelme --version