-
Notifications
You must be signed in to change notification settings - Fork 8
210 lines (173 loc) · 5.72 KB
/
Copy pathrust.yml
File metadata and controls
210 lines (173 loc) · 5.72 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
name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: cargo fmt
run: cargo fmt -- --check
- name: cargo clippy
run: cargo clippy -- -D warnings
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Cache Python test venv
uses: actions/cache@v4
with:
path: tests/.test-venv
key: ${{ runner.os }}-test-venv-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-test-venv-
- name: Setup test environment
run: ./tests/setup_test_env.sh
- name: Build
run: cargo build --verbose
- name: Run tests
run: |
echo "Running all tests..."
cargo test --test integration_local_mode --verbose
cargo test --test integration_execution --verbose
cargo test --bins --verbose
echo "✅ All tests passed!"
test-connect:
name: Test connect (${{ matrix.collab-config }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- collab-config: vanilla
packages: "jupyter_server"
- collab-config: jupyter-collaboration
packages: "jupyter-collaboration"
- collab-config: jupyter-server-documents
packages: "jupyter-server-documents"
steps:
- uses: actions/checkout@v4
- name: Set up Rust cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Cache Python test venv
uses: actions/cache@v4
with:
path: tests/.test-venv
key: ${{ runner.os }}-test-venv-connect-${{ matrix.collab-config }}
restore-keys: |
${{ runner.os }}-test-venv-connect-
- name: Create venv and install packages
run: uv venv tests/.test-venv && uv pip install --python tests/.test-venv ipykernel ${{ matrix.packages }}
- name: Log installed packages
run: uv pip list --python tests/.test-venv
- name: Build
run: cargo build --verbose
- name: Start Jupyter server
run: |
VENV="$(pwd)/tests/.test-venv"
SERVER_ROOT=$(mktemp -d)
PORT=$(python3 -c "import socket; s=socket.socket(); s.bind(('',0)); p=s.getsockname()[1]; s.close(); print(p)")
PATH="$VENV/bin:$PATH" VIRTUAL_ENV="$VENV" \
jupyter server \
--no-browser \
--ServerApp.token=nbtest123 \
--ServerApp.root_dir="$SERVER_ROOT" \
--port="$PORT" \
--ServerApp.open_browser=False \
> "$SERVER_ROOT/jupyter.log" 2>&1 &
echo "NB_TEST_SERVER_URL=http://127.0.0.1:$PORT" >> "$GITHUB_ENV"
echo "NB_TEST_SERVER_TOKEN=nbtest123" >> "$GITHUB_ENV"
echo "NB_TEST_SERVER_ROOT=$SERVER_ROOT" >> "$GITHUB_ENV"
SERVER_READY=false
for i in $(seq 1 150); do
curl -sf "http://127.0.0.1:$PORT/api?token=nbtest123" > /dev/null 2>&1 && SERVER_READY=true && break
sleep 0.2
done
if [ "$SERVER_READY" != "true" ]; then
echo "::error::Jupyter server failed to start on port $PORT"; exit 1
fi
echo "Jupyter server ready on port $PORT"
- name: Run connect-mode tests
run: cargo test --test integration_connect_mode -- --test-threads=1
- name: Show Jupyter server logs
if: failure()
run: cat "$NB_TEST_SERVER_ROOT/jupyter.log" || true
test-windows:
name: Test (Windows)
runs-on: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Rust cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install Rust target
run: rustup target add x86_64-pc-windows-msvc
- name: Build release binary
run: cargo build --release --target x86_64-pc-windows-msvc
- name: Run unit tests (kernel discovery)
# Integration tests require a Unix shell setup script; run unit tests only.
# This verifies Windows-specific #[cfg(target_os = "windows")] code paths compile
# and that kernel directory logic is correct on Windows.
run: cargo test --bins --verbose
- name: Upload Windows binary
uses: actions/upload-artifact@v4
with:
name: nb-windows-amd64
path: target/x86_64-pc-windows-msvc/release/nb.exe
retention-days: 30