Restore the use of contentHeader
, make CI green, improve scripts
#944
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 | |
pull_request: | |
branches: '*' | |
jobs: | |
build_extensions: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
example: | |
- clap-button-message | |
- cell-toolbar | |
- codemirror-extension | |
- command-palette | |
- commands | |
- completer | |
- contentheader | |
- context-menu | |
- custom-log-console | |
- datagrid | |
- documents | |
- hello-world | |
- launcher | |
- kernel-messaging | |
- kernel-output | |
- log-messages | |
- main-menu | |
- metadata-form | |
- notifications | |
- react-widget | |
- settings | |
- shout-button-message | |
- signals | |
- state | |
- toolbar-button | |
- toparea-text-widget | |
- widgets | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
defaults: | |
run: | |
working-directory: ${{ matrix.example }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Path filter | |
id: filter | |
uses: dorny/paths-filter@v2 | |
with: | |
filters: | | |
extension: | |
- '${{ matrix.example }}/**' | |
- name: Cache lerna | |
if: steps.filter.outputs.extension == 'true' | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-lerna-${{ hashFiles('**/package.json') }} | |
restore-keys: ${{ runner.os }}-lerna- | |
- name: Check config files | |
if: steps.filter.outputs.extension == 'true' | |
run: | | |
diff ../hello-world/setup.py setup.py | |
diff ../hello-world/tsconfig.json tsconfig.json | |
diff ../hello-world/.yarnrc.yml .yarnrc.yml | |
diff ../hello-world/ui-tests/jupyter_server_test_config.py ./ui-tests/jupyter_server_test_config.py | |
diff ../hello-world/ui-tests/playwright.config.js ./ui-tests/playwright.config.js | |
shell: bash | |
- name: Install node | |
if: steps.filter.outputs.extension == 'true' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
- name: Install Python | |
if: steps.filter.outputs.extension == 'true' | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
architecture: 'x64' | |
- name: Get pip cache dir | |
if: steps.filter.outputs.extension == 'true' | |
id: pip-cache | |
run: | | |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache pip | |
if: steps.filter.outputs.extension == 'true' | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('environment.yml') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install the Python dependencies | |
if: steps.filter.outputs.extension == 'true' | |
run: | | |
python -m pip install --upgrade pip "jupyterlab>=4.0.0" | |
# This is challenging to test in collaboration; | |
# got trouble with the file ID service and the uncontrolled auto-save | |
# - if: steps.filter.outputs.extension == 'true' && matrix.example == 'clap-button-message' | |
# run: | | |
# python -m pip install jupyter-collaboration | |
- name: Build the extension | |
if: steps.filter.outputs.extension == 'true' | |
run: | | |
# Same commands as in TL;DR to ensure it works | |
touch yarn.lock | |
pip install -e . -v | |
jupyter labextension develop . --overwrite | |
shell: bash | |
- name: Lint the files | |
if: steps.filter.outputs.extension == 'true' | |
run: jlpm run lint:check | |
- name: Check extension installation | |
if: steps.filter.outputs.extension == 'true' | |
run: | | |
jupyter labextension list 2>&1 | tee labextension.list | |
cat labextension.list | grep -ie "@jupyterlab-examples/*.*OK" | |
# clap-button-message example will have one plugin failing as it is requiring a | |
# Jupyter Notebook specific token. This is expected. Hence we need to skip this | |
# test for that example | |
- if: steps.filter.outputs.extension == 'true' && matrix.example != 'clap-button-message' | |
run: | | |
python -m jupyterlab.browser_check | |
- name: Install galata | |
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux') | |
working-directory: ${{ matrix.example }}/ui-tests | |
env: | |
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | |
run: jlpm install | |
- name: Set up browser cache | |
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux') | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ github.workspace }}/pw-browsers | |
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
- name: Install browser | |
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux') | |
run: jlpm playwright install chromium | |
working-directory: ${{ matrix.example }}/ui-tests | |
- name: Install kernel-output dependencies | |
if: steps.filter.outputs.extension == 'true' && matrix.example == 'kernel-output' | |
run: pip install numpy pandas | |
- name: Integration tests | |
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux') | |
working-directory: ${{ matrix.example }}/ui-tests | |
run: jlpm playwright test | |
- name: Upload UI Test artifacts | |
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux') && always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ui-test-output | |
path: | | |
${{ matrix.example }}/ui-tests/test-results | |
- name: Uninstall extension | |
if: steps.filter.outputs.extension == 'true' && ( startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') ) | |
run: | | |
export NAME=`python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['name'])"` | |
pip uninstall -y ${NAME} | |
build_serverextension: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Path filter | |
id: filter | |
uses: dorny/paths-filter@v2 | |
with: | |
filters: | | |
extension: | |
- 'server-extension/**' | |
- name: Cache lerna | |
if: steps.filter.outputs.extension == 'true' | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-lerna-${{ hashFiles('server-extension/package.json') }} | |
restore-keys: ${{ runner.os }}-lerna- | |
- name: Install node | |
if: steps.filter.outputs.extension == 'true' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
- name: Check config files | |
if: steps.filter.outputs.extension == 'true' | |
run: | | |
diff hello-world/setup.py server-extension/setup.py | |
diff hello-world/tsconfig.json server-extension/tsconfig.json | |
diff hello-world/.yarnrc.yml server-extension/.yarnrc.yml | |
diff hello-world/ui-tests/jupyter_server_test_config.py server-extension/ui-tests/jupyter_server_test_config.py | |
diff hello-world/ui-tests/playwright.config.js server-extension/ui-tests/playwright.config.js | |
shell: bash | |
- name: Install Python | |
if: steps.filter.outputs.extension == 'true' | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
architecture: 'x64' | |
- name: Get pip cache dir | |
if: steps.filter.outputs.extension == 'true' | |
id: pip-cache | |
run: | | |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache pip | |
if: steps.filter.outputs.extension == 'true' | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('environment.yml') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install the Python dependencies | |
if: steps.filter.outputs.extension == 'true' | |
run: | | |
python -m pip install --upgrade pip jupyterlab~=4.0.0 build | |
- name: Install the NPM dependencies | |
if: steps.filter.outputs.extension == 'true' | |
run: | | |
cd server-extension | |
jlpm | |
- name: Lint the files | |
if: steps.filter.outputs.extension == 'true' | |
run: | | |
cd server-extension | |
jlpm run lint:check | |
- name: Build extension as user | |
if: steps.filter.outputs.extension == 'true' | |
# Force the usage of the source distribution (good practice) | |
run: | | |
cd server-extension | |
python -m build --sdist | |
pip install ./dist/jupyterlab_examples_server* --pre --find-links=dist --no-cache-dir | |
python -m jupyterlab.browser_check | |
- name: Check extension as dev | |
if: steps.filter.outputs.extension == 'true' && ( startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') ) | |
run: | | |
jupyter server extension list 2>&1 | tee serverextension.list | |
cat serverextension.list | grep -ie "jupyterlab_examples_server.*OK" | |
jupyter labextension list 2>&1 | tee labextension.list | |
cat labextension.list | grep -ie "@jupyterlab-examples/server-extension.*OK" | |
- name: Clean extension installation | |
if: steps.filter.outputs.extension == 'true' | |
run: | | |
pip uninstall -y jupyterlab_examples_server | |
jupyter lab clean | |
jupyter server extension list | |
jupyter labextension list | |
- name: Build extension as dev | |
if: steps.filter.outputs.extension == 'true' | |
run: | | |
cd server-extension | |
pip install . | |
- name: Check extension as dev | |
if: steps.filter.outputs.extension == 'true' && ( startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') ) | |
run: | | |
jupyter server extension list 2>&1 | tee serverextension.list | |
cat serverextension.list | grep -ie "jupyterlab_examples_server.*OK" | |
jupyter labextension list 2>&1 | tee labextension.list | |
cat labextension.list | grep -ie "@jupyterlab-examples/server-extension.*OK" | |
python -m jupyterlab.browser_check | |
- name: Install galata | |
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux') | |
working-directory: server-extension/ui-tests | |
env: | |
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | |
run: jlpm install | |
- name: Set up browser cache | |
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux') | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ github.workspace }}/pw-browsers | |
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
- name: Install browser | |
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux') | |
run: jlpm playwright install chromium | |
working-directory: server-extension/ui-tests | |
- name: Integration tests | |
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux') | |
working-directory: server-extension/ui-tests | |
run: jlpm playwright test | |
- name: Upload UI Test artifacts | |
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux') && always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ui-test-output | |
path: | | |
server-extension/ui-tests/test-results | |
- name: Uninstall extension | |
if: steps.filter.outputs.extension == 'true' && ( startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') ) | |
run: | | |
export NAME=`python -c "import tomllib; print(tomllib.load(open('server-extension/pyproject.toml', 'rb'))['project']['name'])"` | |
pip uninstall -y ${NAME} | |
build_all: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache lerna | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-lerna-${{ hashFiles('**/package.json') }} | |
restore-keys: ${{ runner.os }}-lerna- | |
- name: Install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
architecture: 'x64' | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache pip | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('environment.yml') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install the Python dependencies | |
run: python -m pip install jupyterlab~=4.0.0 pytest pytest-check-links "pytest-jupyter[server]>=0.6.0" | |
- name: Bootstrap the jlpm deps | |
run: jlpm | |
- name: Build all the extensions | |
run: | | |
# Check embedded snippets | |
jlpm lint:check | |
# Check links as last step as new tutorial may set links not yet valid (like file not yet in main) | |
jlpm run lerna exec --concurrency 4 -- "pytest --check-links" |