From 5e56056cdebd49870299910a1d66b4323e46f373 Mon Sep 17 00:00:00 2001 From: pk910 Date: Mon, 3 Jun 2024 20:57:44 +0200 Subject: [PATCH 1/2] move hardhat tests to fundingvault folder, fix tests & PR workflow --- .github/workflows/build-test.yaml | 8 +- .gitignore | 109 +----------------- fundingvault/.gitignore | 109 ++++++++++++++++++ .../hardhat.config.js | 2 +- .../package-lock.json | 1 + package.json => fundingvault/package.json | 8 +- .../test}/TestFundingVaultProxy.js | 62 ++++++---- 7 files changed, 161 insertions(+), 138 deletions(-) create mode 100644 fundingvault/.gitignore rename hardhat.config.js => fundingvault/hardhat.config.js (91%) rename package-lock.json => fundingvault/package-lock.json (99%) rename package.json => fundingvault/package.json (71%) rename {test => fundingvault/test}/TestFundingVaultProxy.js (95%) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 15775c3..78de5ad 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -2,7 +2,7 @@ name: Build and Test on: push: branches: - - main + - master jobs: build: @@ -18,10 +18,10 @@ jobs: node-version: '18.17.1' - name: Install dependencies - run: npm install + run: cd fundingvault && npm install - name: Build project - run: npm run build + run: cd fundingvault && npm run build - name: Run tests - run: npm run test + run: cd fundingvault && npm run test diff --git a/.gitignore b/.gitignore index 2526dab..b15602d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,109 +1,2 @@ -# Allow a dummy project in this directory for testing purposes -myproject -/node_modules -/.idea -*.tsbuildinfo - -# VS Code workspace config -workspace.code-workspace - -.DS_Store - -# Below is Github's node gitignore template, -# ignoring the node_modules part, as it'd ignore every node_modules, and we have some for testing - -# Logs -logs -*.log - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -#node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# Optional eslint cache -.eslintcache - -# Optional REPL history -.node_repl_history - -# Output of 'pnpm pack' -*.tgz - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# next.js build output -.next - -# nuxt.js build output -.nuxt - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - - -docs/.env.example - -# Generated by Cargo -# will have compiled files and executables -/target/ - -# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries -# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -Cargo.lock - -# These are backup files generated by rustfmt -**/*.rs.bk - -# MSVC Windows builds of rustc generate these, which store debugging information -*.pdb - -# VSCode settings -.vscode/ -*.code-workspace - -artifacts -cache +.vscode diff --git a/fundingvault/.gitignore b/fundingvault/.gitignore new file mode 100644 index 0000000..b3acc05 --- /dev/null +++ b/fundingvault/.gitignore @@ -0,0 +1,109 @@ +# Allow a dummy project in this directory for testing purposes +myproject + +/node_modules +/.idea +*.tsbuildinfo + +# VS Code workspace config +workspace.code-workspace + +.DS_Store + +# Below is Github's node gitignore template, +# ignoring the node_modules part, as it'd ignore every node_modules, and we have some for testing + +# Logs +logs +*.log + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'pnpm pack' +*.tgz + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + + +docs/.env.example + +# Generated by Cargo +# will have compiled files and executables +/target/ + +# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries +# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html +Cargo.lock + +# These are backup files generated by rustfmt +**/*.rs.bk + +# MSVC Windows builds of rustc generate these, which store debugging information +*.pdb + +# VSCode settings +.vscode/ +*.code-workspace + +artifacts/ +cache/ diff --git a/hardhat.config.js b/fundingvault/hardhat.config.js similarity index 91% rename from hardhat.config.js rename to fundingvault/hardhat.config.js index fb37450..895eebf 100644 --- a/hardhat.config.js +++ b/fundingvault/hardhat.config.js @@ -3,7 +3,7 @@ require("@nomicfoundation/hardhat-toolbox"); /** @type import('hardhat/config').HardhatUserConfig */ module.exports = { paths: { - sources: "./fundingvault/contracts", + sources: "./contracts", }, networks: { hardhat: { diff --git a/package-lock.json b/fundingvault/package-lock.json similarity index 99% rename from package-lock.json rename to fundingvault/package-lock.json index e02c7f3..01c5192 100644 --- a/package-lock.json +++ b/fundingvault/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "hardhat-project", "version": "0.0.0", + "license": "MIT", "devDependencies": { "@nomicfoundation/hardhat-network-helpers": "^1.0.10", "@nomicfoundation/hardhat-toolbox": "^3.0.0", diff --git a/package.json b/fundingvault/package.json similarity index 71% rename from package.json rename to fundingvault/package.json index 991a0cc..bc242ea 100644 --- a/package.json +++ b/fundingvault/package.json @@ -1,11 +1,15 @@ { "name": "hardhat-project", "license": "MIT", + "version": "0.0.0", + "scripts": { + "build": "hardhat compile", + "test": "hardhat test" + }, "devDependencies": { "@nomicfoundation/hardhat-network-helpers": "^1.0.10", "@nomicfoundation/hardhat-toolbox": "^3.0.0", "@openzeppelin/contracts": "^4.9.5", "hardhat": "^2.19.2" - }, - "version": "0.0.0" + } } diff --git a/test/TestFundingVaultProxy.js b/fundingvault/test/TestFundingVaultProxy.js similarity index 95% rename from test/TestFundingVaultProxy.js rename to fundingvault/test/TestFundingVaultProxy.js index 0861825..7237fef 100644 --- a/test/TestFundingVaultProxy.js +++ b/fundingvault/test/TestFundingVaultProxy.js @@ -6,6 +6,22 @@ const { expect } = require("chai"); // omit the env var to disable debug prints. const debug = process.env.HARDHAT_DEBUG !== undefined; +function toHex(str, len) { + var result = ''; + var ccode; + for (var i=0; i Date: Mon, 3 Jun 2024 20:59:47 +0200 Subject: [PATCH 2/2] update workflow trigger --- .github/workflows/build-test.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 78de5ad..288ed67 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -1,5 +1,8 @@ name: Build and Test on: + pull_request: + branches: + - master push: branches: - master