Skip to content

Commit

Permalink
Merge pull request #23 from yacchin1205/feature/lab4.x
Browse files Browse the repository at this point in the history
Added Notebook 7 support
  • Loading branch information
yacchin1205 authored Apr 23, 2024
2 parents 50f431f + 54dd75c commit 29449cf
Show file tree
Hide file tree
Showing 77 changed files with 20,486 additions and 146 deletions.
19 changes: 19 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v4.2.1
_src_path: https://github.com/jupyterlab/extension-template
author_email: ''
author_name: National Institute of Informatics.
data_format: string
file_extension: ''
has_binder: true
has_settings: true
kind: frontend
labextension_name: nbsearch
mimetype: ''
mimetype_name: ''
project_short_description: NBSearch Jupyter Extension
python_name: nbsearch
repository: https://github.com/NII-cloud-operation/nbsearch/
test: true
viewer_name: ''

31 changes: 31 additions & 0 deletions .github/workflows/binder-on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Reference https://mybinder.readthedocs.io/en/latest/howto/gh-actions-badges.html
name: Binder Badge
on:
pull_request_target:
types: [opened]

permissions:
pull-requests: write


jobs:
binder:
runs-on: ubuntu-latest
steps:
- name: comment on PR with Binder link
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
var PR_HEAD_USERREPO = process.env.PR_HEAD_USERREPO;
var PR_HEAD_REF = process.env.PR_HEAD_REF;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${PR_HEAD_USERREPO}/${PR_HEAD_REF}?urlpath=lab) :point_left: Launch a Binder on branch _${PR_HEAD_USERREPO}/${PR_HEAD_REF}_`
})
env:
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
PR_HEAD_USERREPO: ${{ github.event.pull_request.head.repo.full_name }}

67 changes: 67 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build

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

jobs:
build:
runs-on: ubuntu-latest
steps:
- 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>=4.0.0,<5'

- name: Build the extension
run: |
set -eux
jlpm
jlpm lint:check
python -m pip install .
jupyter labextension list 2>&1 | grep -ie "nbsearch.*OK"
python -m jupyterlab.browser_check
pip install build
python -m build --sdist
cp dist/*.tar.gz myextension.tar.gz
pip uninstall -y "nbsearch" jupyterlab
rm -rf myextension
- uses: actions/upload-artifact@v2
with:
name: myextension-sdist
path: myextension.tar.gz

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.9'
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 "nbsearch.*OK"
python -m jupyterlab.browser_check --no-chrome-test
63 changes: 63 additions & 0 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Check Release
on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: write

jobs:
check_release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: 3.9
architecture: 'x64'
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 18


- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache pip
uses: actions/cache@v1
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('package.json') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache checked links
uses: actions/cache@v2
with:
path: ~/.cache/pytest-link-check
key: ${{ runner.os }}-linkcheck-${{ hashFiles('**/.md') }}-md-links
restore-keys: |
${{ runner.os }}-linkcheck-
- name: Upgrade packaging dependencies
run: |
pip install --upgrade pip setuptools wheel jupyter-packaging~=0.10 --user
- name: Install Dependencies
run: |
pip install .
- name: Check Release
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Distributions
uses: actions/upload-artifact@v2
with:
name: nbsearch-releaser-dist-${{ github.run_number }}
path: .jupyter_releaser_checkout/dist
125 changes: 125 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: Release

on:
workflow_dispatch:
push:
tags: ['*']

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'


- name: Setup pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-3.9-${{ hashFiles('package.json') }}
restore-keys: |
pip-3.9-
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>=4.0.0,<5'
- name: Build the extension
run: |
set -eux
jlpm
jlpm run eslint:check
python -m pip install .
jupyter labextension list 2>&1 | grep -ie "nbsearch.*OK"
python -m jupyterlab.browser_check
jlpm install
cd ./ui-tests
jlpm install
jlpm playwright install
jlpm playwright test
cd ..
pip install build
python -m build --sdist
cp dist/*.tar.gz myextension.tar.gz
pip uninstall -y myextension jupyterlab
rm -rf myextension
npm pack
mv nbsearch-*.tgz myextension-nodejs.tgz
- uses: actions/upload-artifact@v2
with:
name: myextension-sdist
path: myextension.tar.gz

- uses: actions/upload-artifact@v2
with:
name: myextension-nodejs
path: myextension-nodejs.tgz

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

steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: myextension-sdist
- uses: actions/download-artifact@v2
with:
name: myextension-nodejs
- name: release
uses: actions/create-release@v1
id: create_release
with:
draft: true
prerelease: false
release_name: ${{ github.ref }}
tag_name: ${{ github.ref }}
body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ github.token }}
- name: upload pip package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: myextension.tar.gz
asset_name: nbsearch-${{ github.ref_name }}.tar.gz
asset_content_type: application/gzip
- name: upload nodejs package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: myextension-nodejs.tgz
asset_name: nbsearch-${{ github.ref_name }}.tgz
asset_content_type: application/gzip
Loading

0 comments on commit 29449cf

Please sign in to comment.