@@ -483,10 +483,9 @@ jobs:
483483 runs-on : ubuntu-latest
484484 steps :
485485 - uses : actions/checkout@v7.0.0
486- - uses : actions /setup-python@v6
486+ - uses : astral-sh /setup-uv@v7
487487 with :
488- python-version : 3.14
489- id : setup-python
488+ save-cache : ${{ needs.resolve.outputs.save-cache }}
490489 - name : Install Rust toolchain
491490 uses : dtolnay/rust-toolchain@stable
492491 with :
@@ -495,42 +494,37 @@ jobs:
495494 - uses : actions/setup-node@v6
496495 with :
497496 node-version : 24
498- - run : python -m pip install --upgrade pip && pip install nox[uv]
499497 - uses : actions/cache/restore@v5
500498 id : cache
501499 with :
502500 path : |
503501 .nox/emscripten
504- key : emscripten-${{ hashFiles('emscripten/*') }}-${{ hashFiles('noxfile.py') }}-${{ steps.setup-python.outputs.python-path }}
502+ key : emscripten-${{ hashFiles('wasm/ emscripten/*', 'wasm/common.mk' ) }}-${{ hashFiles('noxfile.py') }}-${{ env.UV_PYTHON }}
505503 - uses : Swatinem/rust-cache@v2
506504 with :
507505 save-if : ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }}
508506 - name : Build
509507 if : steps.cache.outputs.cache-hit != 'true'
510- run : nox -s build-emscripten
508+ run : uvx nox -s build-emscripten
511509 - name : Test
512- run : nox -s test-emscripten
510+ run : uvx nox -s test-emscripten
513511 - uses : actions/cache/save@v5
514512 if : ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }}
515513 with :
516514 path : |
517515 .nox/emscripten
518- key : emscripten-${{ hashFiles('emscripten/*') }}-${{ hashFiles('noxfile.py') }}-${{ steps.setup-python.outputs.python-path }}
516+ key : emscripten-${{ hashFiles('wasm/ emscripten/*', 'wasm/common.mk' ) }}-${{ hashFiles('noxfile.py') }}-${{ env.UV_PYTHON }}
519517
520518 wasm32-wasip1 :
521519 name : wasm32-wasip1
522520 if : ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || github.event_name != 'pull_request' }}
523521 needs : [fmt]
524522 runs-on : ubuntu-latest
525- env :
526- WASI_SDK_PATH : " /opt/wasi-sdk"
527- CPYTHON_PATH : " ${{ github.workspace }}/wasi/cpython"
528523 steps :
529524 - uses : actions/checkout@v7.0.0
530- - uses : actions /setup-python@v6
525+ - uses : astral-sh /setup-uv@v7
531526 with :
532- python-version : 3.14
533- id : setup-python
527+ save-cache : ${{ needs.resolve.outputs.save-cache }}
534528 - name : Install Rust toolchain
535529 uses : dtolnay/rust-toolchain@stable
536530 with :
@@ -539,59 +533,32 @@ jobs:
539533 - name : " Install wasmtime"
540534 uses : bytecodealliance/actions/wasmtime/setup@v1
541535 - name : " Install WASI SDK"
542- run : |
543- mkdir ${{ env.WASI_SDK_PATH }} && \
544- curl -s -S --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-24/wasi-sdk-24.0-x86_64-linux.tar.gz | \
545- tar --strip-components 1 --directory ${{ env.WASI_SDK_PATH }} --extract --gunzip
546- $WASI_SDK_PATH/bin/clang --version
547- - uses : actions/cache/restore@v5
548- id : cache-wasip1-python
536+ uses : bytecodealliance/setup-wasi-sdk-action@main
549537 with :
550- path : ${{ env.CPYTHON_PATH }}/cross-build/
551- key : wasm32-wasip1-python
552- - uses : actions/checkout@v7.0.0
538+ version : " 24"
539+ # wasi sdk sets CC variables which break Python's configure script
540+ # (it also sets WASI_SDK_PATH even without `add-to-path`, which is sufficient)
541+ add-to-path : false
542+ - uses : actions/cache/restore@v5
543+ id : cache
553544 with :
554- repository : python/cpython
555- ref : 3.14
556- path : ${{ env.CPYTHON_PATH }}
557- fetch-depth : 1
558- - name : Build
559- run : |
560- cd ${{ env.CPYTHON_PATH }}
561- cat >> Tools/wasm/wasi/config.site-wasm32-wasi <<'EOF'
562-
563- # Force-disable POSIX dynamic loading for WASI
564- ac_cv_func_dlopen=no
565- ac_cv_lib_dl_dlopen=no
566- EOF
567- python Tools/wasm/wasi build --quiet -- --config-cache
568- cp cross-build/wasm32-wasip1/libpython3.14.a \
569- cross-build/wasm32-wasip1/Modules/_hacl/libHacl_HMAC.a \
570- cross-build/wasm32-wasip1/Modules/_decimal/libmpdec/libmpdec.a \
571- cross-build/wasm32-wasip1/Modules/expat/libexpat.a \
572- cross-build/wasm32-wasip1/build/lib.wasi-wasm32-3.14/
545+ path : |
546+ .nox/wasi
547+ key : wasi-${{ hashFiles('wasm/wasi/*', 'wasm/common.mk') }}-${{ hashFiles('noxfile.py') }}-${{ env.UV_PYTHON }}
573548 - uses : Swatinem/rust-cache@v2
574549 with :
575550 save-if : ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }}
551+ - name : Build
552+ if : steps.cache.outputs.cache-hit != 'true'
553+ run : uvx nox -s build-wasm
576554 - name : Test
577- env :
578- PYO3_CROSS_LIB_DIR : ${{ env.CPYTHON_PATH }}/cross-build/wasm32-wasip1/build/lib.wasi-wasm32-3.14/
579- CARGO_BUILD_TARGET : wasm32-wasip1
580- CARGO_TARGET_WASM32_WASIP1_RUNNER : wasmtime run --dir ${{ env.CPYTHON_PATH }}::/ --env PYTHONPATH=/lib
581- RUSTFLAGS : >
582- -C link-arg=-L${{ env.WASI_SDK_PATH }}/share/wasi-sysroot/lib/wasm32-wasi
583- -C link-arg=-lwasi-emulated-signal
584- -C link-arg=-lwasi-emulated-process-clocks
585- -C link-arg=-lwasi-emulated-getpid
586- -C link-arg=-lmpdec
587- -C link-arg=-lHacl_HMAC
588- -C link-arg=-lexpat
589- run : RUSTDOCFLAGS=$RUSTFLAGS cargo test
555+ run : uvx nox -s test-wasm
590556 - uses : actions/cache/save@v5
591557 if : ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }}
592558 with :
593- path : ${{ env.CPYTHON_PATH }}/cross-build/
594- key : ${{ steps.cache-wasip1-python.outputs.cache-primary-key }}
559+ path : |
560+ .nox/wasi
561+ key : wasi-${{ hashFiles('wasm/wasi/*', 'wasm/common.mk') }}-${{ hashFiles('noxfile.py') }}-${{ env.UV_PYTHON }}
595562
596563 test-debug :
597564 if : ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || github.event_name != 'pull_request' }}
0 commit comments