Jelajahi Sumber

Add windows to CI

Kentaro Wada 5 tahun lalu
induk
melakukan
739042f74d
1 mengubah file dengan 32 tambahan dan 30 penghapusan
  1. 32 30
      .github/workflows/main.yml

+ 32 - 30
.github/workflows/main.yml

@@ -12,61 +12,58 @@ jobs:
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
-        os: [macOS-latest, ubuntu-latest]
+        os: [macos-latest, ubuntu-latest, windows-latest]
+        python-version: ['3.7', '2.7']
         PYTEST_QT_API: [pyqt5, pyqt4v2, pyside2]
-        PYTHON_VERSION: ['2.7', '3.6']
         exclude:
-          - os: macOS-latest
+          - os: macos-latest
             PYTEST_QT_API: pyqt4v2
-          - os: macOS-latest
+          - os: macos-latest
             PYTEST_QT_API: pyside2
-          - PYTHON_VERSION: '3.6'
-            PYTEST_QT_API:  pyqt4v2
+          - os: windows-latest
+            PYTEST_QT_API: pyqt4v2
+          - os: windows-latest
+            PYTEST_QT_API: pyside2
+          - python-version: '3.7'
+            PYTEST_QT_API: pyqt4v2
 
     steps:
     - uses: actions/checkout@v1
 
+    - uses: goanpeca/setup-miniconda@v1
+      with:
+        auto-update-conda: true
+        python-version: ${{ matrix.python-version }}
+
     - name: Update submodules
+      shell: bash -l {0}
       run: |
         git submodule update --init --recursive
 
     - name: Install system dependencies
+      shell: bash -l {0}
       run: |
         if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
           sudo apt-get install -y coreutils
           sudo apt-get install -y xvfb herbstluftwm
-        else
+        elif [ "${{ matrix.os }}" = "macos-latest" ]; then
           brew install coreutils
           brew cask install xquartz
         fi
 
-    - name: Set up Miniconda
-      run: |
-        if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
-          curl -L -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
-        else
-          curl -L -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
-        fi
-        bash miniconda.sh -b -p $HOME/miniconda
-        rm -f miniconda.sh
-        export PATH="$HOME/miniconda/bin:$PATH"
-        conda config --set always_yes yes --set changeps1 no
-        conda update -q conda
-        conda info -a
-
     - name: Set up Python
+      shell: bash -l {0}
       env:
         PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
       run: |
-        export PATH="$HOME/miniconda/bin:$PATH"
         conda install -y python=$PYTHON_VERSION
         which python
         python --version
         pip --version
 
     - name: Install dependencies
+      shell: bash -l {0}
       run: |
-        export PATH="$HOME/miniconda/bin:$PATH"
         if [ "${{ matrix.PYTEST_QT_API }}" = "pyside2" ]; then
           if [ "${{ matrix.PYTHON_VERSION }}" = "2.7" ]; then
             conda install -y 'pyside2!=5.12.4' -c conda-forge
@@ -78,20 +75,25 @@ jobs:
         else  # pyqt5
           conda install -y pyqt=5
         fi
-        conda install -y help2man
+        if [ "${{ matrix.os }}" != "windows-latest" ]; then
+          conda install -y help2man
+        fi
         pip install flake8 pytest pytest-qt
 
     - name: Install main
+      shell: bash -l {0}
       run: |
-        export PATH="$HOME/miniconda/bin:$PATH"
         pip install .
 
     - name: Lint with flake8
+      shell: bash -l {0}
+      if: matrix.os != 'windows-latest'
       run: |
-        export PATH="$HOME/miniconda/bin:$PATH"
         flake8 .
 
     - name: Test with pytest
+      shell: bash -l {0}
+      if: matrix.os != 'windows-latest'
       env:
         PYTEST_QT_API: ${{ matrix.PYTEST_QT_API }}
       run: |
@@ -104,15 +106,14 @@ jobs:
           (sudo Xvfb :99 -ac -screen 0 1024x768x8 )&
         fi
         # run test
-        export PATH="$HOME/miniconda/bin:$PATH"
         MPLBACKEND='agg' pytest tests -m 'not gpu'
 
     - name: Run examples
+      shell: bash -l {0}
+      if: matrix.os != 'windows-latest'
       env:
         MPLBACKEND: agg
       run: |
-        export PATH="$HOME/miniconda/bin:$PATH"
-
         labelme --help
         labelme --version
         (cd examples/primitives && labelme_json_to_dataset primitives.json && rm -rf primitives_json)
@@ -128,9 +129,10 @@ jobs:
         (cd examples/instance_segmentation && rm -rf data_dataset_coco && ./labelme2coco.py data_annotated data_dataset_coco --labels labels.txt && git checkout -- .)
 
     - name: Run pyinstaller
+      shell: bash -l {0}
+      if: matrix.os != 'windows-latest'
       run: |
         if [ "${{ matrix.PYTEST_QT_API }}" = "pyqt5" -a "${{ matrix.PYTHON_VERSION }}" = "3.6" ]; then
-          export PATH="$HOME/miniconda/bin:$PATH"
           # Build the standalone executable
           pip install 'pyinstaller!=3.4'
           pip install 'setuptools<45.0.0'