Skip to content

Commit be1fdb9

Browse files
author
bohendo
committed
add test for monorepops
1 parent 7f7047b commit be1fdb9

File tree

5 files changed

+77
-0
lines changed

5 files changed

+77
-0
lines changed

scripts/ci_test_monorepo.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
### Test monorepo integration
4+
5+
cd tests/monorepo || exit 255
6+
7+
npm install
8+
9+
cd contracts || exit 255
10+
11+
if ! crytic-compile .
12+
then echo "Monorepo test failed" && exit 255
13+
else echo "Monorepo test passed" && exit 0
14+
fi
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//SPDX-License-Identifier: Unlicense
2+
pragma solidity ^0.7.0;
3+
4+
import "hardhat/console.sol";
5+
6+
7+
contract Greeter {
8+
string greeting;
9+
10+
constructor(string memory _greeting) {
11+
console.log("Deploying a Greeter with greeting:", _greeting);
12+
greeting = _greeting;
13+
}
14+
15+
function greet() public view returns (string memory) {
16+
return greeting;
17+
}
18+
19+
function setGreeting(string memory _greeting) public {
20+
console.log("Changing greeting from '%s' to '%s'", greeting, _greeting);
21+
greeting = _greeting;
22+
}
23+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
require("@nomiclabs/hardhat-waffle");
2+
3+
// This is a sample Hardhat task. To learn how to create your own go to
4+
// https://hardhat.org/guides/create-task.html
5+
task("accounts", "Prints the list of accounts", async () => {
6+
const accounts = await ethers.getSigners();
7+
8+
for (const account of accounts) {
9+
console.log(account.address);
10+
}
11+
});
12+
13+
// You need to export an object to set up your config
14+
// Go to https://hardhat.org/config/ to learn more
15+
16+
/**
17+
* @type import('hardhat/config').HardhatUserConfig
18+
*/
19+
module.exports = {
20+
solidity: "0.7.3",
21+
};
22+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "hardhat-project",
3+
"devDependencies": {
4+
"@nomiclabs/hardhat-ethers": "^2.0.0",
5+
"@nomiclabs/hardhat-waffle": "^2.0.0",
6+
"chai": "^4.2.0",
7+
"ethereum-waffle": "^3.2.0",
8+
"ethers": "^5.0.19",
9+
"hardhat": "^2.0.2"
10+
}
11+
}

tests/monorepo/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "monorepo",
3+
"workspaces": [
4+
"contracts"
5+
],
6+
"private": true
7+
}

0 commit comments

Comments
 (0)