Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First attempt to setup GitHub actions #345

Merged
merged 42 commits into from
Sep 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
56e500b
First attempt to setup GitHub actions
krassowski Sep 8, 2020
1637ad1
Less templates
krassowski Sep 8, 2020
caec4c7
Remove old files
krassowski Sep 8, 2020
63fb4d4
Use miniconda and install mamba
krassowski Sep 8, 2020
71698aa
Add event for test, fix syntax for lint
krassowski Sep 8, 2020
7ba96d3
Strategy belongs to job, defaults can be global
krassowski Sep 8, 2020
b570109
Rename workflows
krassowski Sep 8, 2020
1c2700b
Fix some syntax issues/leftovers
krassowski Sep 8, 2020
3bdc932
It's channels..
krassowski Sep 8, 2020
5546f9e
Try without templating env
krassowski Sep 8, 2020
5ee904e
Remove incorrect ==
krassowski Sep 8, 2020
cfa0902
Install later
krassowski Sep 8, 2020
a4e9e2b
Split install?
krassowski Sep 9, 2020
75ce652
Best command is no command
krassowski Sep 9, 2020
aea05fb
Debug and cleanup
krassowski Sep 9, 2020
f3e64d8
Checkout self
krassowski Sep 9, 2020
7c473f9
Wrong uses
krassowski Sep 9, 2020
b29416f
Remove mamba as it fails on win
krassowski Sep 9, 2020
3e8276f
Try with substitution
krassowski Sep 9, 2020
24d26a3
Use envsubst-action
krassowski Sep 9, 2020
3ddfb89
Correct version, rename file
krassowski Sep 9, 2020
d79a817
Correct to lab
krassowski Sep 9, 2020
d9c44f5
Try with cschleiden/replace-tokens
krassowski Sep 9, 2020
832420e
Update integrity test, clean up
krassowski Sep 9, 2020
67f437f
Try with GitHub reporters
krassowski Sep 9, 2020
00f348e
Fix variables, lint
krassowski Sep 9, 2020
e4a63ca
The vars are from env
krassowski Sep 9, 2020
cc42bc2
Add node in name, fix version substitution
krassowski Sep 9, 2020
7f96f63
Shorten name
krassowski Sep 9, 2020
31ca314
add bs4 to attempt windows utf-8 reading
bollwyvl Sep 5, 2020
b6d2a75
Add yarn and conda cache for the test workflow
krassowski Sep 9, 2020
bb19f8c
fix typo
bollwyvl Sep 8, 2020
2ecd1b7
linting
bollwyvl Sep 8, 2020
3364e08
Try to add jedi cache
krassowski Sep 9, 2020
bf30576
Try to reduce the job matrix (too many jobs as for our needs)
krassowski Sep 9, 2020
5265842
Try caching tectonic, rename, swap badge
krassowski Sep 9, 2020
2196f05
Do not remove the jedi cache on warm up
krassowski Sep 9, 2020
ef1a648
Remove unused shutil
krassowski Sep 9, 2020
13b8251
Attempt to publish Robot artifacts
krassowski Sep 10, 2020
a8c4d90
Remove nodejs spec from robot artifact name for now as it contains fo…
krassowski Sep 10, 2020
0547ea5
Limit lint to master too
krassowski Sep 10, 2020
b45a4b9
Try to test with Node 14 instead of 13
krassowski Sep 10, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/job.lint.yml
Original file line number Diff line number Diff line change
@@ -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
krassowski marked this conversation as resolved.
Show resolved Hide resolved
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
207 changes: 207 additions & 0 deletions .github/workflows/job.test.yml
Original file line number Diff line number Diff line change
@@ -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
krassowski marked this conversation as resolved.
Show resolved Hide resolved

- 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
krassowski marked this conversation as resolved.
Show resolved Hide resolved

- 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()
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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_

Expand Down
11 changes: 5 additions & 6 deletions atest/Keywords.robot
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Library SeleniumLibrary
Library OperatingSystem
Library Process
Library String
Library ./logcheck.py
Library ./ports.py

*** Keywords ***
Expand Down Expand Up @@ -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}
Expand Down
28 changes: 28 additions & 0 deletions atest/logcheck.py
Original file line number Diff line number Diff line change
@@ -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)
34 changes: 0 additions & 34 deletions azure-pipelines.yml

This file was deleted.

10 changes: 0 additions & 10 deletions ci/env_template.py

This file was deleted.

Loading