Skip to content
This repository was archived by the owner on Nov 30, 2021. It is now read-only.

Commit 248bcc3

Browse files
authored
add test-solidity to github actions, create test script (#510)
1 parent 517de55 commit 248bcc3

File tree

4 files changed

+84
-1
lines changed

4 files changed

+84
-1
lines changed

.github/workflows/test.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,3 +210,20 @@ jobs:
210210
run: |
211211
make test-import
212212
if: "env.GIT_DIFF != ''"
213+
214+
test-solidity:
215+
runs-on: ubuntu-latest
216+
timeout-minutes: 10
217+
steps:
218+
- uses: actions/checkout@v2
219+
- uses: technote-space/[email protected]
220+
id: git_diff
221+
with:
222+
SUFFIX_FILTER: |
223+
.go
224+
.mod
225+
.sum
226+
- name: test-solidity
227+
run: |
228+
make test-solidity
229+
if: "env.GIT_DIFF != ''"

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,11 @@ test-sim-multi-seed-short: runsim
292292
@echo "Running multi-seed application simulation. This may take awhile!"
293293
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 10 TestFullAppSimulation
294294

295-
.PHONY: test test-unit test-race test-import test-rpc test-contract
295+
test-solidity:
296+
@echo "Beginning solidity tests..."
297+
./scripts/run-solidity-tests.sh
298+
299+
.PHONY: test test-unit test-race test-import test-rpc test-contract test-solidity
296300

297301
.PHONY: test-sim-nondeterminism test-sim-custom-genesis-fast test-sim-import-export test-sim-after-import \
298302
test-sim-custom-genesis-multi-seed test-sim-multi-seed-long test-sim-multi-seed-short

app/ethermint.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,5 +396,6 @@ func GetMaccPerms() map[string][]string {
396396
for k, v := range maccPerms {
397397
dupMaccPerms[k] = v
398398
}
399+
399400
return dupMaccPerms
400401
}

scripts/run-solidity-tests.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
3+
export GOPATH=~/go
4+
export PATH=$PATH:$GOPATH/bin
5+
go build -o ./build/ethermintd ./cmd/ethermintd
6+
go build -o ./build/ethermintcli ./cmd/ethermintcli
7+
mkdir $GOPATH/bin
8+
cp ./build/ethermintd $GOPATH/bin
9+
cp ./build/ethermintcli $GOPATH/bin
10+
11+
cd tests-solidity
12+
13+
if command -v yarn &> /dev/null; then
14+
yarn install
15+
else
16+
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
17+
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
18+
sudo apt update && sudo apt install yarn
19+
yarn install
20+
fi
21+
22+
chmod +x ./init-test-node.sh
23+
./init-test-node.sh > ethermintd.log &
24+
sleep 5
25+
ethermintcli rest-server --laddr "tcp://localhost:8545" --unlock-key localkey,user1,user2 --chain-id 1337 --trace --wsport 8546 > ethermintcli.log &
26+
27+
cd suites/initializable
28+
yarn test-ethermint
29+
30+
ok=$?
31+
32+
if (( $? != 0 )); then
33+
echo "initializable test failed: exit code $?"
34+
fi
35+
36+
killall ethermintcli
37+
killall ethermintd
38+
39+
echo "Script exited with code $ok"
40+
exit $ok
41+
42+
# initializable-buidler fails on CI, re-add later
43+
44+
./../../init-test-node.sh > ethermintd.log &
45+
sleep 5
46+
ethermintcli rest-server --laddr "tcp://localhost:8545" --unlock-key localkey,user1,user2 --chain-id 1337 --trace --wsport 8546 > ethermintcli.log &
47+
48+
cd ../initializable-buidler
49+
yarn test-ethermint
50+
51+
ok=$(($? + $ok))
52+
53+
if (( $? != 0 )); then
54+
echo "initializable-buidler test failed: exit code $?"
55+
fi
56+
57+
killall ethermintcli
58+
killall ethermintd
59+
60+
echo "Script exited with code $ok"
61+
exit $ok

0 commit comments

Comments
 (0)