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

Commit

Permalink
work on ci
Browse files Browse the repository at this point in the history
  • Loading branch information
simonDos committed Jan 31, 2024
1 parent 7e5e5de commit 16b0a43
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
src = 'contracts'
out = 'out'
libs = ['node_modules']
test = 'test'
match-path = 'test/foundry'
optimizer = true
optimizer_runs = 200
via_ir = true
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"build": "forge build",
"test:hardhat": "npx hardhat test",
"test:foundry": "forge test",
"test:ci": "scripts/run-test.sh",
"test:anvil": "anvil --hardfork istanbul --mnemonic 'clock radar mass judge dismiss just intact mind resemble fringe diary casino' -p 9545 --gas-limit 10000000 --gas-price 0 --code-size-limit 999999 --accounts 200",
"template:process": "node scripts/process-templates.cjs",
"coverage": "SOLIDITY_COVERAGE=true npx hardhat coverage --solcoverjs .solcover.cjs",
"bor:simulate": "cd test-bor-docker && bash run-docker.sh",
Expand Down
46 changes: 46 additions & 0 deletions scripts/run-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash

# Exit script as soon as a command fails.
set -o errexit

# Executes cleanup function at script exit.
trap cleanup EXIT

# get current directory
PWD=$(pwd)

cleanup() {
echo "Cleaning up"
pkill -f ganache-cli
cd $PWD/test-bor-docker
bash stop-docker.sh
bash clean.sh
cd ..
echo "Done"
}

start_testrpc() {
npm run test:anvil > /dev/null &
}

start_blockchain() {
cd $PWD/test-bor-docker
bash run-docker.sh
cd ..
}


echo "Starting our own testrpc instance"
start_testrpc

echo "Starting our own geth instance"
start_blockchain

if [ "$SOLIDITY_COVERAGE" = true ]; then
npm run coverage "$@"
else
npm run test:hardhat "$@"
npm run test:foundry "$@"
fi


0 comments on commit 16b0a43

Please sign in to comment.