ci.yml 3.6 KB

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