diff --git a/azure-pipelines.yml b/azure-pipelines.yml index def9b666ff78..c7df997bcf92 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,6 +17,8 @@ jobs: testResultsFiles: 'junit.xml' Usage: group: 'usage' + UsageNoNodeJS: + group: 'nonode' Docs: group: 'docs' diff --git a/jupyterlab/browser_check.py b/jupyterlab/browser_check.py index ed7ef4beda28..5e5be9e48b46 100644 --- a/jupyterlab/browser_check.py +++ b/jupyterlab/browser_check.py @@ -103,6 +103,18 @@ def finished(future): IOLoop.current().add_future(future, finished) +def run_browser(url): + """Run the browser test and return an exit code. + """ + target = osp.join(get_app_dir(), 'browser_test') + if not osp.exists(osp.join(target, 'node_modules')): + os.makedirs(target) + subprocess.call(["jlpm"], cwd=target) + subprocess.call(["jlpm", "add", "puppeteer"], cwd=target) + shutil.copy(osp.join(here, 'chrome-test.js'), osp.join(target, 'chrome-test.js')) + return subprocess.check_call(["node", "chrome-test.js", url], cwd=target) + + class BrowserApp(LabApp): """An app the launches JupyterLab and waits for it to start up, checking for JS console errors, JS errors, and Python logged errors. @@ -112,27 +124,20 @@ class BrowserApp(LabApp): ip = '127.0.0.1' flags = test_flags aliases = test_aliases + test_browser = True def start(self): web_app = self.web_app web_app.settings.setdefault('page_config_data', dict()) web_app.settings['page_config_data']['browserTest'] = True web_app.settings['page_config_data']['buildAvailable'] = False - run_test(self, run_browser) + run_test(self, run_browser if self.test_browser else lambda url: 0) super().start() -def run_browser(url): - """Run the browser test and return an exit code. - """ - target = osp.join(get_app_dir(), 'browser_test') - if not osp.exists(osp.join(target, 'node_modules')): - os.makedirs(target) - subprocess.call(["jlpm"], cwd=target) - subprocess.call(["jlpm", "add", "puppeteer"], cwd=target) - shutil.copy(osp.join(here, 'chrome-test.js'), osp.join(target, 'chrome-test.js')) - return subprocess.check_call(["node", "chrome-test.js", url], cwd=target) - - if __name__ == '__main__': + skip_option = "--no-chrome-test" + if skip_option in sys.argv: + BrowserApp.test_browser = False + sys.argv.remove(skip_option) BrowserApp.launch_instance() diff --git a/scripts/ci_install.sh b/scripts/ci_install.sh index 3fe8ff026611..a7b669da776a 100644 --- a/scripts/ci_install.sh +++ b/scripts/ci_install.sh @@ -24,3 +24,13 @@ jupyter serverextension enable --py jupyterlab if [[ $GROUP == integrity ]]; then pip install notebook==4.3.1 fi + +if [[ $GROUP == nonode ]]; then + # Build the wheel + pip install wheel + python setup.py bdist_wheel + + # Remove NodeJS + sudo rm -rf $(which node) + ! node +fi diff --git a/scripts/ci_script.sh b/scripts/ci_script.sh index 19219c0d6812..89bd038977d2 100644 --- a/scripts/ci_script.sh +++ b/scripts/ci_script.sh @@ -6,7 +6,9 @@ set -ex set -o pipefail -python -c "from jupyterlab.commands import build_check; build_check()" +if [[ $GROUP != nonode ]]; then + python -c "from jupyterlab.commands import build_check; build_check()" +fi if [[ $GROUP == python ]]; then @@ -229,3 +231,20 @@ if [[ $GROUP == usage ]]; then kill $TASK_PID wait $TASK_PID fi + +if [[ $GROUP == nonode ]]; then + # Make sure we can install the wheel + virtualenv -p $(which python3) test_install + ./test_install/bin/pip install -v --pre --no-cache-dir --no-deps jupyterlab --no-index --find-links=dist # Install latest jupyterlab + ./test_install/bin/pip install jupyterlab # Install jupyterlab dependencies + ./test_install/bin/python -m jupyterlab.browser_check --no-chrome-test + + # Make sure we can start and kill the lab server + ./test_install/bin/jupyter lab --no-browser & + TASK_PID=$! + # Make sure the task is running + ps -p $TASK_PID || exit 1 + sleep 5 + kill $TASK_PID + wait $TASK_PID +fi