-
Notifications
You must be signed in to change notification settings - Fork 150
First attempt to setup GitHub actions #345
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
Merged
Merged
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 1637ad1
Less templates
krassowski caec4c7
Remove old files
krassowski 63fb4d4
Use miniconda and install mamba
krassowski 71698aa
Add event for test, fix syntax for lint
krassowski 7ba96d3
Strategy belongs to job, defaults can be global
krassowski b570109
Rename workflows
krassowski 1c2700b
Fix some syntax issues/leftovers
krassowski 3bdc932
It's channels..
krassowski 5546f9e
Try without templating env
krassowski 5ee904e
Remove incorrect ==
krassowski cfa0902
Install later
krassowski a4e9e2b
Split install?
krassowski 75ce652
Best command is no command
krassowski aea05fb
Debug and cleanup
krassowski f3e64d8
Checkout self
krassowski 7c473f9
Wrong uses
krassowski b29416f
Remove mamba as it fails on win
krassowski 3e8276f
Try with substitution
krassowski 24d26a3
Use envsubst-action
krassowski 3ddfb89
Correct version, rename file
krassowski d79a817
Correct to lab
krassowski d9c44f5
Try with cschleiden/replace-tokens
krassowski 832420e
Update integrity test, clean up
krassowski 67f437f
Try with GitHub reporters
krassowski 00f348e
Fix variables, lint
krassowski e4a63ca
The vars are from env
krassowski cc42bc2
Add node in name, fix version substitution
krassowski 7f96f63
Shorten name
krassowski 31ca314
add bs4 to attempt windows utf-8 reading
bollwyvl b6d2a75
Add yarn and conda cache for the test workflow
krassowski bb19f8c
fix typo
bollwyvl 2ecd1b7
linting
bollwyvl 3364e08
Try to add jedi cache
krassowski bf30576
Try to reduce the job matrix (too many jobs as for our needs)
krassowski 5265842
Try caching tectonic, rename, swap badge
krassowski 2196f05
Do not remove the jedi cache on warm up
krassowski ef1a648
Remove unused shutil
krassowski 13b8251
Attempt to publish Robot artifacts
krassowski a8c4d90
Remove nodejs spec from robot artifact name for now as it contains fo…
krassowski 0547ea5
Limit lint to master too
krassowski b45a4b9
Try to test with Node 14 instead of 13
krassowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.