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

Lab 4 Voila 0.5 migration #216

Merged
merged 12 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ coverage
# ms IDE stuff
.history/
.vscode/

ui-tests/playwright-report
49 changes: 45 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:
branches: '*'

jobs:
build:
lab-build:
name: JupyterLab Build
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -21,21 +22,20 @@ jobs:
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
python-version: '3.10'
architecture: 'x64'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install jupyter_packaging jupyterlab
python -m pip install jupyter_packaging jupyterlab hatch

- name: Install the extension
run: |
python -m pip install .

- name: Check the extensions are installed
run: |
jupyter nbextension list 2>&1 | grep -ie "voila-gridstack/extension.*enabled" -
martinRenou marked this conversation as resolved.
Show resolved Hide resolved
jupyter labextension list 2>&1 | grep -ie "@voila-dashboards/jupyterlab-gridstack.*enabled.*ok" -
python -m jupyterlab.browser_check

Expand All @@ -49,3 +49,44 @@ jobs:
run: |
jlpm && jlpm build
jlpm run test

- name: Build the extension
run: |
python -m hatch build

- uses: actions/upload-artifact@v3
with:
name: gridstack-package
path: dist/*.whl

classic-notebook:
name: Notebook v6 Build
needs: lab-build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- uses: actions/download-artifact@v3
with:
name: gridstack-package
path: dist

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
architecture: 'x64'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install "notebook<7"

- name: Install the extension
run: |
pip install dist/*.whl

- name: Check the extensions are installed
run: |
jupyter nbextension list 2>&1 | grep -ie "voila-gridstack/extension.*enabled" -
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9, "3.10"]
python-version: [3.8, 3.9, "3.10", "3.11"]

steps:
- uses: actions/checkout@v1
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/ui-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: UI Test

on:
push:
branches: [main]
pull_request:
branches: '*'

jobs:
ui-tests:
name: Visual Regression
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install node
uses: actions/setup-node@v1
with:
node-version: '18.x'

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
architecture: 'x64'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install jupyter_packaging jupyterlab

- name: Install the extension
run: |
python -m pip install ".[test]"
jlpm run build
jlpm run develop
jupyter labextension list
cd ui-tests
jlpm install

- name: Install browser
run: npx playwright install chromium
working-directory: ui-tests

- name: Test
run: jlpm run test
working-directory: ui-tests

- name: Upload Playwright Test assets
if: always()
uses: actions/upload-artifact@v2
with:
name: gridstack-test-assets
path: |
ui-tests/test-results
47 changes: 47 additions & 0 deletions .github/workflows/update_galata_references.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Update UI-tests References

on:
issue_comment:
types: [created, edited]

permissions:
contents: write
pull-requests: write

defaults:
run:
shell: bash -l {0}

jobs:
update-reference-screenshots:
name: Update UI Tests References
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, 'update playwright snapshots') }}
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Configure git to use https
run: git config --global hub.protocol https

- name: Checkout the branch from the PR that triggered the job
run: hub pr checkout ${{ github.event.issue.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install Micromamba
uses: mamba-org/provision-with-micromamba@main

- name: Install dependencies and build tests
run: |
python -m pip install ".[test]"
cd ui-tests
jlpm install --immutable

- uses: jupyterlab/maintainer-tools/.github/actions/update-snapshots@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
test_folder: ui-tests
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,10 @@ dmypy.json
_temp_extension
junit.xml
[uU]ntitled*
.yarn/

ui-tests/playwright-report
ui-tests/test-results
ui-tests/benchmark-results
ui-tests/jlab_root
ui-tests/examples
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ coverage
# ms IDE stuff
.history/
.vscode/

ui-tests/playwright-report
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
6 changes: 3 additions & 3 deletions examples/iris_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@
}
],
"source": [
"sns.FacetGrid(df, hue=\"Species\", size=5).map(plt.scatter, \"SepalLengthCm\", \"SepalWidthCm\").add_legend();"
"sns.FacetGrid(df, hue=\"Species\").map(plt.scatter, \"SepalLengthCm\", \"SepalWidthCm\").add_legend();"
]
},
{
Expand Down Expand Up @@ -528,7 +528,7 @@
}
},
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -542,7 +542,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.6"
"version": "3.10.13"
}
},
"nbformat": 4,
Expand Down
35 changes: 9 additions & 26 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,25 @@
const jestJupyterLab = require('@jupyterlab/testutils/lib/jest-config');

const esModules = [
'@codemirror',
'@jupyter/ydoc',
'@jupyterlab/',
'lib0',
'y\\-protocols',
'y\\-websocket',
'yjs',
'nanoid',
'vscode-ws-jsonrpc',
'y-protocols',
'y-websocket',
'yjs'
].join('|');

const jlabConfig = jestJupyterLab(__dirname);

const {
moduleFileExtensions,
moduleNameMapper,
preset,
setupFilesAfterEnv,
setupFiles,
testPathIgnorePatterns,
transform,
} = jlabConfig;

const {reporters, ...base} = jestJupyterLab(__dirname);
module.exports = {
moduleFileExtensions,
moduleNameMapper,
preset,
setupFilesAfterEnv,
setupFiles,
testPathIgnorePatterns,
transform,
...base,
automock: false,
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!src/**/*.d.ts'],
coverageDirectory: 'coverage',
coverageReporters: ['lcov', 'text'],
globals: {
'ts-jest': {
tsconfig: 'tsconfig.json',
},
},
testRegex: 'src/.*/.*.spec.ts[x]?$',
transformIgnorePatterns: [`/node_modules/(?!${esModules}).+`],
};
Loading
Loading