Skip to content

Commit

Permalink
Move to Bun.js (#6)
Browse files Browse the repository at this point in the history
* switch to bun

* fix workflow
  • Loading branch information
erhant authored Apr 20, 2024
1 parent 1bd134b commit 04544e0
Show file tree
Hide file tree
Showing 25 changed files with 33 additions and 4,432 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Enable Corepack for Yarn
run: corepack enable

- name: Install dependencies
- name: Install Circom dependencies
run: |
sudo apt-get update
sudo apt-get install --yes \
Expand All @@ -37,8 +37,8 @@ jobs:
- name: Print Circom version
run: circom --version

- name: Install dependencies
run: yarn
- name: Install JS dependencies
run: bun install

- name: Run tests
run: yarn test
run: bun test
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"recommendations": ["iden3.circom"]
"recommendations": ["iden3.circom", "oven.bun-vscode"]
}
1 change: 0 additions & 1 deletion .yarnrc.yml

This file was deleted.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
Install packages with:

```sh
yarn install
bun install
```

## Book

We use `mdbook` to create the book, see the [book](./book/) folder. You can build the book with the following:

```sh
yarn book # automatically serve the book
yarn book:build # build without serving
bun book # automatically serve the book
bun book:build # build without serving
```

The book is based on the [mdBook template](https://github.com/erhant/mdbook-template) and is published at <https://circom.erhant.me>.
Expand All @@ -43,13 +43,13 @@ The book is based on the [mdBook template](https://github.com/erhant/mdbook-temp
Run circuit tests with:

```sh
yarn test
bun test

# with pattern matching
yarn test pattern-name
bun test pattern-name

# with explicit paths
yarn test ./path/to/some.test.ts
bun test ./path/to/some.test.ts
```

The tests make use of [Circomkit](https://github.com/erhant/circomkit).
Expand Down
Binary file added bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion circuits/test/comparators/compconstant.circom
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ pragma circom 2.0.0;

include "../../comparators/constant.circom";

component main = CompConstant(1693);
component main = CompConstant(1017);
15 changes: 0 additions & 15 deletions jest.config.ts

This file was deleted.

9 changes: 2 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@
"circomlib": "^2.0.5"
},
"devDependencies": {
"@types/jest": "^29.5.12",
"@types/bun": "^1.1.0",
"@types/node": "^20.11.16",
"jest": "^29.7.0",
"markdownlint": "^0.33.0",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.1",
"typescript": "^5.1.6"
},
"prettier": {
"printWidth": 120
},
"packageManager": "yarn@4.1.0"
}
}
1 change: 1 addition & 0 deletions tests/arithmetic/adder.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { WitnessTester } from "circomkit";
import { circomkit } from "../common";
import { describe, beforeAll, it } from "bun:test";

const N = 3;

Expand Down
1 change: 1 addition & 0 deletions tests/arithmetic/int-div.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { WitnessTester } from "circomkit";
import { circomkit } from "../common";
import { describe, beforeAll, it } from "bun:test";

describe("integer division", () => {
let circuit: WitnessTester<["in"], ["out"]>;
Expand Down
1 change: 1 addition & 0 deletions tests/arithmetic/inverse.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { WitnessTester } from "circomkit";
import { circomkit } from "../common";
import { describe, beforeAll, it } from "bun:test";

describe("inverse", () => {
let circuit: WitnessTester<["in"], ["out"]>;
Expand Down
1 change: 1 addition & 0 deletions tests/arithmetic/multiplier.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { WitnessTester } from "circomkit";
import { circomkit } from "../common";
import { describe, beforeAll, it } from "bun:test";

const N = 3;

Expand Down
1 change: 1 addition & 0 deletions tests/arrays/distinct.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { WitnessTester } from "circomkit";
import { circomkit } from "../common";
import { describe, beforeAll, it } from "bun:test";

describe("distinct", () => {
const N = 3;
Expand Down
1 change: 1 addition & 0 deletions tests/arrays/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { WitnessTester } from "circomkit";
import { circomkit, primes } from "../common";
import { describe, beforeAll, it } from "bun:test";

describe("arrays", () => {
const N = 10;
Expand Down
1 change: 1 addition & 0 deletions tests/arrays/sorted.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { WitnessTester } from "circomkit";
import { circomkit } from "../common";
import { describe, beforeAll, it } from "bun:test";

describe("sorted", () => {
const N = 10;
Expand Down
1 change: 1 addition & 0 deletions tests/bits/gates.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { WitnessTester } from "circomkit";
import { circomkit } from "../common";
import { describe, beforeAll, it } from "bun:test";

describe("logic gates", () => {
it("AND", async () => {
Expand Down
1 change: 1 addition & 0 deletions tests/bits/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { WitnessTester } from "circomkit";
import { circomkit } from "../common";
import { describe, beforeAll, it, expect } from "bun:test";

describe("bits", () => {
const N = 5;
Expand Down
1 change: 1 addition & 0 deletions tests/comparators/constant.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { WitnessTester } from "circomkit";
import { circomkit, primes, toBinary } from "../common";
import { describe, beforeAll, it, expect } from "bun:test";

describe("constant", () => {
describe("compconstant", () => {
Expand Down
1 change: 1 addition & 0 deletions tests/comparators/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { WitnessTester } from "circomkit";
import { circomkit } from "../common";
import { describe, beforeAll, it } from "bun:test";

describe("comparators", () => {
describe("is zero", () => {
Expand Down
1 change: 1 addition & 0 deletions tests/comparators/range.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { WitnessTester } from "circomkit";
import { circomkit } from "../common";
import { describe, beforeAll, it } from "bun:test";

describe("range", () => {
const [MIN, MAX] = [1, 9];
Expand Down
1 change: 1 addition & 0 deletions tests/control-flow/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { circomkit } from "../common";
import { describe, beforeAll, it } from "bun:test";

describe("control-flow", () => {
it("if-else", async () => {
Expand Down
1 change: 1 addition & 0 deletions tests/examples/intermediate/sudoku.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { WitnessTester } from "circomkit";
import { circomkit } from "../../common";
import { describe, beforeAll, it } from "bun:test";

const BOARD_SIZES = [4, 9] as const;
type BOARD_SIZES = (typeof BOARD_SIZES)[number];
Expand Down
1 change: 1 addition & 0 deletions tests/examples/simple/fibonacci.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { WitnessTester } from "circomkit";
import { circomkit } from "../../common";
import { describe, beforeAll, it } from "bun:test";

const N = 14;

Expand Down
1 change: 1 addition & 0 deletions tests/examples/simple/magic.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { WitnessTester } from "circomkit";
import { circomkit } from "../../common";
import { describe, beforeAll, it } from "bun:test";

// board sizes
const MAGIC_SIZES = [3, 4] as const;
Expand Down
Loading

0 comments on commit 04544e0

Please sign in to comment.