Procházet zdrojové kódy

Enable Windows CI tests

Before now, the windows tests were not actually running. This converts
the tests to powershell and makes sure they are running. It also adds a
few nice things like debug output in the run, etc.
Jason Grout před 4 roky
rodič
revize
6a072602a7

+ 10 - 9
.github/workflows/windowstests.yml

@@ -21,11 +21,11 @@ jobs:
         with:
           node-version: '12.x'
       - name: Cache pip on Windows
-        uses: actions/cache@v1
+        uses: actions/cache@v2
         if: startsWith(runner.os, 'Windows')
         with:
           path: ~\AppData\Local\pip\Cache
-          key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', 'setup.py') }}
+          key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', 'setup.py') }}-2
           restore-keys: |
             ${{ runner.os }}-pip-
 
@@ -34,25 +34,26 @@ jobs:
         id: yarn-cache-dir-path
         run: echo "::set-output name=dir::$(yarn cache dir)"
       - name: Cache yarn
-        uses: actions/cache@v1
+        uses: actions/cache@v2
         id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
         with:
           path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
-          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
+          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-2
           restore-keys: |
             ${{ runner.os }}-yarn-
 
       - name: Enable long paths
-        run: powershell Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem -Name LongPathsEnabled -Value 1
+        run: Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem -Name LongPathsEnabled -Value 1
+        shell: pwsh
 
       - name: Install dependencies
         env:
           GROUP: ${{ matrix.group }}
-        run: |
-          cmd .\scripts\ci_install.bat
+        run: .\scripts\ci_install
+        shell: pwsh
 
       - name: Run test ${{ matrix.group }}
         env:
           GROUP: ${{ matrix.group }}
-        run: |
-          cmd .\scripts\ci_script.bat
+        run: .\scripts\ci_script
+        shell: pwsh

+ 0 - 21
scripts/ci_install.bat

@@ -1,21 +0,0 @@
-REM create jupyter base dir (needed for config retrieval)
-mkdir %USERPROFILE%\.jupyter
-
-REM Install and enable the server extension
-pip install -q --upgrade pip --user
-pip --version
-pip install jupyter_packaging
-REM Show a verbose install if the install fails, for debugging
-pip install -e ".[test]" || pip install -v -e ".[test]"
-jlpm versions
-jlpm config current
-jupyter server extension enable jupyterlab
-REM TODO: batch script grepping
-
-REM TODO: remove when we no longer support classic notebook
-jupyter serverextension enable jupyterlab
-REM TODO: batch script grepping
-
-IF "%GROUP%"=="integrity" (
-    pip install notebook==4.3.1
-)

+ 46 - 0
scripts/ci_install.ps1

@@ -0,0 +1,46 @@
+# Copyright (c) Jupyter Development Team.
+# Distributed under the terms of the Modified BSD License.
+
+$ErrorActionPreference = 'stop'
+
+# create jupyter base dir (needed for config retrieval)
+New-Item -Path $Env:USERPROFILE\.jupyter -ItemType "directory" -Force
+
+# Install and enable the server extension
+pip install -q --upgrade pip --user
+if ($LASTEXITCODE -ne 0) { throw "Command failed. See above errors for details" }
+
+pip --version
+if ($LASTEXITCODE -ne 0) { throw "Command failed. See above errors for details" }
+
+pip install jupyter_packaging
+if ($LASTEXITCODE -ne 0) { throw "Command failed. See above errors for details" }
+
+# Show a verbose install if the install fails, for debugging
+pip install -e ".[test]" || pip install -v -e ".[test]"
+if ($LASTEXITCODE -ne 0) { throw "Command failed. See above errors for details" }
+
+jlpm versions
+if ($LASTEXITCODE -ne 0) { throw "Command failed. See above errors for details" }
+
+jlpm config current
+if ($LASTEXITCODE -ne 0) { throw "Command failed. See above errors for details" }
+
+jupyter lab path
+if ($LASTEXITCODE -ne 0) { throw "Command failed. See above errors for details" }
+
+jupyter server extension enable jupyterlab
+if ($LASTEXITCODE -ne 0) { throw "Command failed. See above errors for details" }
+# TODO: batch script grepping
+
+# TODO: remove when we no longer support classic notebook
+jupyter serverextension enable jupyterlab
+if ($LASTEXITCODE -ne 0) { throw "Command failed. See above errors for details" }
+# TODO: batch script grepping
+
+if ($Env:GROUP -eq "integrity") {
+    pip install notebook==4.3.1
+    if ($LASTEXITCODE -ne 0) { throw "Command failed. See above errors for details" }
+}
+
+if ((Test-Path -LiteralPath variable:\LASTEXITCODE)) { exit $LASTEXITCODE }

+ 0 - 21
scripts/ci_script.bat

@@ -1,21 +0,0 @@
-
-python -c "from jupyterlab.commands import build_check; build_check()"
-
-
-IF "%GROUP%"=="python" (
-    jupyter lab build --debug
-    REM Run the python tests
-    py.test
-)
-
-IF "%GROUP%"=="integrity" (
-    REM Run the integrity script first
-    jlpm run integrity --force
-
-    REM Check yarn.lock file
-    jlpm check --integrity
-
-    REM Run a browser check in dev mode
-    jlpm run build
-    python -m jupyterlab.browser_check --dev-mode
-)

+ 35 - 0
scripts/ci_script.ps1

@@ -0,0 +1,35 @@
+# Copyright (c) Jupyter Development Team.
+# Distributed under the terms of the Modified BSD License.
+
+$ErrorActionPreference = 'stop'
+
+python -c "from jupyterlab.commands import build_check; build_check()"
+if ($LASTEXITCODE -ne 0) { throw "Command failed. See above errors for details" }
+
+if ($Env:GROUP -eq "python") {
+    jupyter lab build --log-level=DEBUG
+    if ($LASTEXITCODE -ne 0) { throw "Command failed. See above errors for details" }
+
+    # Run the python tests
+    py.test
+    if ($LASTEXITCODE -ne 0) { throw "Command failed. See above errors for details" }
+}
+
+if ($Env:GROUP -eq "integrity") {
+    # Run the integrity script first
+    jlpm run integrity --force
+    if ($LASTEXITCODE -ne 0) { throw "Command failed. See above errors for details" }
+
+    # Check yarn.lock file
+    jlpm check --integrity
+    if ($LASTEXITCODE -ne 0) { throw "Command failed. See above errors for details" }
+
+    # Run a browser check in dev mode
+    jlpm run build
+    if ($LASTEXITCODE -ne 0) { throw "Command failed. See above errors for details" }
+
+    python -m jupyterlab.browser_check --dev-mode
+    if ($LASTEXITCODE -ne 0) { throw "Command failed. See above errors for details" }
+}
+
+if ((Test-Path -LiteralPath variable:\LASTEXITCODE)) { exit $LASTEXITCODE }

+ 1 - 1
scripts/ci_script.sh

@@ -12,7 +12,7 @@ fi
 
 
 if [[ $GROUP == python ]]; then
-    jupyter lab build --debug
+    jupyter lab build --log-level=DEBUG
     # Run the python tests
     py.test
 fi