Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 10 additions & 77 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,97 +2,30 @@ name: Continuous Integration
on:
push:
branches:
- main
- master
pull_request:

jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
timeout-minutes: 30

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [lts/*, lts/-1]
timeout-minutes: 15
runs-on: ubuntu-latest

steps:
- name: Checkout project
uses: actions/checkout@v2
uses: actions/checkout@v6

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
check-latest: true
node-version: "lts/*"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

test-contracts:
name: Test verifier contracts
runs-on: ${{ matrix.os }}
timeout-minutes: 30

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node-version: [lts/*]

steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Install Playwright dependencies
run: npx playwright install

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
check-latest: true
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Install hardhat dependencies
working-directory: smart_contract_tests
run: npm ci

- name: Run hardhat tests
working-directory: smart_contract_tests
run: npm test

test-browser:
name: Test browser
runs-on: ${{ matrix.os }}
timeout-minutes: 30

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node-version: [lts/*]

steps:
- name: Checkout project
uses: actions/checkout@v2

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
check-latest: true
cache: "npm"

- name: Install browser dependencies
working-directory: browser_tests
run: npm ci

- name: Run browser tests
working-directory: browser_tests
- name: Run tests
run: npm test
6 changes: 6 additions & 0 deletions build-config/constants-stub.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const O_TRUNC = 512;
export const O_CREAT = 64;
export const O_RDWR = 2;
export const O_EXCL = 128;
export const O_RDONLY = 0;
export default {};
4 changes: 4 additions & 0 deletions build-config/empty-stub.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Empty stub for Node built-ins that are unreachable in the browser prove path
// (fs/os/readline/crypto/...). getRandomBytes/getSHA256 in src/misc.js fall back
// to globalThis.crypto in the browser, so an empty module is safe here.
export default {};
11 changes: 11 additions & 0 deletions build-config/wasm-toolchain-stub.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Stub for the runtime wasm codegen toolchain (wasmbuilder + wasmcurves
// generators). Only reachable through ffjavascript's custom-`plugins`
// curve-build path, which snarkjs never takes. Bundling the real toolchain
// into the browser build would add ~180 KB for a code path that never runs.
const err = () => {
throw new Error("wasm codegen toolchain is not included in the snarkjs browser bundle (only needed when building a curve with custom wasm plugins)");
};
export class ModuleBuilder { constructor() { err(); } }
export const buildBn128 = err;
export const buildBls12381 = err;
export default {};
Loading
Loading