Skip to content

Commit e97324d

Browse files
authored
Merge pull request #345 from krassowski/github-actions
First attempt to setup GitHub actions
2 parents 9c56a02 + b45a4b9 commit e97324d

File tree

19 files changed

+342
-278
lines changed

19 files changed

+342
-278
lines changed

.github/workflows/job.lint.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: lint
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+
jobs:
15+
lint:
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
matrix:
19+
os: [ubuntu-16.04]
20+
python: [3.8]
21+
nodejs: ['>=12,<13.0.0a0']
22+
lab: ['>=2,<3.0.0a0']
23+
steps:
24+
- uses: actions/checkout@v2
25+
26+
- uses: cschleiden/replace-tokens@v1
27+
with:
28+
tokenPrefix: '{'
29+
tokenSuffix: '}'
30+
files: '["requirements/github-actions.yml"]'
31+
env:
32+
lab: '${{ matrix.lab }}'
33+
nodejs: '${{ matrix.nodejs }}'
34+
35+
- name: Set up Python and conda
36+
uses: goanpeca/setup-miniconda@v1
37+
with:
38+
python-version: ${{ matrix.python }}
39+
channels: conda-forge, defaults
40+
channel-priority: true
41+
activate-environment: jupyterlab-lsp
42+
environment-file: requirements/github-actions.yml
43+
auto-update-conda: true
44+
45+
- name: linting dependencies
46+
run: conda env update -n jupyterlab-lsp --file requirements/lint.yml --quiet
47+
48+
- name: check integrity of package versions
49+
run: python scripts/integrity.py
50+
51+
- name: install npm dependencies
52+
run: jlpm
53+
54+
- name: lint backend
55+
run: python scripts/lint.py
56+
57+
- name: build schema so linting can complete
58+
run: jlpm build:schema
59+
60+
- name: lint frontend
61+
run: jlpm lint:check

.github/workflows/job.test.yml

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
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()

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Language Server Protocol integration for Jupyter(Lab)
22

3-
[![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)
3+
[![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)
44

55
> _This project is still maturing, but you are welcome to check it out, leave feedback and/or a PR_
66

atest/Keywords.robot

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Library SeleniumLibrary
44
Library OperatingSystem
55
Library Process
66
Library String
7+
Library ./logcheck.py
78
Library ./ports.py
89

910
*** Keywords ***
@@ -70,12 +71,10 @@ Tear Down Everything
7071
Terminate All Processes kill=${True}
7172

7273
Lab Log Should Not Contain Known Error Messages
73-
${log} = Get File ${LAB LOG}
74-
${test log} = Set Variable ${log[${PREVIOUS LAB LOG LENGTH}:]}
75-
${length} = Get Length ${log}
76-
Set Global Variable ${PREVIOUS LAB LOG LENGTH} ${length}
77-
Run Keyword If ("${OS}", "${PY}") !\= ("Windows", "36")
78-
... Should Not Contain Any ${test log} @{KNOWN BAD ERRORS}
74+
Touch ${LAB LOG}
75+
${length} = Get File Size ${LAB LOG}
76+
File Should Not Contain Phrases ${LAB LOG} ${PREVIOUS LAB LOG LENGTH} @{KNOWN BAD ERRORS}
77+
[Teardown] Set Global Variable ${PREVIOUS LAB LOG LENGTH} ${length}
7978

8079
Wait For Splash
8180
Go To ${URL}lab?reset&token=${TOKEN}

atest/logcheck.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from bs4 import UnicodeDammit
2+
3+
4+
def file_should_not_contain_phrases(filename, offset=0, *phrases):
5+
"""don't fail _too_ hard if the file can't be read for some reason"""
6+
with open(filename, "rb") as fp:
7+
raw = fp.read()[offset:]
8+
9+
text = None
10+
11+
try:
12+
text = raw.decode("utf-8")
13+
except Exception as err:
14+
print("Failed to read", filename, "forcing unicode...\n", err)
15+
try:
16+
text = UnicodeDammit.detwingle(raw).decode("utf-8")
17+
except Exception as err:
18+
print("Failed to read", filename, "giving up...\n", err)
19+
text = None
20+
21+
matches = {}
22+
23+
if text is not None:
24+
for phrase in phrases:
25+
if phrase in text:
26+
matches[phrase] = True
27+
28+
assert not matches, "Phrases found in {}: {}".format(filename, matches)

azure-pipelines.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

ci/env_template.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)