Skip to content
This repository was archived by the owner on Jul 9, 2024. It is now read-only.
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
200 changes: 120 additions & 80 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,96 +2,136 @@ name: Build

on:
push:
branches: master
branches: main
pull_request:
branches: '*'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '14.x'
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
architecture: 'x64'

- name: Setup pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-3.7-${{ hashFiles('package.json') }}
restore-keys: |
pip-3.7-
pip-

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-

- name: Install dependencies
run: python -m pip install -U jupyterlab~=3.0 check-manifest
- name: Build the extension
run: |
jlpm
jlpm run eslint:check
python -m pip install .

jupyter labextension list 2>&1 | grep -ie "@jlab-enhanced/recents.*OK"
python -m jupyterlab.browser_check

- name: Build package
run: |
set -eux
check-manifest -v

pip install build
python -m build --sdist
cp dist/*.tar.gz myextension.tar.gz
pip uninstall -y myextension jupyterlab
rm -rf myextension

- uses: actions/upload-artifact@v2
with:
name: myextension-sdist
path: myextension.tar.gz
- name: Checkout
uses: actions/checkout@v2

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Install dependencies
run: python -m pip install -U jupyterlab~=3.0 check-manifest

- name: Lint the extension
run: |
set -eux
jlpm
jlpm run eslint:check

- name: Build the extension
run: |
set -eux
python -m pip install .

jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "@jlab-enhanced/recents.*OK"
python -m jupyterlab.browser_check

- name: Package the extension
run: |
set -eux
check-manifest -v

pip install build
python -m build
pip uninstall -y "jupyterlab_recents" jupyterlab

- name: Upload extension packages
uses: actions/upload-artifact@v2
with:
name: extension-artifacts
path: dist/jupyterlab_recents*
if-no-files-found: error

test_isolated:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
architecture: 'x64'
- uses: actions/download-artifact@v2
with:
name: myextension-sdist
- name: Install and Test
run: |
set -eux
# Remove NodeJS, twice to take care of system and locally installed node versions.
sudo rm -rf $(which node)
sudo rm -rf $(which node)
pip install myextension.tar.gz
pip install jupyterlab
jupyter labextension list 2>&1 | grep -ie "@jlab-enhanced/recents.*OK"
python -m jupyterlab.browser_check --no-chrome-test
- name: Checkout
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- uses: actions/download-artifact@v2
with:
name: extension-artifacts
- name: Install and Test
run: |
set -eux
# Remove NodeJS, twice to take care of system and locally installed node versions.
sudo rm -rf $(which node)
sudo rm -rf $(which node)

pip install "jupyterlab~=3.0" jupyterlab_recents*.whl


jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "@jlab-enhanced/recents.*OK"
python -m jupyterlab.browser_check --no-chrome-test

integration-tests:
name: Integration tests
needs: build
runs-on: ubuntu-latest

env:
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Download extension package
uses: actions/download-artifact@v2
with:
name: extension-artifacts

- name: Install the extension
run: |
set -eux
python -m pip install "jupyterlab~=3.0" jupyterlab_recents*.whl

- name: Install dependencies
working-directory: ui-tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: jlpm install

- name: Set up browser cache
uses: actions/cache@v2
with:
path: |
${{ github.workspace }}/pw-browsers
key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }}

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

- name: Execute integration tests
working-directory: ui-tests
run: |
jlpm playwright test

- name: Upload Playwright Test report
if: always()
uses: actions/upload-artifact@v2
with:
name: jupyterlab_recents-playwright-tests
path: |
ui-tests/test-results
ui-tests/playwright-report
44 changes: 44 additions & 0 deletions .github/workflows/update-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Update Playwright Snapshots

on:
issue_comment:
types: [created, edited]

permissions:
contents: write
pull-requests: write

jobs:


update-snapshots:
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, 'please update playwright snapshots') }}
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
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 dependencies
run: |
set -eux
jlpm
python -m pip install .

- uses: jupyterlab/maintainer-tools/.github/actions/update-snapshots@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Playwright knows how to start JupyterLab server
start_server_script: 'null'
test_folder: ui-tests

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,6 @@ dmypy.json

# OSX files
.DS_Store

ui-tests/playwright-report
ui-tests/test-results
4 changes: 3 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include LICENSE
include README.md
include *.md
include pyproject.toml

include package.json
Expand All @@ -12,6 +12,8 @@ graft jupyterlab_recents/labextension
# Javascript files
graft src
graft style
graft schema
graft ui-tests
prune **/node_modules
prune lib
prune binder
Expand Down
40 changes: 26 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
],
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
"style/index.js"
"style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
"schema/*.json"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand All @@ -38,32 +38,43 @@
"url": "https://github.com/jupyterlab-contrib/jupyterlab-recents.git"
},
"scripts": {
"build": "jlpm run build:lib && jlpm run build:labextension:dev",
"build": "jlpm build:lib && jlpm build:labextension:dev",
"build:prod": "jlpm clean && jlpm build:lib && jlpm build:labextension",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:lib": "tsc",
"build:prod": "jlpm run build:lib && jlpm run build:labextension",
"clean": "jlpm run clean:lib",
"clean:all": "jlpm run clean:lib && jlpm run clean:labextension",
"clean:labextension": "rimraf jupyterlab_recents/labextension",
"clean": "jlpm clean:lib",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"eslint": "eslint . --ext .ts,.tsx --fix",
"eslint:check": "eslint . --ext .ts,.tsx",
"install:extension": "jupyter labextension develop --overwrite .",
"prepare": "jlpm run clean && jlpm run build:prod",
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf {{ cookiecutter.python_name }}/labextension",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
"lint": "jlpm stylelint && jlpm prettier && jlpm eslint",
"lint:check": "jlpm stylelint:check && jlpm prettier:check && jlpm eslint:check",
"prettier": "jlpm prettier:base --write --list-different",
"prettier:base": "prettier \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"prettier:check": "jlpm prettier:base --check",
"stylelint": "jlpm stylelint:check --fix",
"stylelint:check": "stylelint --cache \"style/**/*.css\"",
"watch": "run-p watch:src watch:labextension",
"watch:labextension": "jupyter labextension watch .",
"watch:src": "tsc -w"
"watch:src": "tsc -w",
"watch:labextension": "jupyter labextension watch ."
},
"dependencies": {
"@jupyterlab/application": "^3.0.4",
"@jupyterlab/coreutils": "^5.0.2",
"@jupyterlab/docmanager": "^3.0.4",
"@jupyterlab/mainmenu": "^3.0.3",
"@jupyterlab/services": "^6.0.3",
"@jupyterlab/settingregistry": "^3.0.0",
"@jupyterlab/statedb": "^3.0.2",
"@jupyterlab/translation": "^3.0.0",
"@lumino/commands": "^1.12.0",
"@lumino/coreutils": "^1.5.3",
"@lumino/disposable": "^1.10.2",
"@lumino/polling": "^1.9.0",
"@lumino/signaling": "^1.4.3",
"@lumino/widgets": "^1.16.1"
},
Expand All @@ -81,7 +92,8 @@
},
"jupyterlab": {
"extension": true,
"outputDir": "jupyterlab_recents/labextension"
"outputDir": "jupyterlab_recents/labextension",
"schemaDir": "schema"
},
"styleModule": "style/index.js"
}
22 changes: 22 additions & 0 deletions schema/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"title": "Recent Files",
"description": "JupyterLab Recents settings.",
"type": "object",
"properties": {
"length": {
"title": "Recent item list length",
"description": "Number of items to store in the recent list.",
"type": "integer",
"default": 10,
"minimum": 1
},
"pollFrequency": {
"title": "Poll frequency to check the recent item list",
"description": "Poll frequency in seconds to check the recent item list. Set to 0 to deactivate; in that case it will refresh the list when the menu is displayed.",
"type": "number",
"default": 12,
"minimum": 0
}
},
"additionalProperties": false
}
Loading