Skip to content
This repository has been archived by the owner on Aug 6, 2021. It is now read-only.

Commit

Permalink
Add snapshotting of ap-chain to build process
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-es committed Oct 4, 2020
1 parent 8fa7dd2 commit 504d149
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Binary file added packages/ap-contracts/ap-chain-snapshot.tar.gz
Binary file not shown.
3 changes: 2 additions & 1 deletion packages/ap-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
"registry": "https://npm.pkg.github.com/"
},
"scripts": {
"build": "npm run compile && npm run generate-ts-bindings",
"build": "npm run compile && npm run generate-ts-bindings && npm run generate-ap-chain-snapshot",
"compile": "node --max-old-space-size=4096 ./node_modules/.bin/buidler compile",
"coverage": "node --max-old-space-size=4096 ./node_modules/.bin/buidler coverage",
"generate-ap-chain-snapshot": "./scripts/setup-ap-chain.sh --take-snapshot",
"generate-ts-bindings": "rm -rf ./ts-bindings && typechain --target web3-v1 --outDir ./ts-bindings './build/contracts/*.json'",
"lint": "solhint contracts/**/*.sol",
"lint:fix": "solhint contracts/**/*.sol --fix",
Expand Down
12 changes: 11 additions & 1 deletion packages/ap-contracts/scripts/setup-ap-chain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,24 @@ npx --quiet ganache-cli \
--gasLimit "8000000" \
--defaultBalanceEther "5000000000" \
--deterministic --mnemonic "helmet copy pause hood gun soon fork drum educate curious despair embrace" \
`if [[ $* == *--take-snapshot* ]]; then echo --db "./ap-chain-snapshot/db"; fi` \
1>/dev/null &

ganache_pid=$!

sleep 1

[ "$1" == "--no-deploy" ] || \
if [[ $* != *--no-deploy* ]]; then
npx --quiet buidler deploy --network ap-chain --tags deploy-ap-chain
fi

if [[ $* == *--take-snapshot* ]]; then
sleep 3
tar -zcf ap-chain-snapshot.tar.gz ap-chain-snapshot
rm -r ap-chain-snapshot
echo "✓ created snapshot"
exit 0
fi

echo "✓ ready"

Expand Down

0 comments on commit 504d149

Please sign in to comment.