Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Commit

Permalink
Add scripts to run geth in CI (not enabled)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgewecke committed Apr 21, 2018
1 parent 9a383cc commit c971585
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mock/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mock/package.json
@@ -1,9 +1,10 @@
{
"name": "eth-gas-reporter",
"version": "0.1.1",
"version": "0.1.2",
"description": "Mocha reporter which shows gas used per unit test.",
"main": "index.js",
"scripts": {
"geth": "./scripts/geth.sh",
"test": "./mock/test.sh"
},
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions mock/truffle.js
Expand Up @@ -7,6 +7,6 @@ module.exports = {
}
},
mocha: {
reporter: 'eth-gas-reporter'
reporter: 'eth-gas-reporter',
}
}
}
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -4,6 +4,7 @@
"description": "Mocha reporter which shows gas used per unit test.",
"main": "index.js",
"scripts": {
"geth": "./scripts/geth.sh",
"test": "./mock/test.sh"
},
"repository": {
Expand Down
33 changes: 33 additions & 0 deletions scripts/geth-accounts.js
@@ -0,0 +1,33 @@
/**
* @author cpurta <cpurta@gmail.com>
* @github https://github.com/cpurta/geth-devnet
* This code comes from Christopher Purta's `geth-devnet` project.
* geth --dev seeds with a single account so we need to spin
* up more accounts and short-circuit account auto-locking to get multi-account
* tests passing.
*/

function createAccounts() {
for (var i = 0; i < 10; i++) {
acc = personal.newAccount("");
personal.unlockAccount(acc, "");
eth.sendTransaction({from: eth.accounts[0], to: acc, value: web3.toWei(1000, "ether")});
}
}

function unlockAccounts() {
eth.accounts.forEach(function (account) {
console.log('Unlocking ' + account + '...');
personal.unlockAccount(account, '', 86400);
});
}

function setupDevNode() {
// keep accounts unlocked
while (true) {
unlockAccounts()
}
}

createAccounts();
setupDevNode();
15 changes: 15 additions & 0 deletions scripts/geth.sh
@@ -0,0 +1,15 @@
docker run \
-v /$PWD/scripts:/scripts \
-p 8545:8545 \
-p 30303:30303 \
ethereum/client-go:latest \
--rpc \
--rpcaddr '0.0.0.0' \
--rpcport 8545 \
--rpccorsdomain '*' \
--nodiscover \
--dev \
--dev.period 1 \
--targetgaslimit '9000000' \
js ./scripts/geth-accounts.js \
> /dev/null &

0 comments on commit c971585

Please sign in to comment.