Skip to content

Commit 4cb5863

Browse files
authored
Merge pull request #123 from jupyterlab/auto-backport-of-pr-121-on-3.0
Backport PR #121 on branch 3.0
2 parents b0b3189 + 89a8866 commit 4cb5863

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

.github/workflows/main.yml

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,15 @@ jobs:
3333
steps:
3434
- name: Checkout
3535
uses: actions/checkout@v2
36+
- name: Path filter
37+
id: filter
38+
uses: dorny/paths-filter@v2
39+
with:
40+
filters: |
41+
extension:
42+
- '${{ matrix.example }}/**'
3643
- name: Cache lerna
44+
if: steps.filter.outputs.extension == 'true'
3745
uses: actions/cache@v2
3846
with:
3947
path: |
@@ -43,6 +51,7 @@ jobs:
4351
restore-keys: |
4452
${{ runner.os }}-lerna-
4553
- name: Check config files
54+
if: steps.filter.outputs.extension == 'true'
4655
run: |
4756
diff basics/hello-world/tsconfig.json ${EXAMPLE_FOLDER}/tsconfig.json
4857
diff basics/hello-world/.eslintignore ${EXAMPLE_FOLDER}/.eslintignore
@@ -52,46 +61,54 @@ jobs:
5261
EXAMPLE_FOLDER: ${{ matrix.example }}
5362
shell: bash
5463
- name: Install node
64+
if: steps.filter.outputs.extension == 'true'
5565
uses: actions/setup-node@v1
5666
with:
5767
node-version: "12.x"
5868
- name: Install Python
69+
if: steps.filter.outputs.extension == 'true'
5970
uses: actions/setup-python@v1
6071
with:
6172
python-version: "3.7"
6273
architecture: "x64"
6374
- name: Get pip cache dir
75+
if: steps.filter.outputs.extension == 'true'
6476
id: pip-cache
6577
run: |
6678
echo "::set-output name=dir::$(pip cache dir)"
6779
shell: bash
6880
- name: Cache pip
81+
if: steps.filter.outputs.extension == 'true'
6982
uses: actions/cache@v2
7083
with:
7184
path: ${{ steps.pip-cache.outputs.dir }}
7285
key: ${{ runner.os }}-pip-${{ hashFiles('**/environment.yml') }}
7386
restore-keys: |
7487
${{ runner.os }}-pip-
7588
- name: Install the Python dependencies
89+
if: steps.filter.outputs.extension == 'true'
7690
run: |
7791
python -m pip install --upgrade pip
7892
python -m pip install jupyter_packaging
7993
python -m pip install --pre jupyterlab
8094
- name: Install the NPM dependencies
95+
if: steps.filter.outputs.extension == 'true'
8196
run: |
8297
cd ${EXAMPLE_FOLDER}
8398
jlpm
8499
env:
85100
EXAMPLE_FOLDER: ${{ matrix.example }}
86101
shell: bash
87102
- name: Lint the files
103+
if: steps.filter.outputs.extension == 'true'
88104
run: |
89105
cd ${EXAMPLE_FOLDER}
90106
jlpm run eslint:check
91107
env:
92108
EXAMPLE_FOLDER: ${{ matrix.example }}
93109
shell: bash
94110
- name: Build and check by extension
111+
if: steps.filter.outputs.extension == 'true'
95112
run: |
96113
cd ${EXAMPLE_FOLDER}
97114
pip install -e .
@@ -113,82 +130,101 @@ jobs:
113130
steps:
114131
- name: Checkout
115132
uses: actions/checkout@v2
133+
- name: Path filter
134+
id: filter
135+
uses: dorny/paths-filter@v2
136+
with:
137+
filters: |
138+
extension:
139+
- 'advanced/server-extension/**'
116140
- name: Cache lerna
141+
if: steps.filter.outputs.extension == 'true'
117142
uses: actions/cache@v2
118143
with:
119144
path: |
120145
node_modules
121146
*/*/node_modules
122-
key: ${{ runner.os }}-lerna-${{ hashFiles('**/package.json') }}
147+
key: ${{ runner.os }}-lerna-${{ hashFiles('advanced/server-extension/package.json') }}
123148
restore-keys: |
124149
${{ runner.os }}-lerna-
125150
- name: Install node
151+
if: steps.filter.outputs.extension == 'true'
126152
uses: actions/setup-node@v1
127153
with:
128154
node-version: "12.x"
129155
- name: Check config files
156+
if: steps.filter.outputs.extension == 'true'
130157
run: |
131158
diff basics/hello-world/tsconfig.json advanced/server-extension/tsconfig.json
132159
diff basics/hello-world/.eslintignore advanced/server-extension/.eslintignore
133160
diff basics/hello-world/.eslintrc.js advanced/server-extension/.eslintrc.js
134161
shell: bash
135162
- name: Install Python
163+
if: steps.filter.outputs.extension == 'true'
136164
uses: actions/setup-python@v1
137165
with:
138166
python-version: "3.7"
139167
architecture: "x64"
140168
- name: Get pip cache dir
169+
if: steps.filter.outputs.extension == 'true'
141170
id: pip-cache
142171
run: |
143172
echo "::set-output name=dir::$(pip cache dir)"
144173
shell: bash
145174
- name: Cache pip
175+
if: steps.filter.outputs.extension == 'true'
146176
uses: actions/cache@v2
147177
with:
148178
path: ${{ steps.pip-cache.outputs.dir }}
149179
key: ${{ runner.os }}-pip-${{ hashFiles('**/environment.yml') }}
150180
restore-keys: |
151181
${{ runner.os }}-pip-
152182
- name: Install the Python dependencies
183+
if: steps.filter.outputs.extension == 'true'
153184
run: |
154185
python -m pip install --upgrade pip
155186
python -m pip install jupyter_packaging
156187
python -m pip install --pre jupyterlab
157188
- name: Install the NPM dependencies
189+
if: steps.filter.outputs.extension == 'true'
158190
run: |
159191
cd advanced/server-extension
160192
jlpm
161193
- name: Lint the files
194+
if: steps.filter.outputs.extension == 'true'
162195
run: |
163196
cd advanced/server-extension
164197
jlpm run eslint:check
165198
- name: Build extension as user
199+
if: steps.filter.outputs.extension == 'true'
166200
# Force the usage of the source distribution (good practice)
167201
run: |
168202
cd advanced/server-extension
169203
python setup.py sdist
170204
pip install jlab_ext_example --pre --find-links=dist --no-cache-dir
171205
python -m jupyterlab.browser_check
172206
- name: Check extension as dev
173-
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS')
207+
if: steps.filter.outputs.extension == 'true' && ( startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') )
174208
run: |
175209
jupyter server extension list 1>serverextensions 2>&1
176210
cat serverextensions | grep "jlab_ext_example.*OK"
177211
jupyter labextension list 1>labextensions 2>&1
178212
cat labextensions | grep "@jupyterlab-examples/server-extension.*OK"
179213
- name: Clean extension installation
214+
if: steps.filter.outputs.extension == 'true'
180215
run: |
181216
pip uninstall -y jlab_ext_example
182217
jupyter lab clean
183218
jupyter server extension list
184219
jupyter labextension list
185220
- name: Build extension as dev
221+
if: steps.filter.outputs.extension == 'true'
186222
run: |
187223
cd advanced/server-extension
188224
pip install -e .
189225
jupyter server extension enable --py jlab_ext_example
190226
- name: Check extension as dev
191-
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS')
227+
if: steps.filter.outputs.extension == 'true' && ( startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') )
192228
run: |
193229
jupyter server extension list 1>serverextensions 2>&1
194230
cat serverextensions | grep "jlab_ext_example.*OK"

basics/hello-world/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> Set up the development environment and print to the console.
44
5-
![hello-world example](./preview.png)
5+
![hello world example](./preview.png)
66

77
- [The template folder structure](#the-template-folder-structure)
88
- [A minimal extension that prints to the browser console](#a-minimal-extension-that-prints-to-the-browser-console)

0 commit comments

Comments
 (0)