1818 - ' **.md'
1919 - ' crates/rooch-anomalies/static/**'
2020
21+ concurrency :
22+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.workflow_run.head_branch || github.ref }}
23+ cancel-in-progress : true
24+
2125env :
2226 CARGO_TERM_COLOR : always
2327 RUST_BACKTRACE : 1
2428 ENV_TEST_ON_CI : 1
2529 CARGO_INCREMENTAL : 0
30+ CARGO_NET_GIT_FETCH_WITH_CLI : true
31+ GIT_CONFIG_COUNT : 2
32+ GIT_CONFIG_KEY_0 : http.version
33+ GIT_CONFIG_VALUE_0 : HTTP/1.1
34+ GIT_CONFIG_KEY_1 : http.maxRequests
35+ GIT_CONFIG_VALUE_1 : " 2"
2636
2737jobs :
38+ # Route all Linux self-hosted jobs to the ephemeral VM runner.
2839 # Phase 1: Check changes
2940 check_changes :
3041 name : Check Changes
31- runs-on : ubuntu-latest
42+ runs-on : [self-hosted, larger-runner, ephemeral-vm]
3243 outputs :
3344 core : ${{ steps.changes.outputs.core }}
3445 sdk_web : ${{ steps.changes.outputs.sdk_web }}
@@ -64,10 +75,10 @@ jobs:
6475 - 'pnpm-workspace.yaml'
6576 - 'prettier.config.js'
6677
67- # Phase 2: Build and verify (larger- runner)
78+ # Phase 2: Build and verify on the self-hosted Linux runner
6879 build_and_verify :
6980 name : Build and Verify
70- runs-on : larger-runner
81+ runs-on : [self-hosted, larger-runner, ephemeral-vm]
7182 needs : check_changes
7283 if : ${{ needs.check_changes.outputs.core == 'true' || needs.check_changes.outputs.sdk_web == 'true' }}
7384 timeout-minutes : 75
@@ -113,6 +124,7 @@ jobs:
113124
114125 - name : Upload build artifacts
115126 uses : actions/upload-artifact@v4
127+ continue-on-error : true
116128 with :
117129 name : rooch-binaries
118130 path : |
@@ -121,11 +133,11 @@ jobs:
121133 target/optci/framework-release
122134 retention-days : 1
123135
124- # Phase 3: Rust tests (compile and run on ubuntu-latest with cache)
136+ # Phase 3: Rust tests (compile and run on the self-hosted Linux runner with cache)
125137 test_rust_unit :
126138 name : Rust Unit Tests
127- runs-on : ubuntu-latest
128- needs : build_and_verify
139+ runs-on : [self-hosted, larger-runner, ephemeral-vm]
140+ needs : [check_changes, build_and_verify]
129141 if : ${{ needs.check_changes.outputs.core == 'true' }}
130142 timeout-minutes : 60
131143 steps :
@@ -148,8 +160,12 @@ jobs:
148160
149161 - name : Install cargo-nextest
150162 run : |
151- echo "Installing cargo-nextest from GitHub releases..."
152- curl -LsSf https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-0.9.97/cargo-nextest-0.9.97-x86_64-unknown-linux-gnu.tar.gz | tar xz -C ~/.cargo/bin
163+ if cargo nextest --version >/dev/null 2>&1; then
164+ echo "Using preinstalled cargo-nextest"
165+ else
166+ echo "Installing cargo-nextest from GitHub releases..."
167+ curl -LsSf https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-0.9.97/cargo-nextest-0.9.97-x86_64-unknown-linux-gnu.tar.gz | tar xz -C ~/.cargo/bin
168+ fi
153169 cargo nextest --version
154170
155171 - name : Run Rust unit tests
@@ -161,8 +177,8 @@ jobs:
161177
162178 test_rust_framework :
163179 name : Rust Framework Tests
164- runs-on : ubuntu-latest
165- needs : build_and_verify
180+ runs-on : [self-hosted, larger-runner, ephemeral-vm]
181+ needs : [check_changes, build_and_verify]
166182 if : ${{ needs.check_changes.outputs.core == 'true' }}
167183 timeout-minutes : 45
168184 steps :
@@ -185,8 +201,12 @@ jobs:
185201
186202 - name : Install cargo-nextest
187203 run : |
188- echo "Installing cargo-nextest from GitHub releases..."
189- curl -LsSf https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-0.9.97/cargo-nextest-0.9.97-x86_64-unknown-linux-gnu.tar.gz | tar xz -C ~/.cargo/bin
204+ if cargo nextest --version >/dev/null 2>&1; then
205+ echo "Using preinstalled cargo-nextest"
206+ else
207+ echo "Installing cargo-nextest from GitHub releases..."
208+ curl -LsSf https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-0.9.97/cargo-nextest-0.9.97-x86_64-unknown-linux-gnu.tar.gz | tar xz -C ~/.cargo/bin
209+ fi
190210 cargo nextest --version
191211
192212 - name : Run Rust framework tests
@@ -198,8 +218,8 @@ jobs:
198218
199219 test_rust_bitcoin :
200220 name : Rust Bitcoin Tests
201- runs-on : ubuntu-latest
202- needs : build_and_verify
221+ runs-on : [self-hosted, larger-runner, ephemeral-vm]
222+ needs : [check_changes, build_and_verify]
203223 if : ${{ needs.check_changes.outputs.core == 'true' }}
204224 timeout-minutes : 30
205225 steps :
@@ -222,8 +242,12 @@ jobs:
222242
223243 - name : Install cargo-nextest
224244 run : |
225- echo "Installing cargo-nextest from GitHub releases..."
226- curl -LsSf https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-0.9.97/cargo-nextest-0.9.97-x86_64-unknown-linux-gnu.tar.gz | tar xz -C ~/.cargo/bin
245+ if cargo nextest --version >/dev/null 2>&1; then
246+ echo "Using preinstalled cargo-nextest"
247+ else
248+ echo "Installing cargo-nextest from GitHub releases..."
249+ curl -LsSf https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-0.9.97/cargo-nextest-0.9.97-x86_64-unknown-linux-gnu.tar.gz | tar xz -C ~/.cargo/bin
250+ fi
227251 cargo nextest --version
228252
229253 - name : Run Rust Bitcoin tests
@@ -235,8 +259,8 @@ jobs:
235259
236260 test_rust_integration_suite :
237261 name : Rust Integration Suite Tests
238- runs-on : ubuntu-latest
239- needs : build_and_verify
262+ runs-on : [self-hosted, larger-runner, ephemeral-vm]
263+ needs : [check_changes, build_and_verify]
240264 if : ${{ needs.check_changes.outputs.core == 'true' }}
241265 timeout-minutes : 60
242266 steps :
@@ -259,8 +283,12 @@ jobs:
259283
260284 - name : Install cargo-nextest
261285 run : |
262- echo "Installing cargo-nextest from GitHub releases..."
263- curl -LsSf https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-0.9.97/cargo-nextest-0.9.97-x86_64-unknown-linux-gnu.tar.gz | tar xz -C ~/.cargo/bin
286+ if cargo nextest --version >/dev/null 2>&1; then
287+ echo "Using preinstalled cargo-nextest"
288+ else
289+ echo "Installing cargo-nextest from GitHub releases..."
290+ curl -LsSf https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-0.9.97/cargo-nextest-0.9.97-x86_64-unknown-linux-gnu.tar.gz | tar xz -C ~/.cargo/bin
291+ fi
264292 cargo nextest --version
265293
266294 - name : Run Rust integration suite tests
@@ -272,8 +300,8 @@ jobs:
272300
273301 lint :
274302 name : Rust Lint
275- runs-on : larger-runner
276- needs : build_and_verify
303+ runs-on : [self-hosted, larger-runner, ephemeral-vm]
304+ needs : [check_changes, build_and_verify]
277305 if : ${{ needs.check_changes.outputs.core == 'true' }}
278306 timeout-minutes : 45
279307 steps :
@@ -296,14 +324,14 @@ jobs:
296324
297325 - name : Run Rust Lint
298326 run : |
299- echo "Running lint on larger- runner (compiles workspace for analysis)..."
327+ echo "Running lint on the self-hosted runner (compiles workspace for analysis)..."
300328 make lint
301329 env :
302330 ROOCH_BINARY_BUILD_PROFILE : optci
303331
304332 test_move_frameworks :
305333 name : Move Framework Tests
306- runs-on : ubuntu-latest
334+ runs-on : [self-hosted, larger-runner, ephemeral-vm]
307335 needs : [check_changes, build_and_verify]
308336 if : ${{ needs.check_changes.outputs.core == 'true' }}
309337 timeout-minutes : 60
@@ -312,11 +340,39 @@ jobs:
312340 uses : actions/checkout@v4
313341
314342 - name : Download build artifacts
343+ id : download_binaries
315344 uses : actions/download-artifact@v4
345+ continue-on-error : true
316346 with :
317347 name : rooch-binaries
318348 path : target/optci
319349
350+ - name : Check build artifact availability
351+ id : binaries
352+ shell : bash
353+ run : |
354+ if [[ -x target/optci/rooch && -x target/optci/rooch-genesis && -x target/optci/framework-release ]]; then
355+ echo "available=true" >> "$GITHUB_OUTPUT"
356+ else
357+ echo "available=false" >> "$GITHUB_OUTPUT"
358+ echo "Build artifacts unavailable, will rebuild locally."
359+ fi
360+
361+ - name : Setup Rust for local binary rebuild fallback
362+ if : ${{ steps.binaries.outputs.available != 'true' }}
363+ uses : ./.github/actions/rust-setup
364+
365+ - name : Cache Rust dependencies for local binary rebuild fallback
366+ if : ${{ steps.binaries.outputs.available != 'true' }}
367+ uses : Swatinem/rust-cache@v2
368+ with :
369+ shared-key : ' ci'
370+ cache-on-failure : true
371+
372+ - name : Rebuild binaries locally when artifact download is unavailable
373+ if : ${{ steps.binaries.outputs.available != 'true' }}
374+ run : cargo build --profile optci --workspace --bins -j 16
375+
320376 - name : Make binaries executable
321377 run : |
322378 chmod +x target/optci/rooch
@@ -339,7 +395,7 @@ jobs:
339395
340396 test_move_examples :
341397 name : Move Examples Tests
342- runs-on : ubuntu-latest
398+ runs-on : [self-hosted, larger-runner, ephemeral-vm]
343399 needs : [check_changes, build_and_verify]
344400 if : ${{ needs.check_changes.outputs.core == 'true' }}
345401 timeout-minutes : 60
@@ -348,11 +404,39 @@ jobs:
348404 uses : actions/checkout@v4
349405
350406 - name : Download build artifacts
407+ id : download_binaries
351408 uses : actions/download-artifact@v4
409+ continue-on-error : true
352410 with :
353411 name : rooch-binaries
354412 path : target/optci
355413
414+ - name : Check build artifact availability
415+ id : binaries
416+ shell : bash
417+ run : |
418+ if [[ -x target/optci/rooch && -x target/optci/rooch-genesis && -x target/optci/framework-release ]]; then
419+ echo "available=true" >> "$GITHUB_OUTPUT"
420+ else
421+ echo "available=false" >> "$GITHUB_OUTPUT"
422+ echo "Build artifacts unavailable, will rebuild locally."
423+ fi
424+
425+ - name : Setup Rust for local binary rebuild fallback
426+ if : ${{ steps.binaries.outputs.available != 'true' }}
427+ uses : ./.github/actions/rust-setup
428+
429+ - name : Cache Rust dependencies for local binary rebuild fallback
430+ if : ${{ steps.binaries.outputs.available != 'true' }}
431+ uses : Swatinem/rust-cache@v2
432+ with :
433+ shared-key : ' ci'
434+ cache-on-failure : true
435+
436+ - name : Rebuild binaries locally when artifact download is unavailable
437+ if : ${{ steps.binaries.outputs.available != 'true' }}
438+ run : cargo build --profile optci --workspace --bins -j 16
439+
356440 - name : Make binaries executable
357441 run : |
358442 chmod +x target/optci/rooch
@@ -371,7 +455,7 @@ jobs:
371455
372456 test_sdk_web :
373457 name : SDK and Web Tests
374- runs-on : ubuntu-latest
458+ runs-on : [self-hosted, larger-runner, ephemeral-vm]
375459 needs : [check_changes, build_and_verify]
376460 if : ${{ needs.check_changes.outputs.core == 'true' || needs.check_changes.outputs.sdk_web == 'true' }}
377461 timeout-minutes : 60
@@ -380,19 +464,47 @@ jobs:
380464 uses : actions/checkout@v4
381465
382466 - name : Download build artifacts
467+ id : download_binaries
383468 uses : actions/download-artifact@v4
469+ continue-on-error : true
384470 with :
385471 name : rooch-binaries
386472 path : target/optci
387473
474+ - name : Check build artifact availability
475+ id : binaries
476+ shell : bash
477+ run : |
478+ if [[ -x target/optci/rooch && -x target/optci/rooch-genesis && -x target/optci/framework-release ]]; then
479+ echo "available=true" >> "$GITHUB_OUTPUT"
480+ else
481+ echo "available=false" >> "$GITHUB_OUTPUT"
482+ echo "Build artifacts unavailable, will rebuild locally."
483+ fi
484+
485+ - name : Setup Rust for local binary rebuild fallback
486+ if : ${{ steps.binaries.outputs.available != 'true' }}
487+ uses : ./.github/actions/rust-setup
488+
489+ - name : Cache Rust dependencies for local binary rebuild fallback
490+ if : ${{ steps.binaries.outputs.available != 'true' }}
491+ uses : Swatinem/rust-cache@v2
492+ with :
493+ shared-key : ' ci'
494+ cache-on-failure : true
495+
496+ - name : Rebuild binaries locally when artifact download is unavailable
497+ if : ${{ steps.binaries.outputs.available != 'true' }}
498+ run : cargo build --profile optci --workspace --bins -j 16
499+
388500 - name : Make binaries executable
389501 run : |
390502 chmod +x target/optci/rooch
391503 chmod +x target/optci/rooch-genesis
392504 chmod +x target/optci/framework-release
393505
394506 - name : Setup Node.js
395- uses : actions/setup-node@v2
507+ uses : actions/setup-node@v4
396508 with :
397509 node-version : ' 20.3.1'
398510
0 commit comments