diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0b88be8e..b660a2927 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -153,6 +153,53 @@ jobs: - run: make rust-benchmark + build_wasm_emscripten: + name: build wasm emscripten + # only run on push to main and on release + if: "success() && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main')" + needs: [test, lint] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + components: rust-src + target: wasm32-unknown-emscripten + override: true + + - uses: mymindstorm/setup-emsdk@v11 + with: + version: 3.1.13 + actions-cache-folder: emsdk-cache + + - name: set up python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: set package version + run: python .github/set_version.py + if: "startsWith(github.ref, 'refs/tags/')" + + - name: Sync Cargo.lock + run: cargo update -p pydantic-core + if: "startsWith(github.ref, 'refs/tags/')" + + - run: pip install -U --pre maturin + + - name: build wheels + run: maturin build --release --target wasm32-unknown-emscripten --out dist -i 3.10 + + - run: ls -lh dist + + - uses: actions/upload-artifact@v3 + with: + name: wasm_wheels + path: dist + build: name: build on ${{ matrix.platform || matrix.os }} (${{ matrix.target }} - ${{ matrix.manylinux || 'auto' }}) # only run on push to main and on release