WIP: code actions for diagnostics #1748
Workflow file for this run
This file contains 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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
- 3.x | |
- 4.x | |
pull_request: | |
branches: | |
- main | |
- 3.x | |
- 4.x | |
workflow_dispatch: | |
# TODO: might need to tweak `group` | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -l {0} | |
env: | |
JULIA_NUM_THREADS: 2 | |
MAMBA_NO_BANNER: 1 | |
PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
PYTHONUNBUFFERED: 1 | |
ATEST_PROCESSES: 2 | |
ATEST_RETRIES: 3 | |
JLPM_CMD: jlpm install | |
# Increase this value to reset all caches | |
CACHE_EPOCH: 4 | |
JULIA_LANGSERVER: 4.1.0 | |
jobs: | |
lint: | |
name: jstest/lint | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
matrix: | |
os: [ubuntu] | |
nodejs: ['>=16,<17.0.0a0'] | |
lab: ['>=4.0.5,<5.0.0a0'] | |
r: ['>=4'] | |
steps: | |
- uses: actions/checkout@v3 | |
- 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 mamba | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
environment-file: requirements/github-actions.yml | |
miniforge-variant: Mambaforge | |
use-mamba: true | |
- name: Install linting dependencies | |
run: mamba env update -n test --file requirements/lint.yml | |
- name: Check integrity of package versions | |
run: python scripts/integrity.py | |
- name: Cache node_modules | |
id: cache-node-modules | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: | | |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-node-build-${{ hashFiles('yarn.lock', 'requirements/github-actions.yml') }} | |
- name: Cache yarn packages | |
id: cache-yarn-packages | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
uses: actions/cache@v3 | |
with: | |
path: '.yarn/cache' | |
key: | | |
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}- | |
${{ env.CACHE_EPOCH }}-yarn- | |
- name: Install npm dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: ${{ env.JLPM_CMD }} | |
- name: Build frontend | |
run: jlpm build | |
- name: Run frontend unit tests | |
run: jlpm test --no-bail | |
- name: Lint backend | |
run: python scripts/lint.py | |
- name: 'Revert templated file (TODO: remove)' | |
run: git checkout requirements/github-actions.yml | |
- name: Lint frontend | |
run: jlpm lint:check | |
- name: Check distributions | |
run: python scripts/distcheck.py | |
- name: Rename uncached conda packages | |
shell: bash | |
run: mv "${CONDA_PKGS_DIR}" "${CONDA_PKGS_DIR}_do_not_cache" | |
build: | |
name: build | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
matrix: | |
os: [ubuntu] | |
nodejs: ['>=16,<17.0.0a0'] | |
lab: ['>=4.0.0,<5.0.0a0'] | |
r: ['>=4'] | |
steps: | |
- uses: actions/checkout@v3 | |
- 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 mamba | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge | |
use-mamba: true | |
- name: Install minimal build deps | |
run: mamba install -n test -c conda-forge setuptools wheel 'jupyterlab${{ matrix.lab }}' 'nodejs${{ matrix.nodejs }}' | |
- name: Cache node_modules | |
id: cache-node-modules | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: | | |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-node-build-${{ hashFiles('yarn.lock', 'requirements/github-actions.yml') }} | |
- name: Cache yarn packages | |
id: cache-yarn-packages | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
uses: actions/cache@v3 | |
with: | |
path: '.yarn/cache' | |
key: | | |
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}- | |
${{ env.CACHE_EPOCH }}-yarn- | |
- name: install npm dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: ${{ env.JLPM_CMD }} | |
- name: Build frontend | |
run: | | |
jlpm build | |
jlpm bundle | |
- name: Build python distributions | |
run: | | |
set -eux | |
cp README.md python_packages/jupyterlab_lsp | |
cd python_packages/jupyter_lsp | |
python setup.py sdist bdist_wheel | |
cd ../jupyterlab_lsp | |
python setup.py sdist bdist_wheel | |
cd ../klingon_ls_specification | |
python setup.py sdist bdist_wheel | |
- name: Collect distributions | |
run: | | |
set -eux | |
mkdir dist | |
cp python_packages/*/dist/* packages/*/*.tgz dist/ | |
cd dist | |
sha256sum * | tee SHA256SUMS | |
- name: Publish builds | |
uses: actions/upload-artifact@v3 | |
with: | |
name: jupyterlab-lsp dist ${{ github.run_number }} | |
path: ./dist | |
- name: Rename uncached conda packages | |
shell: bash | |
run: mv "${CONDA_PKGS_DIR}" "${CONDA_PKGS_DIR}_do_not_cache" | |
acceptance: | |
runs-on: ${{ matrix.os }}-latest | |
name: atest ${{ matrix.os }} py${{ matrix.python }} r${{ matrix.r }} | |
needs: [build] | |
strategy: | |
# TODO: maybe turn back on | |
fail-fast: false | |
matrix: | |
os: ['ubuntu', 'macos', 'windows'] | |
python: ['3.8', '3.11'] | |
include: | |
- python: '3.8' | |
# Node 16 end-of-life: 2023-09-11 | |
nodejs: '>=16,<17.0.0.a0' | |
r: '>=4' | |
lab: '>=4,<5' | |
- python: '3.11' | |
# Node 18 end-of-life: 2025-04-30 | |
nodejs: '>=18,<19.0.0.a0' | |
r: '>=4' | |
lab: '>=4,<5' | |
steps: | |
- uses: actions/checkout@v3 | |
- 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: Set up Python and mamba | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
environment-file: requirements/github-actions.yml | |
miniforge-variant: Mambaforge | |
use-mamba: true | |
- name: List all packages | |
run: conda list | |
- name: Cache node_modules | |
id: cache-node-modules | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: | | |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-node-atest-${{ hashFiles('yarn.lock') }} | |
- name: Cache yarn packages | |
id: cache-yarn-packages | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
uses: actions/cache@v3 | |
with: | |
path: '.yarn/cache' | |
key: | | |
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}- | |
${{ env.CACHE_EPOCH }}-yarn- | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.julia/artifacts | |
key: | | |
${{ env.CACHE_EPOCH }}-julia-test-${{ runner.os }}-${{ env.JULIA_LANGSERVER }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: jupyterlab-lsp dist ${{ github.run_number }} | |
path: ./dist | |
- name: Install python packages | |
run: python -m pip install --find-links=dist --no-index --ignore-installed --no-deps jupyter_lsp jupyterlab_lsp | |
- name: Install Klingon file type extension and server specification (for testing languages without language servers) | |
run: python -m pip install --find-links=dist --no-index --ignore-installed --no-deps klingon_ls_specification | |
- name: Pip check | |
run: | | |
python -m pip check | |
python -m pip list | grep -ie klingon-ls-specification | |
- name: List server extensions | |
run: | | |
jupyter server extension list | |
jupyter server extension list 2>&1 | grep -ie "jupyter_lsp.*enabled" - | |
- name: List frontend extensions | |
run: | | |
jupyter labextension list | |
jupyter labextension list 2>&1 | grep -ie "jupyterlab-lsp.*enabled" - | |
jupyter labextension list 2>&1 | grep -ie "jupyterlab-lsp-klingon-integration.*enabled" - | |
- name: install node-based language servers | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: ${{ env.JLPM_CMD }} | |
- name: Install Julia | |
uses: julia-actions/setup-julia@v1 | |
- name: Install Julia language server | |
run: julia -e 'using Pkg; Pkg.add(Pkg.PackageSpec(;name="LanguageServer", version="${{ env.JULIA_LANGSERVER }}"))' | |
- name: Run python tests | |
run: python scripts/utest.py | |
- name: Run browser tests | |
run: python scripts/atest.py --exclude expect:fail | |
- name: Find and remove empty files | |
# https://github.com/actions/upload-artifact/issues/150 | |
run: find ./atest/output -empty -delete | |
if: always() | |
shell: bash | |
- name: Publish browser test output | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ job.status }} Robot ${{ matrix.os }} Python ${{ matrix.python }} ${{ github.run_number }} | |
path: ./atest/output | |
if: always() | |
- name: Rename uncached conda packages | |
shell: bash | |
run: mv "${CONDA_PKGS_DIR}" "${CONDA_PKGS_DIR}_do_not_cache" | |
smoke: | |
name: smoke ${{ matrix.os }} py${{ matrix.python }} | |
runs-on: ${{ matrix.os }}-latest | |
needs: [build, lint] | |
strategy: | |
fail-fast: false | |
max-parallel: 3 | |
matrix: | |
os: ['ubuntu', 'macos', 'windows'] | |
python: ['3.8', '3.11', 'pypy-3.8'] | |
include: | |
- python: '3.8' | |
dist: 'jupyter*lsp*.whl' | |
lab: '>=4,<5' | |
- python: '3.8' | |
dist: 'jupyter*lsp*.tar.gz' | |
lab: '>=4,<5' | |
- python: '3.11' | |
dist: 'jupyter*lsp*.whl' | |
lab: '>=4,<5' | |
- python: 'pypy-3.8' | |
dist: 'jupyter*lsp*.tar.gz' | |
lab: '>=4,<5' | |
- os: 'windows' | |
py_cmd: python | |
- os: 'macos' | |
py_cmd: python3 | |
- os: 'ubuntu' | |
py_cmd: python | |
steps: | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
architecture: 'x64' | |
- uses: actions/download-artifact@v3 | |
with: | |
name: jupyterlab-lsp dist ${{ github.run_number }} | |
path: ./dist | |
- name: Install the prerequisites | |
run: ${{ matrix.py_cmd }} -m pip install pip wheel | |
- name: Install the package | |
run: cd dist && ${{ matrix.py_cmd }} -m pip install -vv ${{ matrix.dist }} 'jupyterlab${{ matrix.lab }}' | |
- name: Validate environment | |
run: | | |
set -eux | |
${{ matrix.py_cmd }} -m pip freeze | |
${{ matrix.py_cmd }} -m pip check | |
- name: Validate the install | |
run: | | |
set -eux | |
${{ matrix.py_cmd }} -m jupyter labextension list | |
${{ matrix.py_cmd }} -m jupyter server extension list | |
${{ matrix.py_cmd }} -m jupyter labextension list 2>&1 | grep -ie "jupyterlab-lsp.*enabled.*ok" - | |
${{ matrix.py_cmd }} -m jupyter server extension list 2>&1 | grep -ie "jupyter_lsp.*enabled" - | |
source: | |
name: smoke source install ${{ matrix.os }} py${{ matrix.python }} lab${{ matrix.lab }} | |
runs-on: ${{ matrix.os }}-latest | |
needs: [build] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu] | |
python: ['3.8', '3.11'] | |
nodejs: ['18'] | |
include: | |
- python: '3.8' | |
lab: '>=4,<5' | |
- python: '3.11' | |
lab: '>=4,<5' | |
steps: | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
architecture: 'x64' | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.nodejs }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: jupyterlab-lsp dist ${{ github.run_number }} | |
path: ./dist | |
- name: Install the prerequisites | |
run: python -m pip install --upgrade pip wheel setuptools | |
- name: Install JupyterLab | |
run: python -m pip install 'jupyterlab${{ matrix.lab }}' | |
- name: Install the server package | |
run: cd dist && python -m pip install -vv jupyter_lsp*.whl | |
- name: install the source extension | |
run: cd dist && jupyter labextension install jupyter-lsp-jupyterlab-lsp-*.tgz --log-level DEBUG | |
- name: Validate the install | |
run: | | |
set -eux | |
jupyter labextension list | |
jupyter server extension list | |
jupyter labextension list 2>&1 | grep -ie "jupyterlab-lsp.*enabled.*ok" - | |
jupyter server extension list 2>&1 | grep -ie "jupyter_lsp.*enabled" - |