diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 343232f16..d934a1bd9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,7 +31,7 @@ jobs: - name: Build run: npm run build - name: Check storage layout - run: npm run test-storage-layout + run: npm run check-storage-layout - name: Test deployment run: npm run deploy - name: Test Timelock deployment diff --git a/CHANGELOG.md b/CHANGELOG.md index db50df533..c36b93e02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - [x] `IexecPoco2Delegate.sol` ### Features +- Housekeeping (#207, ) - Add Halborn "Poco v5.5 & Voucher v1.0" audit report (#205) - Refactor Factory deployer (#206) - Enable native tests on CI (#204) diff --git a/README.md b/README.md index d6801e49d..93fea986f 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ PoCo smart contracts come with a test suite in the `./test` folder. You can star ``` npm install -npm run autotest +npm run test ``` Additionally, you can produce a coverage report using the following command: @@ -108,7 +108,7 @@ The automatic testing command uses the Hardhat network by default to run the tes ``` - Or run any other blockchain client. 2. **[Optional]** Update the configuration - + If your blockchain listen to a port that is not 8545, or if the blockchain is on a different node, update the `hardhat.config.ts` configuration (network ports, accounts with mnemonic, ..) accordingly to the [Hardhat Configuration](https://hardhat.org/hardhat-runner/docs/config) documentation. 3. Run tests ``` diff --git a/checkCopyright.sh b/checkCopyright.sh deleted file mode 100755 index b0844dc8b..000000000 --- a/checkCopyright.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -copyrightRegex='Copyright 202[0-9] IEXEC BLOCKCHAIN TECH' - -folders=( - 'contracts' - 'migrations' - 'scripts' - 'test' - 'utils' -) - -for folder in ${folders[@]}; do - echo "# Checking copyrights in $folder" - grep --recursive --files-without-match --regexp "${copyrightRegex}" ${folder} | sort -done diff --git a/package.json b/package.json index c6cf18379..4dd8acfa0 100644 --- a/package.json +++ b/package.json @@ -11,17 +11,16 @@ "build": "npx hardhat compile", "deploy": "npx hardhat deploy", "deploy:timelock": "hardhat run scripts/deploy-timelock.ts", - "test-storage-layout": "npx hardhat run scripts/test-storage.ts", + "check-storage-layout": "npx hardhat run scripts/check-storage.ts", "test": "REPORT_GAS=true npx hardhat test", "test:native": "TEST__IS_NATIVE_CHAIN=true npx hardhat test test/byContract/IexecEscrow/IexecEscrowNative.test.ts", - "autotest": "./test.sh", "coverage": "npx hardhat coverage", "verify": "npx hardhat verify", "format": "npx prettier --write", "uml": "npm run sol-to-uml && npm run puml-to-links && npm run storage-to-diagrams", - "sol-to-uml": "npx zx tools/sol-to-uml.mjs", - "puml-to-links": "npx zx tools/puml-to-links.mjs", - "storage-to-diagrams": "npx zx tools/storage-to-diagrams.mjs", + "sol-to-uml": "npx zx scripts/tools/sol-to-uml.mjs", + "puml-to-links": "npx zx scripts/tools/puml-to-links.mjs", + "storage-to-diagrams": "npx zx scripts/tools/storage-to-diagrams.mjs", "doc": "npx hardhat docgen" }, "lint-staged": { diff --git a/scripts/test-storage.ts b/scripts/check-storage.ts similarity index 100% rename from scripts/test-storage.ts rename to scripts/check-storage.ts diff --git a/tools/puml-to-links.mjs b/scripts/tools/puml-to-links.mjs similarity index 89% rename from tools/puml-to-links.mjs rename to scripts/tools/puml-to-links.mjs index 378a746ee..0670cc970 100644 --- a/tools/puml-to-links.mjs +++ b/scripts/tools/puml-to-links.mjs @@ -3,15 +3,15 @@ // TODO: Add this script to pre-commit hook in order to keep up-to-date links // Render .puml files (referenced in markdown comments) to web links -// Usage: "npm run puml2links" or "npx zx tools/puml-to-links.mjs" +// Usage: "npm run puml2links" or "npx zx scripts/tools/puml-to-links.mjs" // Note: -// Using server-side rendering with `puml-for-markdown` since `node-plantuml`` +// Using server-side rendering with `puml-for-markdown` since `node-plantuml`` // requires Java on host. See https://github.com/danielyaa5/puml-for-markdown // Note: -// To ensure freshness of a parent diagram, it might be necessary to +// To ensure freshness of a parent diagram, it might be necessary to // remove everything before from // [![ABC](https://tinyurl.com/abcdef)](https://tinyurl.com/abcdef) -// in order to force recreation of this parent diagram made of updated and +// in order to force recreation of this parent diagram made of updated and // included child diagrams. diff --git a/tools/sol-to-uml.mjs b/scripts/tools/sol-to-uml.mjs similarity index 90% rename from tools/sol-to-uml.mjs rename to scripts/tools/sol-to-uml.mjs index a4cd4b670..3ec773ecc 100644 --- a/tools/sol-to-uml.mjs +++ b/scripts/tools/sol-to-uml.mjs @@ -1,6 +1,6 @@ #!/usr/bin/env zx -// Usage: "npm run sol-to-uml" or "npx zx tools/solidity-to-uml.mjs" +// Usage: "npm run sol-to-uml" or "npx zx scripts/tools/solidity-to-uml.mjs" // For sol2uml documentation, see https://github.com/naddison36/sol2uml#usage @@ -37,7 +37,7 @@ await generateClassDiagramOfContracts( /** * Generate UML class diagrams for contracts in a given directory. - * @param directory + * @param directory */ async function generateClassDiagramOfDirectory(directory) { console.log(`Generating class diagram for directory : ${directory}`); @@ -48,13 +48,13 @@ async function generateClassDiagramOfDirectory(directory) { /** * Generate UML class diagrams for a set of given contracts. - * @param contractsList - * @param diagramName + * @param contractsList + * @param diagramName */ async function generateClassDiagramOfContracts(contractsList, diagramName) { console.log(`Generating class diagram for contracts : ${contractsList}`); const baseContracts = contractsList.join(','); // => c1,c2,c3 - // -b, --baseContractNames + // -b, --baseContractNames // only output contracts connected to these comma separated base contract names await $`cd ${projectRootDir}/ && npx sol2uml class contracts/ -b ${baseContracts} -o docs/uml/class-uml-${diagramName}.svg` diff --git a/tools/storage-to-diagrams.mjs b/scripts/tools/storage-to-diagrams.mjs similarity index 78% rename from tools/storage-to-diagrams.mjs rename to scripts/tools/storage-to-diagrams.mjs index c9e1706e9..034220b21 100644 --- a/tools/storage-to-diagrams.mjs +++ b/scripts/tools/storage-to-diagrams.mjs @@ -1,6 +1,6 @@ #!/usr/bin/env zx -// Usage: "npm run storage-to-diagrams" or "npx zx tools/storage-to-diagrams" +// Usage: "npm run storage-to-diagrams" or "npx zx scripts/tools/storage-to-diagrams" // Check sol2uml documentation at https://github.com/naddison36/sol2uml#storage-usage. @@ -11,10 +11,10 @@ generateStorageDiagram('IexecPocoBoostDelegate') /** * Generate storage diagram of a given contract. - * @param contractName + * @param contractName */ async function generateStorageDiagram(contractName) { console.log(`Generating storage diagram for contract : ${contractName}`); - await $`cd ${projectRootDir} && + await $`cd ${projectRootDir} && npx sol2uml storage -c ${contractName} -o docs/uml/storage-${contractName}.svg .` } diff --git a/test.sh b/test.sh deleted file mode 100755 index 719bf8a76..000000000 --- a/test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -sub_dir="" - -logs_dir="logs/$sub_dir" -mkdir -p $logs_dir -exit_code=0 -if [[ $OSTYPE == 'darwin'* ]]; then - files=$(find test/ -type f | sort) -else - files=$(find test/ -regex '.*\(js\|ts\)' | sort) -fi -for f in $files; do - log_file=$logs_dir$(basename "$f").logs - echo "Running $sub_dir: $f ($log_file)" - npx hardhat test "$f" &>"$log_file" # redirect stdout and stderr - # display summary (filter with passing/failing and only show failing) - failing_line=$(grep -A 2 'passing (' "$log_file" | - grep 'failing') - if [ -n "$failing_line" ]; then - exit_code=1 - echo "$failing_line" - fi -done - -exit $exit_code