Merge pull request #47 from privacy-scaling-explorations/chore/monorepo-updates

General updates to monorepo conf files
This commit is contained in:
Cedoor
2023-03-26 16:19:51 +01:00
committed by GitHub
17 changed files with 2058 additions and 4049 deletions

View File

@@ -1,42 +0,0 @@
name: coverall
on:
push:
branches:
- main
jobs:
coverall:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Restore yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn
- name: Test libraries
run: yarn test
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -10,20 +10,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v1
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: "18"
cache: yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Restore yarn cache
uses: actions/cache@v3
id: yarn-cache
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

102
.github/workflows/production.yml vendored Normal file
View File

@@ -0,0 +1,102 @@
name: production
on:
push:
branches:
- main
jobs:
style:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18"
cache: yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn
- name: Compile contracts
run: yarn compile:sol
- name: Build libraries
run: yarn build:js
- name: Run Prettier
run: yarn prettier
- name: Run Eslint
run: yarn lint
test:
runs-on: ubuntu-latest
strategy:
matrix:
type:
- js
- sol
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18"
cache: yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn
- name: Test contracts or libraries
run: yarn test:${{ matrix.type }}
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-${{ matrix.type }}
path-to-lcov: ./coverage/${{ matrix.type }}/lcov.info
parallel: true
coverage:
runs-on: ubuntu-latest
needs: test
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

76
.github/workflows/pull-requests.yml vendored Normal file
View File

@@ -0,0 +1,76 @@
name: pull-requests
on:
pull_request:
jobs:
style:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18"
cache: yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn
- name: Compile contracts
run: yarn compile:sol
- name: Build libraries
run: yarn build:js
- name: Run Prettier
run: yarn prettier
- name: Run Eslint
run: yarn lint
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18"
cache: yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn
- name: Test contracts and libraries
run: yarn test

View File

@@ -1,44 +0,0 @@
name: style
on:
pull_request:
push:
branches:
- main
jobs:
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Restore yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn
- name: Run Prettier
run: yarn prettier
- name: Run Eslint
run: yarn lint
- name: Build libraries
run: yarn build

View File

@@ -1,41 +0,0 @@
name: test
on:
pull_request:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Restore yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn
- name: Build libraries
run: yarn build
- name: Test libraries and contracts
run: yarn test:all

1
.gitignore vendored
View File

@@ -61,6 +61,7 @@ docs/*
# Hardhat
cache
typechain-types
# dotenv environment variable files
.env

4
.husky/commit-msg Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no-install commitlint --edit $1

View File

@@ -227,25 +227,25 @@ It will also automatically check that the modified files comply with ESLint and
### Testing
Run [Jest](https://jestjs.io/) to test the code with coverage:
Test the code with coverage:
```bash
yarn test
```
### Build packages
### Build
Run [Rollup](https://www.rollupjs.org) to build all the packages:
Build all the packages and compile contracts:
```bash
yarn build
```
A `dist` folder will be created inside each package.
A `dist` folder will be created inside each JavaScript package.
### Documentation
Run [TypeDoc](https://typedoc.org/) to generate a documentation website for each package:
Generate a documentation website for each package:
```bash
yarn docs

View File

@@ -15,6 +15,7 @@ const projects: any = fs
export default async (): Promise<Config.InitialOptions> => ({
projects,
verbose: true,
coverageDirectory: "./coverage/js",
collectCoverageFrom: ["<rootDir>/src/**/*.ts", "!<rootDir>/src/**/index.ts", "!<rootDir>/src/**/*.d.ts"],
coverageThreshold: {
global: {

View File

@@ -8,18 +8,20 @@
"bugs": "https://github.com/privacy-scaling-explorations/zk-kit/issues",
"private": true,
"scripts": {
"build": "yarn workspaces foreach run build",
"test": "jest --coverage",
"test:watch": "jest --coverage --watch",
"test:all": "yarn workspaces foreach run test",
"lint": "eslint . --ext .js,.ts",
"build": "yarn build:js && yarn compile:sol",
"build:js": "yarn workspaces foreach --no-private run build",
"compile:sol": "yarn workspaces foreach --no-private run compile",
"test": "yarn test:js && yarn test:sol",
"test:js": "jest --coverage",
"test:sol": "yarn workspace incremental-merkle-tree.sol test:coverage",
"lint": "eslint . --ext .js,.ts && yarn workspace incremental-merkle-tree.sol lint",
"prettier": "prettier -c .",
"prettier:write": "prettier -w .",
"benchmarks": "rimraf benchmarks/results && ts-node benchmarks/index.ts",
"docs": "yarn workspaces foreach run docs",
"docs": "yarn workspaces foreach --no-private run docs",
"commit": "cz",
"precommit": "lint-staged",
"postinstall": "yarn build"
"postinstall": "yarn build && husky install"
},
"keywords": [
"javascript",
@@ -57,6 +59,7 @@
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-jest": "^25.7.0",
"husky": "^8.0.3",
"incrementalquintree": "^1.0.9",
"jest": "^27.4.1",
"jest-config": "^27.4.7",

View File

@@ -0,0 +1,3 @@
module.exports = {
istanbulFolder: "../../coverage/sol"
}

View File

@@ -2,7 +2,6 @@
"extends": "solhint:recommended",
"plugins": ["prettier"],
"rules": {
"code-complexity": ["error", 7],
"compiler-version": ["error", ">=0.8.0"],
"const-name-snakecase": "off",
"no-empty-blocks": "off",
@@ -16,6 +15,6 @@
"endOfLine": "auto"
}
],
"reason-string": ["warn", { "maxLength": 64 }]
"reason-string": ["warn", { "maxLength": 80 }]
}
}

View File

@@ -27,5 +27,8 @@
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"poseidon-solidity": "0.0.3"
}
}

View File

@@ -1,10 +1,7 @@
import "@nomiclabs/hardhat-ethers"
import "@nomiclabs/hardhat-waffle"
import "@nomicfoundation/hardhat-toolbox"
import { config as dotenvConfig } from "dotenv"
import "hardhat-gas-reporter"
import { HardhatUserConfig } from "hardhat/config"
import { resolve } from "path"
import "solidity-coverage"
import { config } from "./package.json"
import "./tasks/deploy-ibt-test"
import "./tasks/deploy-iqt-test"

View File

@@ -9,29 +9,33 @@
"test": "hardhat test",
"test:report-gas": "REPORT_GAS=true hardhat test",
"test:coverage": "hardhat coverage",
"test:prod": "yarn lint && yarn coverage",
"lint": "solhint 'contracts/**/*.sol'"
},
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.4",
"@nomiclabs/hardhat-waffle": "^2.0.2",
"@types/chai": "^4.3.0",
"@types/mocha": "^9.1.0",
"@ethersproject/providers": "^5.4.7",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox": "^2.0.2",
"@nomiclabs/hardhat-ethers": "^2.0.0",
"@nomiclabs/hardhat-etherscan": "^3.0.0",
"@typechain/ethers-v5": "^10.1.0",
"@typechain/hardhat": "^6.1.2",
"@types/chai": "^4.2.0",
"@types/mocha": ">=9.1.0",
"@zk-kit/incremental-merkle-tree": "^0.4.1",
"chai": "^4.3.5",
"circomlibjs": "^0.0.8",
"dotenv": "^14.3.2",
"ethereum-waffle": "^3.4.4",
"ethers": "^5.5.3",
"hardhat": "^2.8.3",
"hardhat-gas-reporter": "^1.0.7",
"mocha": "^8.4.0",
"poseidon-solidity": "0.0.3",
"prettier": "^2.5.1",
"ethers": "^5.4.7",
"hardhat": "^2.13.0",
"hardhat-gas-reporter": "^1.0.8",
"prettier-plugin-solidity": "^1.0.0-beta.19",
"solhint": "^3.3.6",
"solhint-plugin-prettier": "^0.0.5",
"solidity-coverage": "^0.7.18"
"solidity-coverage": "^0.8.1",
"typechain": "^8.1.0"
},
"dependencies": {
"poseidon-solidity": "0.0.3"
},
"config": {
"solidity": {

5706
yarn.lock

File diff suppressed because it is too large Load Diff