Repository: OpenMined/PySyft

Issue:
Add Windows to CI
## Description
Add windows to the CI tests as a separate step for say python 3.8 and torch==1.6.0 initially just to get things working. Then if it works expand to all versions to see any potential issues.

## Definition of Done
This ticket is done when we know what does and doesn't run on Windows in CI from the current "fast" tests and the new "slow" tests. Post a screenshot and link to CI here when it's running.


Discussion:

Resolving patch:
diff --git a/src/syft/lib/torch/__init__.py b/src/syft/lib/torch/__init__.py
--- a/src/syft/lib/torch/__init__.py
+++ b/src/syft/lib/torch/__init__.py
@@ -12,7 +12,7 @@
 from ...ast.globals import Globals
 from .allowlist import allowlist
 
-TORCH_VERSION = version.parse(torch.__version__)
+TORCH_VERSION = version.parse(torch.__version__.split("+")[0])
 
 
 def get_return_type(support_dict: Union[str, Dict[str, str]]) -> str:


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -8,19 +8,21 @@ on:
     paths:
       - "**.py"
       - "setup.cfg"
+      - ".github/workflows/tests.yml"
 
   pull_request:
     types: [opened, synchronize, reopened]
     paths:
       - "**.py"
       - "setup.cfg"
+      - ".github/workflows/tests.yml"
 
 jobs:
   python-tests:
     strategy:
       max-parallel: 24
       matrix:
-        os: [ubuntu-latest, macos-latest]
+        os: [ubuntu-latest, macos-latest, windows-latest]
         python-version: [3.8, 3.7, 3.6]
         torch-version: [1.5.0, 1.5.1, 1.6.0]
 
@@ -49,6 +51,14 @@ jobs:
           restore-keys: |
             ${{ runner.os }}-pip-${{ matrix.python-version }}-
 
+      - uses: actions/cache@v2
+        if: startsWith(runner.os, 'Windows')
+        with:
+          path: '%LOCALAPPDATA%\pip\Cache'
+          key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
+          restore-keys: |
+            ${{ runner.os }}-pip-${{ matrix.python-version }}-
+
       - name: Cache packages
         uses: actions/cache@v2
         id: cache-reqs
@@ -61,7 +71,8 @@ jobs:
           pip install bandit
           bandit -r src -ll
 
-      - name: Run normal tests without coverage
+      - name: Install pytorch Linux/MacOS
+        if: startsWith(runner.os, 'Windows') != true
         env:
           TORCH_VERSION: ${{ matrix.torch-version }}
         run: |
@@ -75,8 +86,25 @@ jobs:
           then
               TORCHVISION_VERSION="0.7"
           fi
-          pip install torch==$TORCH_VERSION
+          pip install torch==${TORCH_VERSION}
           pip install torchvision==${TORCHVISION_VERSION}
+
+      - name: Install pytorch Windows
+        if: startsWith(runner.os, 'Windows')
+        env:
+          TORCH_VERSION: ${{ matrix.torch-version }}
+        run: |
+          If ($env:TORCH_VERSION -eq "1.5.0") {
+              $env:TORCHVISION_VERSION="0.6.0"
+          } Elseif ( $env:TORCH_VERSION -eq "1.5.1" ) {
+              $env:TORCHVISION_VERSION="0.6.1"
+          } Elseif ($env:TORCH_VERSION -eq "1.6.0") {
+              $env:TORCHVISION_VERSION="0.7"
+          }
+          pip install torch==$env:TORCH_VERSION+cpu torchvision==$env:TORCHVISION_VERSION+cpu -f https://download.pytorch.org/whl/torch_stable.html
+
+      - name: Run normal tests without coverage
+        run: |
           pip install -r requirements.txt
           pip install -e .
           pip freeze | grep torch
@@ -105,14 +133,6 @@ jobs:
           restore-keys: |
             ${{ runner.os }}-pip-${{ matrix.python-version }}-
 
-      - uses: actions/cache@v2
-        if: startsWith(runner.os, 'macOS')
-        with:
-          path: ~/Library/Caches/pip
-          key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
-          restore-keys: |
-            ${{ runner.os }}-pip-${{ matrix.python-version }}-
-
       - name: Cache packages
         uses: actions/cache@v2
         id: cache-reqs
@@ -150,21 +170,12 @@ jobs:
           python-version: ${{ matrix.python-version }}
 
       - uses: actions/cache@v2
-        if: startsWith(runner.os, 'Linux')
         with:
           path: ~/.cache/pip
           key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
           restore-keys: |
             ${{ runner.os }}-pip-${{ matrix.python-version }}-
 
-      - uses: actions/cache@v2
-        if: startsWith(runner.os, 'macOS')
-        with:
-          path: ~/Library/Caches/pip
-          key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
-          restore-keys: |
-            ${{ runner.os }}-pip-${{ matrix.python-version }}-
-
       - name: Cache packages
         uses: actions/cache@v2
         id: cache-reqs
@@ -183,7 +194,7 @@ jobs:
     strategy:
       max-parallel: 24
       matrix:
-        os: [ubuntu-latest, macos-latest]
+        os: [ubuntu-latest, macos-latest, windows-latest]
         python-version: [3.8, 3.7, 3.6]
         torch-version: [1.5.0, 1.5.1, 1.6.0]
 
diff --git a/tests/syft/grid/connections/webrtc_test.py b/tests/syft/grid/connections/webrtc_test.py
--- a/tests/syft/grid/connections/webrtc_test.py
+++ b/tests/syft/grid/connections/webrtc_test.py
@@ -20,7 +20,8 @@ def get_signing_key() -> SigningKey:
     return SigningKey(bytes.fromhex(key))
 
 
-def test_init_without_event_loop() -> None:
+@pytest.mark.asyncio
+async def test_init_without_event_loop() -> None:
     nest_asyncio.apply()
 
     domain = Domain(name="test")
diff --git a/tests/syft/lib/allowlist_report.py b/tests/syft/lib/allowlist_report.py
--- a/tests/syft/lib/allowlist_report.py
+++ b/tests/syft/lib/allowlist_report.py
@@ -25,7 +25,7 @@
 # syft absolute
 from syft.lib.torch import allowlist  # noqa: E402
 
-TORCH_VERSION = version.parse(th.__version__)
+TORCH_VERSION = version.parse(th.__version__.split("+")[0])
 py_ver = sys.version_info
 PYTHON_VERSION = version.parse(f"{py_ver.major}.{py_ver.minor}")
 OS_NAME = platform.system().lower()
diff --git a/tests/syft/lib/allowlist_test.py b/tests/syft/lib/allowlist_test.py
--- a/tests/syft/lib/allowlist_test.py
+++ b/tests/syft/lib/allowlist_test.py
@@ -33,7 +33,7 @@
 from syft.lib.torch.tensor_util import TORCH_STR_DTYPE
 from syft.lib.util import full_name_with_qualname
 
-TORCH_VERSION = version.parse(th.__version__)
+TORCH_VERSION = version.parse(th.__version__.split("+")[0])
 py_ver = sys.version_info
 PYTHON_VERSION = version.parse(f"{py_ver.major}.{py_ver.minor}")
 OS_NAME = platform.system().lower()