diff --git a/.github/workflows/job.lint.yml b/.github/workflows/job.lint.yml new file mode 100644 index 000000000..ed86e34fb --- /dev/null +++ b/.github/workflows/job.lint.yml @@ -0,0 +1,61 @@ +name: lint +on: + push: + branches: + - master + pull_request: + branches: + - master + +defaults: + run: + shell: bash -l {0} + +jobs: + lint: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-16.04] + python: [3.8] + nodejs: ['>=12,<13.0.0a0'] + lab: ['>=2,<3.0.0a0'] + steps: + - uses: actions/checkout@v2 + + - uses: cschleiden/replace-tokens@v1 + with: + tokenPrefix: '{' + tokenSuffix: '}' + files: '["requirements/github-actions.yml"]' + env: + lab: '${{ matrix.lab }}' + nodejs: '${{ matrix.nodejs }}' + + - name: Set up Python and conda + uses: goanpeca/setup-miniconda@v1 + with: + python-version: ${{ matrix.python }} + channels: conda-forge, defaults + channel-priority: true + activate-environment: jupyterlab-lsp + environment-file: requirements/github-actions.yml + auto-update-conda: true + + - name: linting dependencies + run: conda env update -n jupyterlab-lsp --file requirements/lint.yml --quiet + + - name: check integrity of package versions + run: python scripts/integrity.py + + - name: install npm dependencies + run: jlpm + + - name: lint backend + run: python scripts/lint.py + + - name: build schema so linting can complete + run: jlpm build:schema + + - name: lint frontend + run: jlpm lint:check diff --git a/.github/workflows/job.test.yml b/.github/workflows/job.test.yml new file mode 100644 index 000000000..fb0b635bb --- /dev/null +++ b/.github/workflows/job.test.yml @@ -0,0 +1,207 @@ +name: tests +on: + push: + branches: + - master + pull_request: + branches: + - master + +defaults: + run: + shell: bash -l {0} + +env: + # TODO extract these from files instead + PY_JLSP_VERSION: 0.9.2 + JS_JLLSP_VERSION: 2.0.2 + JS_JLG2D_VERSION: 1.0.0 + + PYTHONUNBUFFERED: 1 + ATEST_RETRIES: 3 + + LINKED_EXTENSIONS: >- + packages/lsp-ws-connection + packages/jupyterlab-go-to-definition + packages/completion-theme + packages/theme-vscode + packages/theme-material + +jobs: + acceptance: + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }}, Python ${{ matrix.python }}, Node ${{ matrix.nodejs }} + strategy: + matrix: + python: [3.6, 3.7, 3.8] + os: [ubuntu-16.04, macos-10.14, vs2017-win2016] + lab: ['>=2.2.0,<3.0.0a0'] + include: + # if using 3.6, use an old node + - python: 3.6 + # Node 10 end-of-life: April 2021 + nodejs: '>=10,<11.0.0.a0' + # if using 3.7, use newer node, etc... + - python: 3.7 + # Node 12 end-of-life: April 2022 + nodejs: '>=12,<13.0.0.a0' + - python: 3.8 + # Node 14 end-of-life: April 2023 + nodejs: '>=14,<15.0.0.a0' + + steps: + - uses: actions/checkout@v2 + + - name: Set JupyterLab and Node versions + uses: cschleiden/replace-tokens@v1 + with: + tokenPrefix: '{' + tokenSuffix: '}' + files: '["requirements/github-actions.yml"]' + env: + lab: '${{ matrix.lab }}' + nodejs: '${{ matrix.nodejs }}' + + - name: Cache conda + uses: actions/cache@v1 + env: + # Increase this value to reset cache if requirements/github-actions.yml has not changed + CACHE_NUMBER: 0 + with: + path: ~/conda_pkgs_dir + key: ${{ matrix.os }}-${{ matrix.python }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements/github-actions.yml') }} + + - name: Set up Python and conda + uses: goanpeca/setup-miniconda@v1 + with: + python-version: ${{ matrix.python }} + channels: conda-forge, defaults + channel-priority: true + auto-activate-base: true + activate-environment: jupyterlab-lsp + environment-file: requirements/github-actions.yml + auto-update-conda: true + use-only-tar-bz2: true # needs to be set for caching to work properly + + - name: Install pip dependencies + run: pip install pytest-github-actions-annotate-failures + + - name: Describe conda + shell: bash -l {0} + run: | + conda info + conda list + conda config --show-sources + conda config --show + printenv | sort + + - name: Cache yarn + uses: actions/cache@v1 + with: + path: .yarn-packages + key: yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + restore-keys: | + yarn-${{ runner.os }}- + yarn- + + - name: Install npm dependencies + run: jlpm + + - name: Build the extension + run: jlpm build + + - name: Build python distributions + run: python setup.py sdist bdist_wheel + + - name: Build npm bundles + run: jlpm lerna run bundle + + - name: Install python wheel + run: cd dist && python -m pip install jupyter_lsp-${{ env.PY_JLSP_VERSION }}-py3-none-any.whl --no-deps + + - name: Find out jedi cache location + run: python -c 'import jedi; print("::set-env name=JEDI_CACHE_DIR::" + jedi.settings.cache_directory)' + + - name: Cache jedi cache + uses: actions/cache@v1 + with: + path: ${{ env.JEDI_CACHE_DIR }} + key: jedi-${{ matrix.os }}-${{ hashFiles('scripts/jedi_cache.py') }}-${{ hashFiles('requirements/github-actions.yml') }} + + - name: Warm up jedi cache + run: python scripts/jedi_cache.py + + - name: Cache tectonic cache + uses: actions/cache@v2 + with: + # locations for: Linux, MacOS, Windows + path: | + ~/.cache/Tectonic + ~/Library/Caches/Tectonic + %LOCALAPPDATA%/TectonicProject/Tectonic + key: ${{ runner.os }}-${{ hashFiles('scripts/tectonic_cache.py') }} + + - name: Warm up tectonic cache + run: python scripts/tectonic_cache.py + + - name: Run frontend unit tests + run: jlpm test + + # js_cov_packages: + # - jupyterlab-go-to-definition + # - jupyterlab-lsp + + #- task: PublishTestResults@2 + # name: publish frontend test results + # inputs: + # testResultsFiles: packages/**/junit.xml + # testRunTitle: 'Jest ${{ env.name }}${{ python.name }}' + # mergeTestResults: true + # condition: always() + + #- ${{ each js_package in parameters.js_cov_packages }}: + # - task: PublishCodeCoverageResults@1 + # name: 'publish ${{ js_package }} coverage' + # inputs: + # codeCoverageTool: Cobertura + # summaryFileLocation: 'packages/${{ js_package }}/coverage/cobertura-coverage.xml' + # condition: always() + + - name: List server extensions + run: jupyter serverextension list + + - name: Run python tests + run: python scripts/utest.py + + - name: Install support packages + run: jupyter labextension link --debug --no-build ${{ env.LINKED_EXTENSIONS }} + + - name: Install labextensions + run: jupyter labextension install --debug --no-build packages/jupyterlab-lsp/krassowski-jupyterlab-lsp-${{ env.JS_JLLSP_VERSION }}.tgz + + - name: List labextensions before build + run: jupyter labextension list + + - name: Build lab + run: jupyter lab build --debug --dev-build=False --minimize=True + + - name: List labextensions after build + run: jupyter labextension list + + - name: Run browser tests + run: python scripts/atest.py --exclude expect:fail + + #- task: PublishTestResults@2 + # name: publish browser test results + # inputs: + # testResultsFiles: atest/output/*.xunit.xml + # testRunTitle: 'Robot ${{ env.name }}${{ python.name }}' + # mergeTestResults: true + # condition: always() + + - name: Publish browser test output + uses: actions/upload-artifact@v2 + with: + name: ${{ job.status }} Robot ${{ matrix.os }} Python ${{ matrix.python }} ${{ github.run_number }} + path: ./atest/output + if: always() diff --git a/README.md b/README.md index b04f19487..c812db886 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Language Server Protocol integration for Jupyter(Lab) -[![Build Status](https://travis-ci.org/krassowski/jupyterlab-lsp.svg?branch=master)](https://travis-ci.org/krassowski/jupyterlab-lsp) [![Build Status](https://dev.azure.com/krassowskimichal/jupyterlab-lsp/_apis/build/status/jupyterlab-lsp?branchName=master)](https://dev.azure.com/krassowskimichal/jupyterlab-lsp/_build/latest?definitionId=1&branchName=master) [![Documentation Status](https://readthedocs.org/projects/jupyterlab-lsp/badge/?version=latest)](https://jupyterlab-lsp.readthedocs.io/en/latest/?badge=latest) [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/krassowski/jupyterlab-lsp/master?urlpath=lab%2Ftree%2Fexamples%2FPython.ipynb) +[![Build Status](https://travis-ci.org/krassowski/jupyterlab-lsp.svg?branch=master)](https://travis-ci.org/krassowski/jupyterlab-lsp) ![tests](https://github.com/krassowski/jupyterlab-lsp/workflows/tests/badge.svg) [![Documentation Status](https://readthedocs.org/projects/jupyterlab-lsp/badge/?version=latest)](https://jupyterlab-lsp.readthedocs.io/en/latest/?badge=latest) [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/krassowski/jupyterlab-lsp/master?urlpath=lab%2Ftree%2Fexamples%2FPython.ipynb) > _This project is still maturing, but you are welcome to check it out, leave feedback and/or a PR_ diff --git a/atest/Keywords.robot b/atest/Keywords.robot index 0f7995ccf..3b8efebb5 100644 --- a/atest/Keywords.robot +++ b/atest/Keywords.robot @@ -4,6 +4,7 @@ Library SeleniumLibrary Library OperatingSystem Library Process Library String +Library ./logcheck.py Library ./ports.py *** Keywords *** @@ -70,12 +71,10 @@ Tear Down Everything Terminate All Processes kill=${True} Lab Log Should Not Contain Known Error Messages - ${log} = Get File ${LAB LOG} - ${test log} = Set Variable ${log[${PREVIOUS LAB LOG LENGTH}:]} - ${length} = Get Length ${log} - Set Global Variable ${PREVIOUS LAB LOG LENGTH} ${length} - Run Keyword If ("${OS}", "${PY}") !\= ("Windows", "36") - ... Should Not Contain Any ${test log} @{KNOWN BAD ERRORS} + Touch ${LAB LOG} + ${length} = Get File Size ${LAB LOG} + File Should Not Contain Phrases ${LAB LOG} ${PREVIOUS LAB LOG LENGTH} @{KNOWN BAD ERRORS} + [Teardown] Set Global Variable ${PREVIOUS LAB LOG LENGTH} ${length} Wait For Splash Go To ${URL}lab?reset&token=${TOKEN} diff --git a/atest/logcheck.py b/atest/logcheck.py new file mode 100644 index 000000000..978d28dee --- /dev/null +++ b/atest/logcheck.py @@ -0,0 +1,28 @@ +from bs4 import UnicodeDammit + + +def file_should_not_contain_phrases(filename, offset=0, *phrases): + """don't fail _too_ hard if the file can't be read for some reason""" + with open(filename, "rb") as fp: + raw = fp.read()[offset:] + + text = None + + try: + text = raw.decode("utf-8") + except Exception as err: + print("Failed to read", filename, "forcing unicode...\n", err) + try: + text = UnicodeDammit.detwingle(raw).decode("utf-8") + except Exception as err: + print("Failed to read", filename, "giving up...\n", err) + text = None + + matches = {} + + if text is not None: + for phrase in phrases: + if phrase in text: + matches[phrase] = True + + assert not matches, "Phrases found in {}: {}".format(filename, matches) diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index bd8cc8098..000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,34 +0,0 @@ -trigger: - batch: true - branches: - include: - - master - - refs/tags/v* - -pr: - branches: - include: - - '*' - -variables: - PYTHONUNBUFFERED: 1 - ATEST_RETRIES: 3 - YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn - - PY_JLSP_VERSION: 0.9.2 - JS_JLLSP_VERSION: 2.0.2 - JS_JLG2D_VERSION: 1.0.0 - - FIRST_PARTY_LABEXTENSIONS: >- - packages/jupyterlab-lsp/krassowski-jupyterlab-lsp-$(JS_JLLSP_VERSION).tgz - - LINKED_EXTENSIONS: >- - packages/lsp-ws-connection - packages/jupyterlab-go-to-definition - packages/completion-theme - packages/theme-vscode - packages/theme-material - -jobs: - - template: ci/job.lint.yml - - template: ci/job.test.yml diff --git a/ci/env_template.py b/ci/env_template.py deleted file mode 100644 index 9f723ca69..000000000 --- a/ci/env_template.py +++ /dev/null @@ -1,10 +0,0 @@ -from pathlib import Path -import sys - -Path("..", "env-test.yml").write_text( - Path("env-test.yml.in").read_text().format( - python=sys.argv[1], - lab=sys.argv[2], - nodejs=sys.argv[3] - ) -) diff --git a/ci/job.lint.yml b/ci/job.lint.yml deleted file mode 100644 index 252c056a9..000000000 --- a/ci/job.lint.yml +++ /dev/null @@ -1,47 +0,0 @@ -parameters: - platforms: - - name: Linux - vmImage: ubuntu-16.04 - activate: source activate - pythons: - - name: ThreeSeven - spec: '>=3.8,<3.9.0a0' - lab: '>=2,<3.0.0a0' - nodejs: '>=12,<13.0.0a0' - env_update: mamba env update -n jupyterlab-lsp --file env-test.yml --quiet - env_lint: mamba env update -n jupyterlab-lsp --file requirements/lint.yml --quiet - -jobs: - - ${{ each platform in parameters.platforms }}: - - ${{ each python in parameters.pythons}}: - - job: Lint - pool: - vmImage: ${{ platform.vmImage }} - steps: - - template: steps.mamba.yml - parameters: - name: ${{ platform.name }} - - - script: ${{ platform.activate }} && cd ci && python env_template.py "${{ python.spec }}" "${{ python.lab }}" "${{ python.nodejs }}" - displayName: generate env with python, lab, and nodejs version - - - script: ${{ parameters.env_update }} || ${{ parameters.env_update }} || ${{ parameters.env_update }} - displayName: testing dependencies - - - script: ${{ parameters.env_lint }} || ${{ parameters.env_lint }} || ${{ parameters.env_lint }} - displayName: linting dependencies - - - script: ${{ platform.activate }} jupyterlab-lsp && python scripts/integrity.py - displayName: check integrity of package versions - - - script: ${{ platform.activate }} jupyterlab-lsp && jlpm || jlpm || jlpm - displayName: install npm dependencies - - - script: ${{ platform.activate }} jupyterlab-lsp && python scripts/lint.py - displayName: lint backend - - - script: ${{ platform.activate }} jupyterlab-lsp && jlpm build:schema - displayName: build schema so linting can complete - - - script: ${{ platform.activate }} jupyterlab-lsp && jlpm lint:check - displayName: lint frontend diff --git a/ci/job.test.yml b/ci/job.test.yml deleted file mode 100644 index 0210346d3..000000000 --- a/ci/job.test.yml +++ /dev/null @@ -1,131 +0,0 @@ -parameters: - platforms: - - name: Linux - vmImage: ubuntu-16.04 - activate: source activate base - - name: MacOSX - vmImage: macos-10.14 - activate: source activate base - - name: Windows - vmImage: vs2017-win2016 - activate: call activate base - pythons: - - name: ThreeSix - spec: '=3.6' - lab: '>=2.2.0,<3.0.0a0' - nodejs: '>=10,<11.0.0.a0' - - name: ThreeSeven - spec: '=3.7' - lab: '>=2.2.0,<3.0.0a0' - nodejs: '>=12,<13.0.0a0' - - name: ThreeEight - spec: '=3.8' - lab: '>=2.2.0,<3.0.0a0' - nodejs: '>=13,<14.0.0a0' - js_cov_packages: - - jupyterlab-go-to-definition - - jupyterlab-lsp - env_update: mamba env update -n base --file env-test.yml --quiet - lab_link: jupyter labextension link --debug --no-build $(LINKED_EXTENSIONS) - lab_ext: jupyter labextension install --debug --no-build $(FIRST_PARTY_LABEXTENSIONS) - lab_build: jupyter lab build --debug --dev-build=False --minimize=True - -jobs: - - ${{ each platform in parameters.platforms }}: - - ${{ each python in parameters.pythons}}: - - job: ${{ platform.name }}${{ python.name }} - pool: - vmImage: ${{ platform.vmImage }} - steps: - - template: steps.mamba.yml - parameters: - name: ${{ platform.name }} - packages: "'python${{ python.spec }}'" - - - script: ${{ platform.activate }} && cd ci && python env_template.py "${{ python.spec }}" "${{ python.lab }}" "${{ python.nodejs }}" - displayName: generate env with python, lab, and nodejs version - - - script: ${{ parameters.env_update }} || ${{ parameters.env_update }} || ${{ parameters.env_update }} - displayName: update conda environment with test dependencies - - - script: conda info && conda list -n base - displayName: list conda info and packages - - - script: ${{ platform.activate }} && jlpm || jlpm || jlpm - displayName: install npm dependencies - - - script: ${{ platform.activate }} && jlpm build - displayName: build typescript - - - script: ${{ platform.activate }} && python setup.py sdist bdist_wheel - displayName: build python distributions - - - script: ${{ platform.activate }} && jlpm lerna run bundle - displayName: build npm bundles - - - script: ${{ platform.activate }} && cd dist && python -m pip install jupyter_lsp-$(PY_JLSP_VERSION)-py3-none-any.whl --no-deps - displayName: install python wheel - - - script: ${{ platform.activate }} && python scripts/jedi_cache.py - displayName: warm up jedi cache - - - script: ${{ platform.activate }} && python scripts/tectonic_cache.py - displayName: warm up tectonic cache - - - script: ${{ platform.activate }} && jlpm test - displayName: run frontend unit tests - - - task: PublishTestResults@2 - displayName: publish frontend test results - inputs: - testResultsFiles: packages/**/junit.xml - testRunTitle: 'Jest ${{ platform.name }}${{ python.name }}' - mergeTestResults: true - condition: always() - - - ${{ each js_package in parameters.js_cov_packages }}: - - task: PublishCodeCoverageResults@1 - displayName: 'publish ${{ js_package }} coverage' - inputs: - codeCoverageTool: Cobertura - summaryFileLocation: 'packages/${{ js_package }}/coverage/cobertura-coverage.xml' - condition: always() - - - script: ${{ platform.activate }} && jupyter serverextension list - displayName: list server extensions - - - script: ${{ platform.activate }} && python scripts/utest.py --test-run-title="Pytest ${{ platform.name }}${{ python.name }}" - displayName: run python tests - - - script: ${{ platform.activate }} && ${{ parameters.lab_link }} || ${{ parameters.lab_link }} || ${{ parameters.lab_link }} - displayName: install support packages - - - script: ${{ platform.activate }} && ${{ parameters.lab_ext }} || ${{ parameters.lab_ext }} || ${{ parameters.lab_ext }} - displayName: install labextensions - - - script: ${{ platform.activate }} && jupyter labextension list - displayName: list labextensions before build - - - script: ${{ platform.activate }} && ${{ parameters.lab_build }} || ${{ parameters.lab_build }} || ${{ parameters.lab_build }} - displayName: build lab - - - script: ${{ platform.activate }} && jupyter labextension list - displayName: list labextensions after build - - - script: ${{ platform.activate }} && python scripts/atest.py --exclude expect:fail - displayName: run browser tests - - - task: PublishTestResults@2 - displayName: publish browser test results - inputs: - testResultsFiles: atest/output/*.xunit.xml - testRunTitle: 'Robot ${{ platform.name }}${{ python.name }}' - mergeTestResults: true - condition: always() - - - task: PublishPipelineArtifact@0 - displayName: publish browser test output - inputs: - targetPath: atest/output - artifactName: $(Agent.JobStatus) Robot ${{ platform.name }}${{ python.name }} $(Build.BuildId) - condition: always() diff --git a/ci/steps.mamba.yml b/ci/steps.mamba.yml deleted file mode 100644 index 3715d5e13..000000000 --- a/ci/steps.mamba.yml +++ /dev/null @@ -1,22 +0,0 @@ -parameters: - name: Linux - install_cmd: conda install -yn base -c conda-forge --freeze-installed mamba conda=4.8.3 - -steps: - - ${{ if eq(parameters.name, 'Linux') }}: - - bash: echo "##vso[task.prependpath]$CONDA/bin" - displayName: conda $PATH - - - ${{ if eq(parameters.name, 'MacOSX') }}: - - bash: echo "##vso[task.prependpath]$CONDA/bin" - displayName: conda $PATH - - - bash: sudo chown -R $USER $CONDA - displayName: own conda - - - ${{ if eq(parameters.name, 'Windows') }}: - - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" - displayName: conda %PATH% - - - script: ${{ parameters.install_cmd }} || ${{ parameters.install_cmd }} || ${{ parameters.install_cmd }} - displayName: install mamba diff --git a/docs/Releasing.ipynb b/docs/Releasing.ipynb index 539ccb001..965a5fb4d 100644 --- a/docs/Releasing.ipynb +++ b/docs/Releasing.ipynb @@ -34,13 +34,13 @@ "The PyPI version (jupyter-lsp) must be updated in the following places:\n", "\n", "- `py_src/jupyter_lsp/_version.py` (canonical)\n", - "- `azure-pipelines.yml`\n", + "- `.github/workflows/job.test.yml`\n", "- `CHANGELOG.md`\n", "\n", "The npm version of `jupyterlab-lsp` must be updated in the following places:\n", "\n", "- `packages/jupyterlab-lsp/package.json` > `version` (canonical)\n", - "- `azure-pipelines.yml`\n", + "- `.github/workflows/job.test.yml`\n", "- `packages/metapackage/package.json`\n", "- `CHANGELOG.md`\n", "\n", @@ -57,7 +57,7 @@ " `@jupyterlab/application` (canonical)\n", "- `binder/environment.yml`\n", "- `requirements/lab.txt`\n", - "- `ci/job.test.yml`\n", + "- `.github/workflows/job.test.yml`\n", "- `README.md`\n", "\n", "### Releasing:\n", diff --git a/package.json b/package.json index f889e282d..85cad266b 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "eslint-plugin-react": "^7.19.0", "husky": "^3.0.9", "javascript-typescript-langserver": "^2.11.3", + "jest-github-actions-reporter": "^1.0.2", "lerna": "^3.13.2", "precise-commits": "^1.0.2", "prettier": "^2.0.5", @@ -50,7 +51,7 @@ "lint:check": "jlpm prettier:check && jlpm eslint:check", "lint": "jlpm prettier && jlpm eslint", "prettier:check": "prettier --check \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md,.yml}\"", - "prettier": "prettier --write \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md,.yml}\"", + "prettier": "prettier --list-different --write \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md,.yml}\"", "eslint": "eslint --config packages/.eslintrc.js --ext .js,.jsx,.ts,.tsx --fix packages", "eslint:check": "eslint --config packages/.eslintrc.js --ext .js,.jsx,.ts,.tsx packages", "test": "lerna run --stream --concurrency=1 test" diff --git a/packages/jupyterlab-lsp/jest.config.js b/packages/jupyterlab-lsp/jest.config.js index 63b50d5ac..58889e281 100644 --- a/packages/jupyterlab-lsp/jest.config.js +++ b/packages/jupyterlab-lsp/jest.config.js @@ -4,7 +4,6 @@ const upstream = func('jupyterlab-lsp', __dirname); const reuseFromUpstream = [ 'moduleFileExtensions', 'moduleNameMapper', - 'reporters', 'setupFiles', 'setupFilesAfterEnv', 'testPathIgnorePatterns' @@ -18,7 +17,9 @@ let local = { '\\.(js|jsx)?$': './transform.js', '\\.svg$': 'jest-raw-loader' }, - transformIgnorePatterns: ['/node_modules/(?!(@jupyterlab/.*)/)'] + transformIgnorePatterns: ['/node_modules/(?!(@jupyterlab/.*)/)'], + testLocationInResults: true, + reporters: [...upstream['reporters'], 'jest-github-actions-reporter'] }; for (const option of reuseFromUpstream) { diff --git a/requirements/atest.txt b/requirements/atest.txt index ed164ae82..ede3c2a6e 100644 --- a/requirements/atest.txt +++ b/requirements/atest.txt @@ -1,4 +1,5 @@ # acceptance test dependencies for jupyter_lsp -r ./lab.txt -robotframework-seleniumlibrary +bs4 robotframework >=3.2 +robotframework-seleniumlibrary diff --git a/ci/env-test.yml.in b/requirements/github-actions.yml similarity index 90% rename from ci/env-test.yml.in rename to requirements/github-actions.yml index 1bbaf53b8..cbc101f40 100644 --- a/ci/env-test.yml.in +++ b/requirements/github-actions.yml @@ -5,8 +5,6 @@ channels: - defaults dependencies: - # runtime dependencies - - python {python} - jupyterlab {lab} # build dependencies - nodejs {nodejs} @@ -27,13 +25,13 @@ dependencies: - chktex # test tools - pytest-asyncio - - pytest-azurepipelines - pytest-cov - pytest-flake8 - pytest-runner - ruamel_yaml # browser testing + - bs4 - firefox - geckodriver - - robotframework-seleniumlibrary - robotframework >=3.2 + - robotframework-seleniumlibrary diff --git a/scripts/integrity.py b/scripts/integrity.py index 62cd9bb7e..c4c82904f 100644 --- a/scripts/integrity.py +++ b/scripts/integrity.py @@ -62,12 +62,12 @@ # CI stuff -PIPE_FILE = ROOT / "azure-pipelines.yml" +PIPE_FILE = ROOT / ".github/workflows/job.test.yml" PIPELINES = yaml.safe_load(PIPE_FILE.read_text()) -PIPE_VARS = PIPELINES["variables"] +PIPE_VARS = PIPELINES["env"] DOCS = ROOT / "docs" -CI = ROOT / "ci" +CI = ROOT / ".github/workflows" PYTEST_INI = """ [pytest] diff --git a/scripts/jedi_cache.py b/scripts/jedi_cache.py index 998e14963..3a779d87c 100644 --- a/scripts/jedi_cache.py +++ b/scripts/jedi_cache.py @@ -21,7 +21,7 @@ - When _using_ jedi for the first time, the cache gets created in `jedi.settings.cache_directory`, usually somewhere in $HOME. -- As different libriraries are inspected by jedi, they get +- As different libraries are inspected by jedi, they get added to the cache. - This is very slow, especially on windows, and cannot feasibly be cached, today. @@ -38,7 +38,6 @@ """ import os import pathlib -import shutil import sys import time @@ -93,11 +92,7 @@ def setup_jedi(): print("default jedi environment", jedi.api.environment.get_default_environment()) print("jedi environment", ENV) jedi_cache = pathlib.Path(jedi.settings.cache_directory) - if jedi_cache.exists(): - shutil.rmtree(jedi_cache) - print("removed jedi cache!") - else: - print("no jedi cache was found!") + return jedi_cache.exists() def warm_up(modules): @@ -105,7 +100,12 @@ def warm_up(modules): print("-" * 80) print_versions() print("-" * 80) - setup_jedi() + cache_exists = setup_jedi() + if cache_exists: + print("jedi cache already exists, aborting warm up!") + return + else: + print("no jedi cache was found, warming up!") print("-" * 80) start = time.time() [warm_up_one(module) for module in modules] @@ -115,4 +115,4 @@ def warm_up(modules): if __name__ == "__main__": - warm_up(sorted(set(sys.argv[1:] or MODULES_TO_CACHE))) + warm_up(sorted(set(sys.argv[2:] or MODULES_TO_CACHE))) diff --git a/scripts/lint.py b/scripts/lint.py index ced814fee..8de26d26c 100644 --- a/scripts/lint.py +++ b/scripts/lint.py @@ -60,7 +60,7 @@ def lint(): ["mypy", *PY_SRC], ["python", "-m", "robot.tidy", "--inplace", *ALL_ROBOT], ["rflint", *RFLINT, *ALL_ROBOT], - ["python", "scripts/atest.py", "--dryrun", "--console", "quiet"], + ["python", "scripts/atest.py", "--dryrun", "--console", "dotted"], ["python", "scripts/nblint.py"], ], ) diff --git a/yarn.lock b/yarn.lock index df217316e..27b5e90bd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +"@actions/core@^1.2.0": + version "1.2.5" + resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.5.tgz#fa57bf8c07a38191e243beb9ea9d8368c1cb02c8" + integrity sha512-mwpoNjHSWWh0IiALdDEQi3tru124JKn0yVNziIBzTME8QRv7thwoghVuT1jBRjFvdtoHsqD58IRHy1nf86paRg== + "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" @@ -1941,14 +1946,14 @@ version "2.0.0" "@krassowski/jupyterlab-lsp@file:packages/jupyterlab-lsp": - version "1.1.2" + version "2.0.2" dependencies: "@krassowski/completion-theme" "~2.0.0" "@krassowski/jupyterlab_go_to_definition" "~1.0.0" "@krassowski/theme-material" "~2.0.0" "@krassowski/theme-vscode" "~2.0.0" lodash.mergewith "^4.6.1" - lsp-ws-connection "~0.5.0" + lsp-ws-connection "~0.5.1" "@krassowski/jupyterlab_go_to_definition@file:packages/jupyterlab-go-to-definition": version "1.0.0" @@ -8443,6 +8448,13 @@ jest-get-type@^26.3.0: resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-26.3.0.tgz#e97dc3c3f53c2b406ca7afaed4493b1d099199e0" integrity sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig== +jest-github-actions-reporter@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/jest-github-actions-reporter/-/jest-github-actions-reporter-1.0.2.tgz#218222b34dacdea0d9d83a2e2a2561136d25e252" + integrity sha512-iA8PfVL0cZYLJgPKc6K54nF8Y5PMo0vtONpi03H9I4dMPQtrrWaqXUX21dZRssIo7eGuEmhBcDrnwezRgkn+Rw== + dependencies: + "@actions/core" "^1.2.0" + jest-haste-map@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.9.0.tgz#b38a5d64274934e21fa417ae9a9fbeb77ceaac7d" @@ -9906,7 +9918,7 @@ lru-queue@0.1: es5-ext "~0.10.2" "lsp-ws-connection@file:packages/lsp-ws-connection": - version "0.5.0" + version "0.5.1" dependencies: vscode-jsonrpc "^4.1.0-next" vscode-languageclient "^5.2.1"