|
| 1 | +name: tests |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + pull_request: |
| 7 | + branches: |
| 8 | + - master |
| 9 | + |
| 10 | +defaults: |
| 11 | + run: |
| 12 | + shell: bash -l {0} |
| 13 | + |
| 14 | +env: |
| 15 | + # TODO extract these from files instead |
| 16 | + PY_JLSP_VERSION: 0.9.2 |
| 17 | + JS_JLLSP_VERSION: 2.0.2 |
| 18 | + JS_JLG2D_VERSION: 1.0.0 |
| 19 | + |
| 20 | + PYTHONUNBUFFERED: 1 |
| 21 | + ATEST_RETRIES: 3 |
| 22 | + |
| 23 | + LINKED_EXTENSIONS: >- |
| 24 | + packages/lsp-ws-connection |
| 25 | + packages/jupyterlab-go-to-definition |
| 26 | + packages/completion-theme |
| 27 | + packages/theme-vscode |
| 28 | + packages/theme-material |
| 29 | +
|
| 30 | +jobs: |
| 31 | + acceptance: |
| 32 | + runs-on: ${{ matrix.os }} |
| 33 | + name: ${{ matrix.os }}, Python ${{ matrix.python }}, Node ${{ matrix.nodejs }} |
| 34 | + strategy: |
| 35 | + matrix: |
| 36 | + python: [3.6, 3.7, 3.8] |
| 37 | + os: [ubuntu-16.04, macos-10.14, vs2017-win2016] |
| 38 | + lab: ['>=2.2.0,<3.0.0a0'] |
| 39 | + include: |
| 40 | + # if using 3.6, use an old node |
| 41 | + - python: 3.6 |
| 42 | + # Node 10 end-of-life: April 2021 |
| 43 | + nodejs: '>=10,<11.0.0.a0' |
| 44 | + # if using 3.7, use newer node, etc... |
| 45 | + - python: 3.7 |
| 46 | + # Node 12 end-of-life: April 2022 |
| 47 | + nodejs: '>=12,<13.0.0.a0' |
| 48 | + - python: 3.8 |
| 49 | + # Node 14 end-of-life: April 2023 |
| 50 | + nodejs: '>=14,<15.0.0.a0' |
| 51 | + |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v2 |
| 54 | + |
| 55 | + - name: Set JupyterLab and Node versions |
| 56 | + uses: cschleiden/replace-tokens@v1 |
| 57 | + with: |
| 58 | + tokenPrefix: '{' |
| 59 | + tokenSuffix: '}' |
| 60 | + files: '["requirements/github-actions.yml"]' |
| 61 | + env: |
| 62 | + lab: '${{ matrix.lab }}' |
| 63 | + nodejs: '${{ matrix.nodejs }}' |
| 64 | + |
| 65 | + - name: Cache conda |
| 66 | + uses: actions/cache@v1 |
| 67 | + env: |
| 68 | + # Increase this value to reset cache if requirements/github-actions.yml has not changed |
| 69 | + CACHE_NUMBER: 0 |
| 70 | + with: |
| 71 | + path: ~/conda_pkgs_dir |
| 72 | + key: ${{ matrix.os }}-${{ matrix.python }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements/github-actions.yml') }} |
| 73 | + |
| 74 | + - name: Set up Python and conda |
| 75 | + uses: goanpeca/setup-miniconda@v1 |
| 76 | + with: |
| 77 | + python-version: ${{ matrix.python }} |
| 78 | + channels: conda-forge, defaults |
| 79 | + channel-priority: true |
| 80 | + auto-activate-base: true |
| 81 | + activate-environment: jupyterlab-lsp |
| 82 | + environment-file: requirements/github-actions.yml |
| 83 | + auto-update-conda: true |
| 84 | + use-only-tar-bz2: true # needs to be set for caching to work properly |
| 85 | + |
| 86 | + - name: Install pip dependencies |
| 87 | + run: pip install pytest-github-actions-annotate-failures |
| 88 | + |
| 89 | + - name: Describe conda |
| 90 | + shell: bash -l {0} |
| 91 | + run: | |
| 92 | + conda info |
| 93 | + conda list |
| 94 | + conda config --show-sources |
| 95 | + conda config --show |
| 96 | + printenv | sort |
| 97 | +
|
| 98 | + - name: Cache yarn |
| 99 | + uses: actions/cache@v1 |
| 100 | + with: |
| 101 | + path: .yarn-packages |
| 102 | + key: yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }} |
| 103 | + restore-keys: | |
| 104 | + yarn-${{ runner.os }}- |
| 105 | + yarn- |
| 106 | +
|
| 107 | + - name: Install npm dependencies |
| 108 | + run: jlpm |
| 109 | + |
| 110 | + - name: Build the extension |
| 111 | + run: jlpm build |
| 112 | + |
| 113 | + - name: Build python distributions |
| 114 | + run: python setup.py sdist bdist_wheel |
| 115 | + |
| 116 | + - name: Build npm bundles |
| 117 | + run: jlpm lerna run bundle |
| 118 | + |
| 119 | + - name: Install python wheel |
| 120 | + run: cd dist && python -m pip install jupyter_lsp-${{ env.PY_JLSP_VERSION }}-py3-none-any.whl --no-deps |
| 121 | + |
| 122 | + - name: Find out jedi cache location |
| 123 | + run: python -c 'import jedi; print("::set-env name=JEDI_CACHE_DIR::" + jedi.settings.cache_directory)' |
| 124 | + |
| 125 | + - name: Cache jedi cache |
| 126 | + uses: actions/cache@v1 |
| 127 | + with: |
| 128 | + path: ${{ env.JEDI_CACHE_DIR }} |
| 129 | + key: jedi-${{ matrix.os }}-${{ hashFiles('scripts/jedi_cache.py') }}-${{ hashFiles('requirements/github-actions.yml') }} |
| 130 | + |
| 131 | + - name: Warm up jedi cache |
| 132 | + run: python scripts/jedi_cache.py |
| 133 | + |
| 134 | + - name: Cache tectonic cache |
| 135 | + uses: actions/cache@v2 |
| 136 | + with: |
| 137 | + # locations for: Linux, MacOS, Windows |
| 138 | + path: | |
| 139 | + ~/.cache/Tectonic |
| 140 | + ~/Library/Caches/Tectonic |
| 141 | + %LOCALAPPDATA%/TectonicProject/Tectonic |
| 142 | + key: ${{ runner.os }}-${{ hashFiles('scripts/tectonic_cache.py') }} |
| 143 | + |
| 144 | + - name: Warm up tectonic cache |
| 145 | + run: python scripts/tectonic_cache.py |
| 146 | + |
| 147 | + - name: Run frontend unit tests |
| 148 | + run: jlpm test |
| 149 | + |
| 150 | + # js_cov_packages: |
| 151 | + # - jupyterlab-go-to-definition |
| 152 | + # - jupyterlab-lsp |
| 153 | + |
| 154 | + #- task: PublishTestResults@2 |
| 155 | + # name: publish frontend test results |
| 156 | + # inputs: |
| 157 | + # testResultsFiles: packages/**/junit.xml |
| 158 | + # testRunTitle: 'Jest ${{ env.name }}${{ python.name }}' |
| 159 | + # mergeTestResults: true |
| 160 | + # condition: always() |
| 161 | + |
| 162 | + #- ${{ each js_package in parameters.js_cov_packages }}: |
| 163 | + # - task: PublishCodeCoverageResults@1 |
| 164 | + # name: 'publish ${{ js_package }} coverage' |
| 165 | + # inputs: |
| 166 | + # codeCoverageTool: Cobertura |
| 167 | + # summaryFileLocation: 'packages/${{ js_package }}/coverage/cobertura-coverage.xml' |
| 168 | + # condition: always() |
| 169 | + |
| 170 | + - name: List server extensions |
| 171 | + run: jupyter serverextension list |
| 172 | + |
| 173 | + - name: Run python tests |
| 174 | + run: python scripts/utest.py |
| 175 | + |
| 176 | + - name: Install support packages |
| 177 | + run: jupyter labextension link --debug --no-build ${{ env.LINKED_EXTENSIONS }} |
| 178 | + |
| 179 | + - name: Install labextensions |
| 180 | + run: jupyter labextension install --debug --no-build packages/jupyterlab-lsp/krassowski-jupyterlab-lsp-${{ env.JS_JLLSP_VERSION }}.tgz |
| 181 | + |
| 182 | + - name: List labextensions before build |
| 183 | + run: jupyter labextension list |
| 184 | + |
| 185 | + - name: Build lab |
| 186 | + run: jupyter lab build --debug --dev-build=False --minimize=True |
| 187 | + |
| 188 | + - name: List labextensions after build |
| 189 | + run: jupyter labextension list |
| 190 | + |
| 191 | + - name: Run browser tests |
| 192 | + run: python scripts/atest.py --exclude expect:fail |
| 193 | + |
| 194 | + #- task: PublishTestResults@2 |
| 195 | + # name: publish browser test results |
| 196 | + # inputs: |
| 197 | + # testResultsFiles: atest/output/*.xunit.xml |
| 198 | + # testRunTitle: 'Robot ${{ env.name }}${{ python.name }}' |
| 199 | + # mergeTestResults: true |
| 200 | + # condition: always() |
| 201 | + |
| 202 | + - name: Publish browser test output |
| 203 | + uses: actions/upload-artifact@v2 |
| 204 | + with: |
| 205 | + name: ${{ job.status }} Robot ${{ matrix.os }} Python ${{ matrix.python }} ${{ github.run_number }} |
| 206 | + path: ./atest/output |
| 207 | + if: always() |
0 commit comments