Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ysu/fix contract test ci 2 #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy-contract.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ jobs:
- name: Test contract
run: |
sudo make contract-tools
sudo make test-contract
sudo make test-solidity
if: "env.GIT_DIFF != ''"
13 changes: 0 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,6 @@ else
@echo "protoc already installed; skipping..."
endif

ifeq (, $(shell which solcjs))
@echo "Installing solcjs..."
@npm install -g [email protected]
else
@echo "solcjs already installed; skipping..."
endif

docs-tools:
ifeq (, $(shell which yarn))
@echo "Installing yarn..."
Expand Down Expand Up @@ -316,12 +309,6 @@ test-rpc:
test-rpc-pending:
./scripts/integration-test-all.sh -t "pending" -q 1 -z 1 -s 2 -m "pending" -r "true"

test-contract:
@type "npm" 2> /dev/null || (echo 'Npm does not exist. Please install node.js and npm."' && exit 1)
@type "solcjs" 2> /dev/null || (echo 'Solcjs does not exist. Please install solcjs using make contract-tools."' && exit 1)
@type "protoc" 2> /dev/null || (echo 'Failed to install protoc. Please reinstall protoc using make contract-tools.' && exit 1)
bash scripts/contract-test.sh

test-solidity:
@echo "Beginning solidity tests..."
./scripts/run-solidity-tests.sh
Expand Down
58 changes: 3 additions & 55 deletions scripts/run-solidity-tests.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
#!/bin/bash

export GOPATH=~/go
export PATH=$PATH:$GOPATH/bin
go build -o ./build/ethermintd ./cmd/ethermintd
mkdir $GOPATH/bin
cp ./build/ethermintd $GOPATH/bin

localKeyAddr=0x7cb61d4117ae31a12e393a1cfa3bac666481d02e
user1Addr=0xc6fe5d33615a1c52c08018c47e8bc53646a0e101
user2Addr=0x963ebdf2e1f8db8707d05fc75bfeffba1b5bac17

CHAINID="ethermint-1337"
# remove existing daemon and client
rm -rf ~/.ethermintd*

# build ethermint binary
make install
Expand All @@ -26,49 +19,4 @@ else
yarn install
fi

chmod +x ./init-test-node.sh
nohup ./init-test-node.sh > ethermintd.log 2>&1 &

# give ethermintd node enough time to launch
echo "sleeping ..."
sleep 10

# show existing accounts
echo "account list: "
curl -X POST --data '{"jsonrpc":"2.0","method":"personal_listAccounts","params":[],"id":1}' -H "Content-Type: application/json" http://localhost:8545

# unlock localKey address
curl -X POST --data '{"jsonrpc":"2.0","method":"personal_unlockAccount","params":["'$localKeyAddr'", ""],"id":1}' -H "Content-Type: application/json" http://localhost:8545

# tests start
cd suites/initializable
yarn contract-migrate
yarn test-ethermint

ok=$?

if (( $? != 0 )); then
echo "initializable test failed: exit code $?"
fi

killall ethermintd

echo "Script exited with code $ok"
exit $ok

# initializable-buidler fails on CI, re-add later

./../../init-test-node.sh > ethermintd.log
cd ../initializable-buidler
yarn test-ethermint

ok=$(($? + $ok))

if (( $? != 0 )); then
echo "initializable-buidler test failed: exit code $?"
fi

killall ethermintd

echo "Script exited with code $ok"
exit $ok
yarn test --network ethermint --verbose-log initializable
6 changes: 6 additions & 0 deletions tests/solidity/test-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,10 @@ async function main() {
process.exit(0);
}

// Add handler to exit the program when UnhandledPromiseRejection

process.on('unhandledRejection', () => {
process.exit(-1);
});

main();