Skip to content

Commit

Permalink
chore: comprehensive WASM tests in JS (zkonduit#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethan-crypto authored Sep 15, 2023
1 parent a329d2c commit 7d7de3e
Show file tree
Hide file tree
Showing 12 changed files with 2,723 additions and 75 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ jobs:
- name: Circuit Render
run: cargo nextest run --release --verbose tests::tutorial_


mock-proving-tests:
runs-on: self-hosted
# needs: [build, library-tests, docs]
Expand Down Expand Up @@ -250,6 +251,39 @@ jobs:
toolchain: nightly-2023-08-24
override: true
components: rustfmt, clippy
- uses: jetli/[email protected]
- name: Add wasm32-unknown-unknown target
run: rustup target add wasm32-unknown-unknown

- name: Install wasm-server-runner
run: cargo install wasm-server-runner

- name: Add rust-src
run: rustup component add rust-src --toolchain nightly-2023-08-24-x86_64-unknown-linux-gnu

- name: Build wasm files for both web and nodejs compilation targets
run: |
wasm-pack build --target nodejs --out-dir ./tests/wasm/nodejs . -- -Z build-std="panic_abort,std"
- name: Replace memory definition in nodejs
run: |
sed -i "3s|.*|imports['env'] = {memory: new WebAssembly.Memory({initial:20,maximum:65536,shared:true})}|" tests/wasm/nodejs/ezkl.js
- uses: actions/checkout@v3
- name: Use pnpm 8
uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js 18.12.1
uses: actions/setup-node@v3
with:
node-version: '18.12.1'
cache: 'pnpm'
- name: Install dependencies
run: |
pnpm install --no-frozen-lockfile
env:
CI: false
NODE_ENV: development
- uses: baptiste0928/cargo-install@v1
with:
crate: cargo-nextest
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@ var/
*.egg
.vscode/
*.whl
*.bak
*.bak
node_modules
timingData.json
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "wasm-tests",
"version": "0.1.0",
"private": true,
"scripts": {
"test": "jest"
},
"devDependencies": {
"@types/jest": "^29.5.3",
"@types/node": "20.4.5",
"jest": "^29.6.3",
"@types/file-saver": "^2.0.5",
"@types/json-bigint": "^1.0.1",
"env": "^0.0.2",
"fs": "0.0.1-security",
"json-bigint": "^1.0.0",
"minimist": "^1.2.8",
"ts-jest": "^29.1.1",
"typescript": "5.1.6"
}
}
Loading

0 comments on commit 7d7de3e

Please sign in to comment.