-
Notifications
You must be signed in to change notification settings - Fork 29
266 lines (234 loc) · 8.2 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
name: Build
on:
push:
branches: main
pull_request:
branches: '*'
jobs:
test-backend-conda:
name: Test server with Conda Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
# nb_conda_kernels not compatible with 3.12
python-version: ["3.8", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache conda
uses: actions/cache@v3
env:
# Increase this value to reset cache
CACHE_NUMBER: 3
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements_dev.txt') }}
restore-keys: |
${{ runner.os }}-conda-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements_dev.txt') }}
${{ runner.os }}-conda-${{ matrix.python-version }}
- name: Setup Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test_gator
auto-update-conda: true
channels: conda-forge
python-version: ${{ matrix.python-version }}
show-channel-urls: true
use-only-tar-bz2: true
- name: Install dependencies
run: |
conda info
conda install -n test_gator --file requirements_dev.txt
# Fake JS assets to avoid building them
touch mamba_gator/labextension/static/style.js
touch mamba_gator/labextension/package.json
pip install -e .
python -m pip check
shell: bash -l {0}
- name: Test the server extension
run: python -m pytest -ra mamba_gator
shell: bash -l {0}
test-backend-mamba:
name: Test server with Mamba Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
# nb_conda_kernels not compatible with 3.12
python-version: ["3.8", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache conda
uses: actions/cache@v3
env:
# Increase this value to reset cache if requirements_dev.txt has not changed
CACHE_NUMBER: 1
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-mamba-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements_dev.txt') }}
restore-keys: |
${{ runner.os }}-mamba-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements_dev.txt') }}
${{ runner.os }}-mamba-${{ matrix.python-version }}
- name: Setup Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test_gator
auto-update-conda: true
channels: conda-forge
mamba-version: "*"
python-version: ${{ matrix.python-version }}
show-channel-urls: true
use-only-tar-bz2: true
- name: Install dependencies
run: |
conda info
mamba install -n test_gator --file requirements_dev.txt
# Fake JS assets to avoid building them
touch mamba_gator/labextension/static/style.js
touch mamba_gator/labextension/package.json
pip install -e .
python -m pip check
shell: bash -l {0}
- name: Test the server extension
run: python -m pytest -ra mamba_gator
shell: bash -l {0}
test-all-os:
name: Test Conda Python 3.11 on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
continue-on-error: true
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
os:
- "macos-latest"
- "windows-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache conda
uses: actions/cache@v3
env:
# Increase this value to reset cache
CACHE_NUMBER: 2
with:
path: ~/conda_pkgs_dir
key: ${{ matrix.os }}-conda-3.11-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements_dev.txt') }}
restore-keys: |
${{ matrix.os }}-conda-3.11-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements_dev.txt') }}
${{ matrix.os }}-conda-3.11
- 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@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
env:
# Increase this value to reset cache
CACHE_NUMBER: 4
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
**/node_modules
key: ${{ runner.os }}-yarn-${{ env.CACHE_NUMBER }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ env.CACHE_NUMBER }}
${{ runner.os }}-yarn
- name: Setup Python 3.11
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test_gator
miniconda-version: "latest"
channels: conda-forge
python-version: "3.11"
show-channel-urls: true
use-only-tar-bz2: true
- name: Install dependencies
run: |
conda info
conda install -n test_gator --file requirements_dev.txt
conda install -n test_gator jupyterlab=4
python -m pip install -e .
shell: bash -l {0}
- name: Test the extension
env:
OS_RUNNER: ${{ matrix.os }}
run: |
python -m pytest mamba_gator
yarn run test
jupyter serverextension list
jupyter labextension list
if [ "${OS_RUNNER}" != "windows-latest" ]; then python -m jupyterlab.browser_check; fi
shell: bash -l {0}
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- 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: Lint the extension
run: |
set -eux
jlpm
jlpm run lint:check
black --check --diff --color .
ruff .
pipx run 'validate-pyproject[all]' pyproject.toml
- name: Build the extension
run: |
set -eux
python -m pip install .[test]
# Check pip dependencies
pip check
jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "mamba_gator.*OK"
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "gator.*OK"
python -m jupyterlab.browser_check
- name: Package the extension
run: |
set -eux
pip install build
python -m build
pip uninstall -y "mamba_gator" jupyterlab
- name: Upload extension packages
uses: actions/upload-artifact@v3
with:
name: extension-artifacts
path: dist/mamba_gator*
if-no-files-found: error
test_isolated:
needs: build
runs-on: ubuntu-latest
steps:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: 'x64'
- uses: actions/download-artifact@v3
with:
name: extension-artifacts
- 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 "jupyterlab>=4.0.0,<5" mamba_gator*.whl
jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "mamba_gator.*OK"
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "gator.*OK"
python -m jupyterlab.browser_check --no-browser-test
check_links:
name: Check Links
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1