@@ -395,6 +395,64 @@ jobs:
395395 name : pypi_files_${{ matrix.os }}_${{ matrix.interpreter }}
396396 path : crates/jiter-python/dist
397397
398+ build-wasm-emscripten :
399+ # only run on push to main and on release
400+ if : startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'Full Build')
401+ runs-on : ubuntu-latest
402+ steps :
403+ - uses : actions/checkout@v4
404+
405+ - id : setup-python
406+ name : set up python
407+ uses : quansight-labs/setup-python@v5
408+ with :
409+ python-version : 3.12
410+ allow-prereleases : true
411+
412+ - name : install rust nightly
413+ uses : dtolnay/rust-toolchain@nightly
414+ with :
415+ components : rust-src
416+ targets : wasm32-unknown-emscripten
417+
418+ - name : cache rust
419+ uses : Swatinem/rust-cache@v2
420+
421+ - uses : mymindstorm/setup-emsdk@v14
422+ with :
423+ # NOTE!: as per https://github.com/pydantic/pydantic-core/pull/149 this version needs to match the version
424+ # in node_modules/pyodide/repodata.json, to get the version, run:
425+ # `cat node_modules/pyodide/repodata.json | python -m json.tool | rg platform`
426+ version : " 3.1.58"
427+ actions-cache-folder : emsdk-cache
428+
429+ - name : install deps
430+ run : pip install -U pip maturin
431+
432+ - name : build wheels
433+ run : maturin build --release --target wasm32-unknown-emscripten --out dist -i 3.12
434+ working-directory : crates/jiter-python
435+
436+ - uses : actions/setup-node@v4
437+ with :
438+ node-version : " 18"
439+
440+ - run : npm install
441+ working-directory : crates/jiter-python
442+
443+ - run : npm run test
444+ working-directory : crates/jiter-python
445+
446+ - run : |
447+ ls -lh dist/
448+ ls -l dist/
449+ working-directory: crates/jiter-python
450+
451+ - uses : actions/upload-artifact@v4
452+ with :
453+ name : wasm_wheels
454+ path : crates/jiter-python/dist
455+
398456 inspect-pypi-assets :
399457 needs : [build, build-sdist, build-pgo]
400458 runs-on : ubuntu-latest
@@ -524,7 +582,7 @@ jobs:
524582
525583 release :
526584 needs : [check]
527- if : " success() && startsWith(github.ref, 'refs/tags/')"
585+ if : success() && startsWith(github.ref, 'refs/tags/')
528586 runs-on : ubuntu-latest
529587 environment : release
530588
@@ -541,8 +599,13 @@ jobs:
541599 CARGO_REGISTRY_TOKEN : ${{ secrets.CARGO_REGISTRY_TOKEN }}
542600
543601 release-python :
544- needs : [test-builds-arch, test-builds-os, build-sdist, check]
545- if : " success() && startsWith(github.ref, 'refs/tags/')"
602+ needs :
603+ - check
604+ - test-builds-arch
605+ - test-builds-os
606+ - build-sdist
607+ - build-wasm-emscripten
608+ if : success() && startsWith(github.ref, 'refs/tags/')
546609 runs-on : ubuntu-latest
547610 environment : release-python
548611 permissions :
@@ -573,3 +636,16 @@ jobs:
573636 uses : pypa/gh-action-pypi-publish@release/v1
574637 with :
575638 packages-dir : dist/
639+
640+ - name : get wasm dist artifacts
641+ uses : actions/download-artifact@v4
642+ with :
643+ name : wasm_wheels
644+ path : wasm
645+
646+ - name : upload to github release
647+ uses : softprops/action-gh-release@v2
648+ with :
649+ files : |
650+ wasm/*.whl
651+ prerelease : ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
0 commit comments