Skip to content

Commit 03b1a97

Browse files
authored
Replace - by _ in python_name (#157)
* Replace - by _ in python_name * Fix CI * correct frontend extension name * Fix browser check test
1 parent 6a41739 commit 03b1a97

File tree

14 files changed

+248
-199
lines changed

14 files changed

+248
-199
lines changed

.github/workflows/main.yml

Lines changed: 221 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -2,178 +2,237 @@ name: CI
22

33
on:
44
push:
5-
branches: '*'
5+
branches: "*"
66
pull_request:
7-
branches: '*'
7+
branches: "*"
88
schedule:
9-
- cron: '0 0 * * *'
9+
- cron: "0 0 * * *"
1010

1111
jobs:
12-
build:
12+
names:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
include:
17+
- name: "my_extension"
18+
- name: "myextension"
19+
- name: "my-extension"
1320

21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v2
24+
- name: Install node
25+
uses: actions/setup-node@v1
26+
with:
27+
node-version: "12.x"
28+
- name: Install Python
29+
uses: actions/setup-python@v2
30+
with:
31+
python-version: "3.7"
32+
architecture: "x64"
33+
34+
- name: Setup pip cache
35+
uses: actions/cache@v2
36+
with:
37+
path: ~/.cache/pip
38+
key: pip-3.7-${{ hashFiles('package.json') }}
39+
restore-keys: |
40+
pip-3.7-
41+
pip-
42+
43+
- name: Get yarn cache directory path
44+
id: yarn-cache-dir-path
45+
run: echo "::set-output name=dir::$(yarn cache dir)"
46+
47+
- name: Setup yarn cache
48+
uses: actions/cache@v2
49+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
50+
with:
51+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
52+
key: yarn-${{ hashFiles('**/yarn.lock') }}
53+
restore-keys: |
54+
yarn-
55+
56+
- name: Install dependencies
57+
run: |
58+
python -m pip install cookiecutter check-manifest build
59+
60+
- name: Create pure frontend extension
61+
env:
62+
NAME: ${{ matrix.name }}
63+
run: |
64+
set -eux
65+
# Trick to use custom parameters
66+
python -c "from cookiecutter.main import cookiecutter; import json, os; f=open('cookiecutter.json'); d=json.load(f); f.close(); d['python_name']=os.getenv('NAME'); cookiecutter('.', extra_context=d, no_input=True)"
67+
pushd ${NAME}
68+
pip install jupyterlab
69+
jlpm install && jlpm run eslint:check
70+
pip install -e .
71+
jupyter labextension develop . --overwrite
72+
jupyter labextension list
73+
jupyter labextension list 2>&1 | grep -ie "${NAME}.*OK"
74+
python -m jupyterlab.browser_check
75+
76+
jupyter labextension uninstall ${NAME}
77+
pip uninstall -y ${NAME} jupyterlab
78+
79+
git init && git add .
80+
check-manifest -v
81+
82+
popd
83+
rm -rf ${NAME}
84+
85+
server:
1486
runs-on: ubuntu-latest
1587

1688
steps:
17-
- name: Checkout
18-
uses: actions/checkout@v2
19-
- name: Install node
20-
uses: actions/setup-node@v1
21-
with:
22-
node-version: '12.x'
23-
- name: Install Python
24-
uses: actions/setup-python@v2
25-
with:
26-
python-version: '3.7'
27-
architecture: 'x64'
28-
29-
- name: Setup pip cache
30-
uses: actions/cache@v2
31-
with:
32-
path: ~/.cache/pip
33-
key: pip-3.7-${{ hashFiles('package.json') }}
34-
restore-keys: |
35-
pip-3.7-
36-
pip-
37-
38-
- name: Get yarn cache directory path
39-
id: yarn-cache-dir-path
40-
run: echo "::set-output name=dir::$(yarn cache dir)"
41-
- name: Setup yarn cache
42-
uses: actions/cache@v2
43-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
44-
with:
45-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
46-
key: yarn-${{ hashFiles('**/yarn.lock') }}
47-
restore-keys: |
48-
yarn-
49-
50-
- name: Install dependencies
51-
run: |
52-
python -m pip install cookiecutter check-manifest build
53-
54-
- name: Create pure frontend extension
55-
run: |
56-
set -eux
57-
cookiecutter . --no-input
58-
pushd myextension
59-
pip install jupyterlab
60-
jlpm install && jlpm run eslint:check
61-
pip install -e .
62-
jupyter labextension develop . --overwrite
63-
jupyter labextension list
64-
jupyter labextension list 2>&1 | grep -ie "myextension.*OK"
65-
python -m jupyterlab.browser_check
66-
67-
jupyter labextension uninstall myextension
68-
pip uninstall -y myextension jupyterlab
69-
70-
git init && git add .
71-
check-manifest -v
72-
73-
popd
74-
rm -rf myextension
75-
76-
- name: Create server extension pip install
77-
run: |
78-
set -eux
79-
# Trick to use custom parameters
80-
python -c "from cookiecutter.main import cookiecutter; import json; f = open('cookiecutter_with_server.json'); cookiecutter('.', extra_context=json.load(f), no_input=True); f.close()"
81-
pip install ./myextension
82-
pip install jupyterlab
83-
jupyter server extension list
84-
jupyter server extension list 2>&1 | grep -ie "myextension.*OK"
85-
jupyter labextension list
86-
jupyter labextension list 2>&1 | grep -ie "my_lab_extension.*OK"
87-
python -m jupyterlab.browser_check
88-
89-
pip uninstall -y myextension jupyterlab
90-
rm -rf myextension
91-
92-
- name: Create server extension pip develop
93-
run: |
94-
set -eux
95-
# Trick to use custom parameters
96-
python -c "from cookiecutter.main import cookiecutter; import json; f = open('cookiecutter_with_server.json'); cookiecutter('.', extra_context=json.load(f), no_input=True); f.close()"
97-
pushd myextension
98-
pip install -e .
99-
pip install jupyterlab
100-
jupyter labextension develop . --overwrite
101-
jupyter server extension enable myextension
102-
jupyter server extension list
103-
jupyter server extension list 2>&1 | grep -ie "myextension.*OK"
104-
jupyter labextension list
105-
jupyter labextension list 2>&1 | grep -ie "my_lab_extension.*OK"
106-
python -m jupyterlab.browser_check
107-
108-
jupyter labextension develop . --overwrite
109-
jupyter labextension build .
110-
111-
jupyter labextension uninstall my_lab_extension
112-
pip uninstall -y myextension jupyterlab
113-
popd
114-
rm -rf myextension
115-
116-
- name: Install server extension from a tarball
117-
run: |
118-
set -eux
119-
# Trick to use custom parameters
120-
python -c "from cookiecutter.main import cookiecutter; import json; f = open('cookiecutter_with_server.json'); cookiecutter('.', extra_context=json.load(f), no_input=True); f.close()"
121-
pushd myextension
122-
pip install --pre jupyterlab
123-
jupyter lab clean --all
124-
python -m build --sdist
125-
pip install dist/*.tar.gz
126-
jupyter labextension list
127-
jupyter labextension list 2>&1 | grep -ie "my_lab_extension.*OK"
128-
jupyter server extension list
129-
jupyter server extension list 2>&1 | grep -ie "myextension.*OK"
130-
131-
jupyter lab build --dev-build --no-minimize
132-
python -m jupyterlab.browser_check
133-
134-
cp dist/*.tar.gz ../myextension.tar.gz
135-
pip uninstall -y myextension jupyterlab
136-
popd
137-
rm -rf myextension
138-
139-
- uses: actions/upload-artifact@v2
140-
with:
141-
name: myextension-sdist
142-
path: myextension.tar.gz
89+
- name: Checkout
90+
uses: actions/checkout@v2
91+
- name: Install node
92+
uses: actions/setup-node@v1
93+
with:
94+
node-version: "12.x"
95+
- name: Install Python
96+
uses: actions/setup-python@v2
97+
with:
98+
python-version: "3.7"
99+
architecture: "x64"
100+
101+
- name: Setup pip cache
102+
uses: actions/cache@v2
103+
with:
104+
path: ~/.cache/pip
105+
key: pip-3.7-${{ hashFiles('package.json') }}
106+
restore-keys: |
107+
pip-3.7-
108+
pip-
109+
110+
- name: Get yarn cache directory path
111+
id: yarn-cache-dir-path
112+
run: echo "::set-output name=dir::$(yarn cache dir)"
113+
114+
- name: Setup yarn cache
115+
uses: actions/cache@v2
116+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
117+
with:
118+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
119+
key: yarn-${{ hashFiles('**/yarn.lock') }}
120+
restore-keys: |
121+
yarn-
122+
123+
- name: Install dependencies
124+
run: |
125+
python -m pip install cookiecutter check-manifest build
126+
127+
- name: Create server extension pip install
128+
run: |
129+
set -eux
130+
# Trick to use custom parameters
131+
python -c "from cookiecutter.main import cookiecutter; import json; f=open('cookiecutter.json'); d=json.load(f); f.close(); d['has_server_extension']='y'; cookiecutter('.', extra_context=d, no_input=True)"
132+
pushd myextension
133+
pip install .
134+
pip install jupyterlab
135+
jupyter server extension list
136+
jupyter server extension list 2>&1 | grep -ie "myextension.*OK"
137+
jupyter labextension list
138+
jupyter labextension list 2>&1 | grep -ie "myextension.*OK"
139+
popd
140+
# This test should be made outside the extension folder
141+
python -m jupyterlab.browser_check
142+
143+
pip uninstall -y myextension jupyterlab
144+
rm -rf myextension
145+
146+
- name: Create server extension pip develop
147+
run: |
148+
set -eux
149+
# Trick to use custom parameters
150+
python -c "from cookiecutter.main import cookiecutter; import json; f=open('cookiecutter.json'); d=json.load(f); f.close(); d['has_server_extension']='y'; cookiecutter('.', extra_context=d, no_input=True)"
151+
pushd myextension
152+
pip install -e .
153+
pip install jupyterlab
154+
jupyter labextension develop . --overwrite
155+
jupyter server extension enable myextension
156+
jupyter server extension list
157+
jupyter server extension list 2>&1 | grep -ie "myextension.*OK"
158+
jupyter labextension list
159+
jupyter labextension list 2>&1 | grep -ie "myextension.*OK"
160+
161+
popd
162+
163+
# This test should be made outside the extension folder
164+
python -m jupyterlab.browser_check
165+
166+
jupyter labextension develop ./myextension --overwrite
167+
jupyter labextension build ./myextension
168+
169+
jupyter labextension uninstall myextension
170+
pip uninstall -y myextension jupyterlab
171+
172+
rm -rf myextension
173+
174+
- name: Install server extension from a tarball
175+
run: |
176+
set -eux
177+
# Trick to use custom parameters
178+
python -c "from cookiecutter.main import cookiecutter; import json; f=open('cookiecutter.json'); d=json.load(f); f.close(); d['has_server_extension']='y'; cookiecutter('.', extra_context=d, no_input=True)"
179+
pushd myextension
180+
pip install --pre jupyterlab
181+
jupyter lab clean --all
182+
python -m build --sdist
183+
pip install dist/*.tar.gz
184+
jupyter labextension list
185+
jupyter labextension list 2>&1 | grep -ie "myextension.*OK"
186+
jupyter server extension list
187+
jupyter server extension list 2>&1 | grep -ie "myextension.*OK"
188+
189+
jupyter lab build --dev-build --no-minimize
190+
popd
191+
192+
python -m jupyterlab.browser_check
193+
194+
cp myextension/dist/*.tar.gz myextension.tar.gz
195+
pip uninstall -y myextension jupyterlab
196+
rm -rf myextension
197+
198+
- uses: actions/upload-artifact@v2
199+
with:
200+
name: myextension-sdist
201+
path: myextension.tar.gz
143202

144203
test_isolated:
145-
needs: build
204+
needs: server
146205
runs-on: ubuntu-latest
147206

148207
steps:
149-
- name: Checkout
150-
uses: actions/checkout@v2
151-
- name: Install Python
152-
uses: actions/setup-python@v2
153-
with:
154-
python-version: '3.7'
155-
architecture: 'x64'
156-
- name: Setup pip cache
157-
uses: actions/cache@v2
158-
with:
159-
path: ~/.cache/pip
160-
key: pip-3.7-${{ hashFiles('package.json') }}
161-
restore-keys: |
162-
pip-3.7-
163-
pip-
164-
- uses: actions/download-artifact@v2
165-
with:
166-
name: myextension-sdist
167-
- name: Install and Test
168-
run: |
169-
set -eux
170-
# Remove NodeJS, twice to take care of system and locally installed node versions.
171-
sudo rm -rf $(which node)
172-
sudo rm -rf $(which node)
173-
174-
pip install myextension.tar.gz
175-
pip install jupyterlab
176-
jupyter labextension list 2>&1 | grep -ie "my_lab_extension.*OK"
177-
jupyter server extension list
178-
jupyter server extension list 2>&1 | grep -ie "myextension.*OK"
179-
python -m jupyterlab.browser_check --no-chrome-test
208+
- name: Checkout
209+
uses: actions/checkout@v2
210+
- name: Install Python
211+
uses: actions/setup-python@v2
212+
with:
213+
python-version: "3.7"
214+
architecture: "x64"
215+
- name: Setup pip cache
216+
uses: actions/cache@v2
217+
with:
218+
path: ~/.cache/pip
219+
key: pip-3.7-${{ hashFiles('package.json') }}
220+
restore-keys: |
221+
pip-3.7-
222+
pip-
223+
- uses: actions/download-artifact@v2
224+
with:
225+
name: myextension-sdist
226+
- name: Install and Test
227+
run: |
228+
set -eux
229+
# Remove NodeJS, twice to take care of system and locally installed node versions.
230+
sudo rm -rf $(which node)
231+
sudo rm -rf $(which node)
232+
233+
pip install myextension.tar.gz
234+
pip install jupyterlab
235+
jupyter labextension list 2>&1 | grep -ie "myextension.*OK"
236+
jupyter server extension list
237+
jupyter server extension list 2>&1 | grep -ie "myextension.*OK"
238+
python -m jupyterlab.browser_check --no-chrome-test

0 commit comments

Comments
 (0)