Skip to content

Commit 179c3de

Browse files
committed
Apply lab template
1 parent 989d757 commit 179c3de

38 files changed

+1193
-165
lines changed

.copier-answers.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2+
_commit: v4.3.0
3+
_src_path: https://github.com/jupyterlab/extension-template
4+
author_email: ''
5+
author_name: Datalayer
6+
has_binder: true
7+
has_settings: false
8+
kind: server
9+
labextension_name: jupyter-server-nbmodel
10+
project_short_description: A Jupyter Server extension to execute code cell from the
11+
server.
12+
python_name: jupyter_server_nbmodel
13+
repository: https://github.com/datalayer/jupyter-server-nbmodel
14+
test: true
15+

.github/workflows/binder-on-pr.yml

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,14 @@
1-
# Reference https://mybinder.readthedocs.io/en/latest/howto/gh-actions-badges.html
21
name: Binder Badge
32
on:
43
pull_request_target:
54
types: [opened]
65

7-
permissions:
8-
pull-requests: write
9-
10-
116
jobs:
127
binder:
138
runs-on: ubuntu-latest
9+
permissions:
10+
pull-requests: write
1411
steps:
15-
- name: comment on PR with Binder link
16-
uses: actions/github-script@v7
12+
- uses: jupyterlab/maintainer-tools/.github/actions/binder-link@v1
1713
with:
18-
github-token: ${{secrets.GITHUB_TOKEN}}
19-
script: |
20-
var PR_HEAD_USERREPO = process.env.PR_HEAD_USERREPO;
21-
var PR_HEAD_REF = process.env.PR_HEAD_REF;
22-
github.issues.createComment({
23-
issue_number: context.issue.number,
24-
owner: context.repo.owner,
25-
repo: context.repo.repo,
26-
body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${PR_HEAD_USERREPO}/${PR_HEAD_REF}) :point_left: Launch a Binder on branch _${PR_HEAD_USERREPO}/${PR_HEAD_REF}_`
27-
})
28-
env:
29-
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
30-
PR_HEAD_USERREPO: ${{ github.event.pull_request.head.repo.full_name }}
31-
14+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build.yml

Lines changed: 133 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -2,103 +2,159 @@ name: Build
22

33
on:
44
push:
5-
branches: ["main"]
5+
branches: main
66
pull_request:
7-
schedule:
8-
- cron: "0 0 * * *"
7+
branches: '*'
98

10-
defaults:
11-
run:
12-
shell: bash -eux {0}
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
1312

1413
jobs:
1514
build:
1615
runs-on: ubuntu-latest
17-
strategy:
18-
fail-fast: false
19-
matrix:
20-
os: [ubuntu-latest, macos-latest, windows-latest]
21-
python-version: ["3.8", "3.12"]
2216

2317
steps:
24-
- name: Checkout
25-
uses: actions/checkout@v4
18+
- name: Checkout
19+
uses: actions/checkout@v4
2620

27-
- name: Base Setup
28-
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
21+
- name: Base Setup
22+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
2923

30-
- name: Install dependencies
31-
run: python -m pip install -U jupyter_server
24+
- name: Install dependencies
25+
run: python -m pip install -U "jupyterlab>=4.0.0,<5"
3226

33-
- name: Build the extension
34-
run: |
35-
python -m pip install .
36-
jupyter server extension list 2>&1 | grep -ie "jupyter_server_nbmodel.*OK"
27+
- name: Lint the extension
28+
run: |
29+
set -eux
30+
jlpm
31+
jlpm run lint:check
3732
38-
pip install build
39-
python -m build --sdist
40-
cp dist/*.tar.gz my_server_extension.tar.gz
41-
pip uninstall -y "jupyter_server_nbmodel" jupyter_server
42-
rm -rf "jupyter_server_nbmodel"
33+
- name: Test the extension
34+
run: |
35+
set -eux
36+
jlpm run test
4337
44-
- uses: actions/upload-artifact@v4
45-
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
46-
with:
47-
name: my_server_extension-sdist
48-
path: my_server_extension.tar.gz
38+
- name: Build the extension
39+
run: |
40+
set -eux
41+
python -m pip install .[test]
4942
50-
check_links:
43+
pytest -vv -r ap --cov jupyter_server_nbmodel
44+
jupyter server extension list
45+
jupyter server extension list 2>&1 | grep -ie "jupyter_server_nbmodel.*OK"
46+
47+
jupyter labextension list
48+
jupyter labextension list 2>&1 | grep -ie "jupyter-server-nbmodel.*OK"
49+
python -m jupyterlab.browser_check
50+
51+
- name: Package the extension
52+
run: |
53+
set -eux
54+
55+
pip install build
56+
python -m build
57+
pip uninstall -y "jupyter_server_nbmodel" jupyterlab
58+
59+
- name: Upload extension packages
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: extension-artifacts
63+
path: dist/jupyter_server_nbmodel*
64+
if-no-files-found: error
65+
66+
test_isolated:
67+
needs: build
5168
runs-on: ubuntu-latest
69+
5270
steps:
53-
- uses: actions/checkout@v4
54-
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
55-
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
71+
- name: Install Python
72+
uses: actions/setup-python@v5
73+
with:
74+
python-version: '3.9'
75+
architecture: 'x64'
76+
- uses: actions/download-artifact@v4
77+
with:
78+
name: extension-artifacts
79+
- name: Install and Test
80+
run: |
81+
set -eux
82+
# Remove NodeJS, twice to take care of system and locally installed node versions.
83+
sudo rm -rf $(which node)
84+
sudo rm -rf $(which node)
85+
86+
pip install "jupyterlab>=4.0.0,<5" jupyter_server_nbmodel*.whl
87+
88+
89+
jupyter server extension list
90+
jupyter server extension list 2>&1 | grep -ie "jupyter_server_nbmodel.*OK"
5691
57-
test_lint:
92+
jupyter labextension list
93+
jupyter labextension list 2>&1 | grep -ie "jupyter-server-nbmodel.*OK"
94+
python -m jupyterlab.browser_check --no-browser-test
95+
96+
integration-tests:
97+
name: Integration tests
98+
needs: build
5899
runs-on: ubuntu-latest
100+
101+
env:
102+
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers
103+
59104
steps:
60-
- uses: actions/checkout@v4
61-
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
62-
- name: Run Linters
63-
run: |
64-
bash ./.github/workflows/lint.sh
105+
- name: Checkout
106+
uses: actions/checkout@v4
107+
108+
- name: Base Setup
109+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
110+
111+
- name: Download extension package
112+
uses: actions/download-artifact@v4
113+
with:
114+
name: extension-artifacts
115+
116+
- name: Install the extension
117+
run: |
118+
set -eux
119+
python -m pip install "jupyterlab>=4.0.0,<5" jupyter_server_nbmodel*.whl
120+
121+
- name: Install dependencies
122+
working-directory: ui-tests
123+
env:
124+
YARN_ENABLE_IMMUTABLE_INSTALLS: 0
125+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
126+
run: jlpm install
127+
128+
- name: Set up browser cache
129+
uses: actions/cache@v4
130+
with:
131+
path: |
132+
${{ github.workspace }}/pw-browsers
133+
key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }}
134+
135+
- name: Install browser
136+
run: jlpm playwright install chromium
137+
working-directory: ui-tests
138+
139+
- name: Execute integration tests
140+
working-directory: ui-tests
141+
run: |
142+
jlpm playwright test
65143
66-
check_release:
144+
- name: Upload Playwright Test report
145+
if: always()
146+
uses: actions/upload-artifact@v4
147+
with:
148+
name: jupyter_server_nbmodel-playwright-tests
149+
path: |
150+
ui-tests/test-results
151+
ui-tests/playwright-report
152+
153+
check_links:
154+
name: Check Links
67155
runs-on: ubuntu-latest
156+
timeout-minutes: 15
68157
steps:
69158
- uses: actions/checkout@v4
70-
- name: Base Setup
71-
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
72-
- name: Install Dependencies
73-
run: |
74-
pip install -e .
75-
- name: Check Release
76-
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
77-
with:
78-
token: ${{ secrets.GITHUB_TOKEN }}
79-
- name: Upload Distributions
80-
uses: actions/upload-artifact@v4
81-
with:
82-
name: jupyter_server_nbmodel-releaser-dist-${{ github.run_number }}
83-
path: .jupyter_releaser_checkout/dist
84-
85-
test_sdist:
86-
needs: build
87-
runs-on: ubuntu-latest
88-
89-
steps:
90-
- name: Checkout
91-
uses: actions/checkout@v4
92-
- name: Install Python
93-
uses: actions/setup-python@v5
94-
with:
95-
python-version: "3.8"
96-
architecture: "x64"
97-
- uses: actions/download-artifact@v4
98-
with:
99-
name: my_server_extension-sdist
100-
- name: Install and Test
101-
run: |
102-
pip install my_server_extension.tar.gz
103-
pip install jupyter_server
104-
jupyter server extension list 2>&1 | grep -ie "jupyter_server_nbmodel.*OK"
159+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
160+
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1

.github/workflows/check-release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Check Release
2+
on:
3+
push:
4+
branches: ["main"]
5+
pull_request:
6+
branches: ["*"]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
check_release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: Base Setup
19+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
20+
- name: Check Release
21+
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
22+
with:
23+
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Upload Distributions
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: jupyter_server_nbmodel-releaser-dist-${{ github.run_number }}
30+
path: .jupyter_releaser_checkout/dist

.github/workflows/enforce-label.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Enforce PR label
2+
3+
on:
4+
pull_request:
5+
types: [labeled, unlabeled, opened, edited, synchronize]
6+
jobs:
7+
enforce-label:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
pull-requests: write
11+
steps:
12+
- name: enforce-triage-label
13+
uses: jupyterlab/maintainer-tools/.github/actions/enforce-label@v1

.github/workflows/prep-release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: "Step 1: Prep Release"
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version_spec:
6+
description: "New Version Specifier"
7+
default: "next"
8+
required: false
9+
branch:
10+
description: "The branch to target"
11+
required: false
12+
post_version_spec:
13+
description: "Post Version Specifier"
14+
required: false
15+
# silent:
16+
# description: "Set a placeholder in the changelog and don't publish the release."
17+
# required: false
18+
# type: boolean
19+
since:
20+
description: "Use PRs with activity since this date or git reference"
21+
required: false
22+
since_last_stable:
23+
description: "Use PRs with activity since the last stable git tag"
24+
required: false
25+
type: boolean
26+
jobs:
27+
prep_release:
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: write
31+
steps:
32+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
33+
34+
- name: Prep Release
35+
id: prep-release
36+
uses: jupyter-server/jupyter_releaser/.github/actions/prep-release@v2
37+
with:
38+
token: ${{ secrets.GITHUB_TOKEN }}
39+
version_spec: ${{ github.event.inputs.version_spec }}
40+
# silent: ${{ github.event.inputs.silent }}
41+
post_version_spec: ${{ github.event.inputs.post_version_spec }}
42+
branch: ${{ github.event.inputs.branch }}
43+
since: ${{ github.event.inputs.since }}
44+
since_last_stable: ${{ github.event.inputs.since_last_stable }}
45+
46+
- name: "** Next Step **"
47+
run: |
48+
echo "Optional): Review Draft Release: ${{ steps.prep-release.outputs.release_url }}"

0 commit comments

Comments
 (0)