Repository navigation
Expand file tree
/
Copy pathscient-compute-python-kernel.yml
More file actions
336 lines (312 loc) · 13.5 KB
/
Copy pathscient-compute-python-kernel.yml
File metadata and controls
336 lines (312 loc) · 13.5 KB
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
# Runs the part of the compute session's Python work that the main CI lanes
# cannot: a real Jupyter kernel, on more than one operating system and more than
# one interpreter version.
#
# The bridge's own unit tests need nothing but a standard library and so run on
# every pull request from `ci.yml`. What is here needs `jupyter_client`,
# `ipykernel`, matplotlib, pandas, and a live subprocess tree, which is why it
# is conditionally called by CI and remains manually dispatchable.
#
# Every matrix spans the four computers Scient ships for: Apple Silicon, Intel
# Mac, Windows x64 and Linux x64.
name: Scient Compute Python Kernel
on:
workflow_call:
inputs:
real_kernel:
type: boolean
default: true
managed_python:
type: boolean
default: true
# `linux` when only broad inputs (dependencies, configuration, workspace
# code) changed; see compute-ci-gate.mjs. Anything else runs all four.
platforms:
type: string
default: all
workflow_dispatch:
inputs:
real_kernel:
description: Run the real-kernel OS and Python-version matrix
type: boolean
default: true
managed_python:
description: Provision and qualify managed Python toolkits
type: boolean
default: true
permissions:
contents: read
concurrency:
group: scient-compute-python-kernel-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
managed_python:
if: ${{ inputs.managed_python }}
name: Managed Python toolkits / ${{ matrix.runner }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
runner: ${{ fromJSON(inputs.platforms == 'linux' && '["ubuntu-24.04"]' || '["ubuntu-24.04", "macos-15", "macos-15-intel", "windows-2025"]') }}
defaults:
run:
shell: bash
steps:
# The runner's C: drive is slow for many small files; its D: drive, which holds the
# workspace, is several times faster. Temporary files (build stages, Python
# environments, extracted archives) go there.
- name: Use the D drive for temporary files
if: ${{ runner.os == 'Windows' }}
shell: bash
run: printf 'TEMP=%s\nTMP=%s\n' "$RUNNER_TEMP" "$RUNNER_TEMP" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
fetch-depth: 0
sparse-checkout: |
/*
!/.repos/
sparse-checkout-cone-mode: false
# No package cache in this workflow: on the Macs restoring the 0.9–1.6 GB store took longer
# than installing the filtered workspace from the registry (Apple Silicon 102–174 s against
# 41–52 s), and the cache's post step packed it again after every job. Windows and Linux
# measured the same either way.
- name: Setup Vite+
uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1
with:
node-version-file: package.json
cache: false
run-install: |
args:
- --filter=t3...
# The production provisioner downloads pinned private uv/CPython and uses
# the checked-in lock. No ambient pip environment can satisfy this test.
- name: Seal candidate recipe metadata
run: node apps/server/scripts/compute-recipes.ts seal
- name: Assert native qualification target
env:
EXPECTED_TARGET: ${{ fromJSON('{"ubuntu-24.04":"linux-x64","macos-15":"darwin-arm64","macos-15-intel":"darwin-x64","windows-2025":"win32-x64"}')[matrix.runner] }}
run: node -e 'require("node:assert/strict").equal(`${process.platform}-${process.arch}`, process.env.EXPECTED_TARGET)'
# Windows qualifies recipes in managed_recipes, beside this, its longest job.
- name: Qualify recipes
if: ${{ matrix.runner != 'windows-2025' }}
working-directory: apps/server
env:
SCIENT_TEST_MANAGED_PYTHON: "1"
MPLBACKEND: Agg
run: vp test run src/scient/compute/ComputeRecipe.live.test.ts --maxWorkers=1
- name: Qualify base, every toolkit combination, and retained kernels
working-directory: apps/server
env:
SCIENT_TEST_MANAGED_PYTHON: "1"
MPLBACKEND: Agg
run: vp test bench --run src/scient/compute/ManagedPythonProduct.bench.ts --maxWorkers=1
managed_recipes:
if: ${{ inputs.managed_python && inputs.platforms != 'linux' }}
name: Managed Python recipes / windows-2025
runs-on: windows-2025
timeout-minutes: 20
defaults:
run:
shell: bash
steps:
# The runner's C: drive is slow for many small files; its D: drive, which holds the
# workspace, is several times faster. Temporary files (build stages, Python
# environments, extracted archives) go there.
- name: Use the D drive for temporary files
if: ${{ runner.os == 'Windows' }}
shell: bash
run: printf 'TEMP=%s\nTMP=%s\n' "$RUNNER_TEMP" "$RUNNER_TEMP" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
fetch-depth: 0
sparse-checkout: |
/*
!/.repos/
sparse-checkout-cone-mode: false
- name: Setup Vite+
uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1
with:
node-version-file: package.json
cache: false
run-install: |
args:
- --filter=t3...
- name: Seal candidate recipe metadata
run: node apps/server/scripts/compute-recipes.ts seal
- name: Assert native qualification target
run: node -e 'require("node:assert/strict").equal(`${process.platform}-${process.arch}`, "win32-x64")'
- name: Qualify recipes
working-directory: apps/server
env:
SCIENT_TEST_MANAGED_PYTHON: "1"
MPLBACKEND: Agg
run: vp test run src/scient/compute/ComputeRecipe.live.test.ts --maxWorkers=1
real_kernel:
if: ${{ inputs.real_kernel }}
name: Real kernel / ${{ matrix.runner }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
runner: ${{ fromJSON(inputs.platforms == 'linux' && '["ubuntu-24.04"]' || '["ubuntu-24.04", "macos-15", "macos-15-intel", "windows-2025"]') }}
defaults:
run:
shell: bash
steps:
- name: Use the D drive for temporary files
if: ${{ runner.os == 'Windows' }}
run: printf 'TEMP=%s\nTMP=%s\n' "$RUNNER_TEMP" "$RUNNER_TEMP" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
sparse-checkout: |
/*
!/.repos/
sparse-checkout-cone-mode: false
- name: Setup Vite+
uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1
with:
node-version-file: package.json
cache: false
run-install: |
args:
- --filter=t3...
# Both ends of the supported range, because the failures this suite
# catches are version-dependent asyncio and kernel-startup behaviour:
# 3.10 is the floor the runtime adapter enforces, 3.12 is what a current
# user is most likely to already have. One job runs both, one after the
# other: a runner's setup costs more than the suite, and Mac runners are
# the scarcest.
- name: Setup Python 3.10
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: "3.10"
# Importing the font manager builds matplotlib's font cache: over a minute on a fresh
# Windows runner, which otherwise lands inside the suite's 90-second figure step.
- name: Install kernel dependencies on Python 3.10
run: |
set -euo pipefail
python -m pip install --upgrade pip
python -m pip install "jupyter_client>=8.6" "ipykernel>=6.29" matplotlib pandas
python -c "import matplotlib.font_manager"
# The absolute path rather than `python`: this value becomes the launch
# plan's executable, so resolving it once here is what makes the kernel
# under test the interpreter this step set up.
- name: Run the real-kernel integration suite on Python 3.10
working-directory: apps/server
env:
# Headless runners have no display, and a figure that opened a window
# would hang the execution the test is waiting on.
MPLBACKEND: Agg
run: |
set -euo pipefail
SCIENT_TEST_PYTHON="$(python -c 'import sys; print(sys.executable)')"
export SCIENT_TEST_PYTHON
vp test run \
src/scient/compute/PythonKernel.integration.test.ts \
src/scient/compute/PythonComputeService.integration.test.ts \
src/scient/compute/FreshCompute.integration.test.ts \
src/preview/PortScannerPythonCompute.integration.test.ts
- name: Setup Python 3.12
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: "3.12"
# Importing the font manager builds matplotlib's font cache: over a minute on a fresh
# Windows runner, which otherwise lands inside the suite's 90-second figure step.
- name: Install kernel dependencies on Python 3.12
run: |
set -euo pipefail
python -m pip install --upgrade pip
python -m pip install "jupyter_client>=8.6" "ipykernel>=6.29" matplotlib pandas
python -c "import matplotlib.font_manager"
# The absolute path rather than `python`: this value becomes the launch
# plan's executable, so resolving it once here is what makes the kernel
# under test the interpreter this step set up.
- name: Run the real-kernel integration suite on Python 3.12
working-directory: apps/server
env:
# Headless runners have no display, and a figure that opened a window
# would hang the execution the test is waiting on.
MPLBACKEND: Agg
run: |
set -euo pipefail
SCIENT_TEST_PYTHON="$(python -c 'import sys; print(sys.executable)')"
export SCIENT_TEST_PYTHON
vp test run \
src/scient/compute/PythonKernel.integration.test.ts \
src/scient/compute/PythonComputeService.integration.test.ts \
src/scient/compute/FreshCompute.integration.test.ts \
src/preview/PortScannerPythonCompute.integration.test.ts
real_languages:
if: ${{ inputs.real_kernel }}
name: Real R and Julia / ${{ matrix.runner }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
runner: ${{ fromJSON(inputs.platforms == 'linux' && '["ubuntu-24.04"]' || '["ubuntu-24.04", "macos-15", "macos-15-intel", "windows-2025"]') }}
defaults:
run:
shell: bash
steps:
- name: Use the D drive for temporary files
if: ${{ runner.os == 'Windows' }}
run: printf 'TEMP=%s\nTMP=%s\n' "$RUNNER_TEMP" "$RUNNER_TEMP" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
sparse-checkout: |
/*
!/.repos/
sparse-checkout-cone-mode: false
- name: Setup Vite+
uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1
with:
node-version-file: package.json
cache: false
run-install: |
args:
- --filter=t3...
# A system install on purpose: nothing here is Scient-managed.
- name: Setup Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: "3.12"
- name: Setup R
uses: r-lib/actions/setup-r@f9a764fea8d5c63df6ef9a5c7795bf7deb5d7e05 # v2
with:
use-public-rspm: true
- name: Setup Julia
uses: julia-actions/setup-julia@4c0cb0fce8556fdb04a90347310e5db8b1f98fb9 # v2
# Before anything is installed into this Python: it stands for a person's plain Python, on a
# computer with nothing that can host the bridge.
- name: Run on what people have
working-directory: apps/server
run: |
set -euo pipefail
SCIENT_TEST_BARE_PYTHON="$(python -c 'import sys; print(sys.executable)')"
export SCIENT_TEST_BARE_PYTHON
vp test run src/scient/compute/KernelLanguages.live.test.ts --maxWorkers=1
- name: Run real files and scan this computer
working-directory: apps/server
env:
SCIENT_TEST_RUN_TABLE: "1"
# A compiler's first run on a fresh computer, such as runghc or `dotnet run` on Windows, takes up
# to two minutes, the project's ceiling, so real programs get five.
run: vp test run src/scient/analysis/RunTableAdapter.live.test.ts --maxWorkers=1 --testTimeout=300000
- name: Install the bridge host's packages
run: python -m pip install "jupyter_client>=8.6" "ipykernel>=6.29"
- name: Run real R and Julia kernels
working-directory: apps/server
env:
SCIENT_TEST_KERNEL_DIR: ${{ runner.temp }}/scient-kernels
run: |
set -euo pipefail
SCIENT_TEST_PYTHON="$(python -c 'import sys; print(sys.executable)')"
export SCIENT_TEST_PYTHON
vp test run src/scient/compute/KernelLanguages.live.test.ts --maxWorkers=1