Skip to content

Commit 6f52739

Browse files
authored
Skip test if the extension is not touched (#121)
* Skip test if the extension is not touched * Dummy change for skip testing * Add filter on server extension * Discriminate node cache * Revert cache discrimination
1 parent e7054af commit 6f52739

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,43 +61,51 @@ 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: python -m pip install jupyterlab
7791
- name: Install the NPM dependencies
92+
if: steps.filter.outputs.extension == 'true'
7893
run: |
7994
cd ${EXAMPLE_FOLDER}
8095
jlpm
8196
env:
8297
EXAMPLE_FOLDER: ${{ matrix.example }}
8398
shell: bash
8499
- name: Lint the files
100+
if: steps.filter.outputs.extension == 'true'
85101
run: |
86102
cd ${EXAMPLE_FOLDER}
87103
jlpm run eslint:check
88104
env:
89105
EXAMPLE_FOLDER: ${{ matrix.example }}
90106
shell: bash
91107
- name: Build and check by extension
108+
if: steps.filter.outputs.extension == 'true'
92109
run: |
93110
cd ${EXAMPLE_FOLDER}
94111
jlpm run build
@@ -107,55 +124,72 @@ jobs:
107124
steps:
108125
- name: Checkout
109126
uses: actions/checkout@v2
127+
- name: Path filter
128+
id: filter
129+
uses: dorny/paths-filter@v2
130+
with:
131+
filters: |
132+
extension:
133+
- 'advanced/server-extension/**'
110134
- name: Cache lerna
135+
if: steps.filter.outputs.extension == 'true'
111136
uses: actions/cache@v2
112137
with:
113138
path: |
114139
node_modules
115140
*/*/node_modules
116-
key: ${{ runner.os }}-lerna-${{ hashFiles('**/package.json') }}
141+
key: ${{ runner.os }}-lerna-${{ hashFiles('advanced/server-extension/package.json') }}
117142
restore-keys: |
118143
${{ runner.os }}-lerna-
119144
- name: Install node
145+
if: steps.filter.outputs.extension == 'true'
120146
uses: actions/setup-node@v1
121147
with:
122148
node-version: "12.x"
123149
- name: Check config files
150+
if: steps.filter.outputs.extension == 'true'
124151
run: |
125152
diff basics/hello-world/tsconfig.json advanced/server-extension/tsconfig.json
126153
diff basics/hello-world/.eslintignore advanced/server-extension/.eslintignore
127154
diff basics/hello-world/.eslintrc.js advanced/server-extension/.eslintrc.js
128155
shell: bash
129156
- name: Install Python
157+
if: steps.filter.outputs.extension == 'true'
130158
uses: actions/setup-python@v1
131159
with:
132160
python-version: "3.7"
133161
architecture: "x64"
134162
- name: Get pip cache dir
163+
if: steps.filter.outputs.extension == 'true'
135164
id: pip-cache
136165
run: |
137166
echo "::set-output name=dir::$(pip cache dir)"
138167
shell: bash
139168
- name: Cache pip
169+
if: steps.filter.outputs.extension == 'true'
140170
uses: actions/cache@v2
141171
with:
142172
path: ${{ steps.pip-cache.outputs.dir }}
143173
key: ${{ runner.os }}-pip-${{ hashFiles('**/environment.yml') }}
144174
restore-keys: |
145175
${{ runner.os }}-pip-
146176
- name: Install the Python dependencies
177+
if: steps.filter.outputs.extension == 'true'
147178
run: |
148179
python -m pip install jupyter_packaging
149180
python -m pip install jupyterlab
150181
- name: Install the NPM dependencies
182+
if: steps.filter.outputs.extension == 'true'
151183
run: |
152184
cd advanced/server-extension
153185
jlpm
154186
- name: Lint the files
187+
if: steps.filter.outputs.extension == 'true'
155188
run: |
156189
cd advanced/server-extension
157190
jlpm run eslint:check
158191
- name: Build extension as user
192+
if: steps.filter.outputs.extension == 'true'
159193
# Force the usage of the source distribution (good practice)
160194
run: |
161195
cd advanced/server-extension
@@ -164,26 +198,28 @@ jobs:
164198
jupyter lab build
165199
python -m jupyterlab.browser_check
166200
- name: Check extension as dev
167-
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS')
201+
if: steps.filter.outputs.extension == 'true' && ( startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') )
168202
run: |
169203
jupyter serverextension list 1>serverextensions 2>&1
170204
cat serverextensions | grep "jlab_ext_example.*OK"
171205
jupyter labextension list 1>labextensions 2>&1
172206
cat labextensions | grep "@jupyterlab-examples/server-extension.*OK"
173207
- name: Clean extension installation
208+
if: steps.filter.outputs.extension == 'true'
174209
run: |
175210
pip uninstall -y jlab_ext_example
176211
jupyter lab clean
177212
jupyter serverextension list
178213
jupyter labextension list
179214
- name: Build extension as dev
215+
if: steps.filter.outputs.extension == 'true'
180216
run: |
181217
cd advanced/server-extension
182218
pip install -e .
183219
jupyter serverextension enable --py jlab_ext_example
184220
jupyter labextension install .
185221
- name: Check extension as dev
186-
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS')
222+
if: steps.filter.outputs.extension == 'true' && ( startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') )
187223
run: |
188224
jupyter serverextension list 1>serverextensions 2>&1
189225
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)