ci.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 labelme/
  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 == 'ubuntu-latest'
  67. env:
  68. PYTEST_QT_API: ${{ matrix.PYTEST_QT_API }}
  69. MPLBACKEND: 'agg'
  70. run: |
  71. sudo apt-get update
  72. sudo apt-get install -y xvfb libqt5widgets5
  73. Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
  74. export DISPLAY=:99
  75. pytest tests
  76. - name: Run examples
  77. shell: bash -l {0}
  78. if: matrix.os != 'windows-latest'
  79. env:
  80. MPLBACKEND: agg
  81. run: |
  82. labelme --help
  83. labelme --version
  84. (cd examples/primitives && labelme_json_to_dataset primitives.json && rm -rf primitives_json)
  85. (cd examples/tutorial && rm -rf apc2016_obj3_json && labelme_json_to_dataset apc2016_obj3.json && python load_label_png.py && git checkout -- .)
  86. (cd examples/semantic_segmentation && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  87. (cd examples/instance_segmentation && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  88. (cd examples/video_annotation && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  89. pip install lxml # for bbox_detection/labelme2voc.py
  90. (cd examples/bbox_detection && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
  91. pip install cython && pip install pycocotools # for instance_segmentation/labelme2coco.py
  92. (cd examples/instance_segmentation && rm -rf data_dataset_coco && ./labelme2coco.py data_annotated data_dataset_coco --labels labels.txt && git checkout -- .)
  93. - name: Run pyinstaller
  94. shell: bash -l {0}
  95. if: matrix.PYTEST_QT_API == 'pyqt5'
  96. run: |
  97. # Build the standalone executable
  98. pip install pyinstaller
  99. pyinstaller labelme.spec
  100. dist/labelme --version