Skip to content

Commit 7f7047b

Browse files
author
bohendo
committed
lint scripts
1 parent 4d6a5c0 commit 7f7047b

13 files changed

+8941
-99
lines changed

scripts/ci_test_brownie.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#!/usr/bin/env bash
22

3-
pip install eth-brownie
3+
# Install eth-brownie if it's not already present
4+
if [[ -z "$(command -v brownie)" ]]
5+
then pip install eth-brownie
6+
fi
7+
48
brownie bake token
5-
cd token || exit 255
69

7-
crytic-compile . --compile-force-framework Brownie
10+
cd token || exit 255
811

9-
if [ $? -ne 0 ]
10-
then
11-
echo "Brownie test failed"
12-
exit 255
12+
if ! crytic-compile . --compile-force-framework Brownie
13+
then echo "Brownie test failed" && exit 255
14+
else echo "Brownie test passed" && exit 0
1315
fi

scripts/ci_test_buidler.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#!/usr/bin/env bash
22

3-
### Test buidler integration
3+
# Test buidler integration
44

55
cd tests/buidler || exit 255
66

7-
npm install --save-dev @nomiclabs/buidler
7+
npm install || exit 255
88

9-
crytic-compile .
10-
if [ $? -ne 0 ]
11-
then
12-
echo "buidler test failed"
13-
exit 255
9+
if ! crytic-compile .
10+
then echo "Buidler test failed" && exit 255
11+
else echo "Buidler test passed" && exit 0
1412
fi

scripts/ci_test_dapp.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
### Test dapp integration
3+
# Test dapp integration
44

55
DIR=$(mktemp -d)
66
cd "$DIR" || exit 255
@@ -16,10 +16,7 @@ nix-env -f "$HOME/.dapp/dapptools" -iA dapp seth solc hevm ethsign
1616

1717
dapp init
1818

19-
crytic-compile . --compile-remove-metadata
20-
if [ $? -ne 0 ]
21-
then
22-
echo "dapp test failed"
23-
exit 255
19+
if ! crytic-compile . --compile-remove-metadata
20+
then echo "dapp test failed" && exit 255
21+
else echo "dapp test passed" && exit 0
2422
fi
25-

scripts/ci_test_embark.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
### Test embark integration
3+
# Test embark integration
44

55
cd /tmp || exit 255
66

@@ -13,11 +13,8 @@ npm install -g [email protected]
1313
embark demo
1414
cd /tmp/embark_demo || exit 255
1515
npm install
16-
crytic-compile . --embark-overwrite-config --compile-remove-metadata
1716

18-
if [ $? -ne 0 ]
19-
then
20-
echo "Embark test failed"
21-
exit 255
17+
if ! crytic-compile . --embark-overwrite-config --compile-remove-metadata
18+
then echo "Embark test failed" && exit 255
19+
else echo "Embark test passed" && exit 0
2220
fi
23-

scripts/ci_test_etherlime.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
#!/usr/bin/env bash
22

3-
### Test etherlime integration
3+
# Test etherlime integration
44

55
DIR=$(mktemp -d)
66
cd "$DIR" || exit 255
77

8-
npm i -g etherlime
8+
# Install etherlime if it's not already present
9+
if [[ -z "$(command -v etherlime)" ]]
10+
then npm i -g etherlime
11+
fi
12+
913
etherlime init
10-
crytic-compile . --compile-remove-metadata
1114

12-
if [ $? -ne 0 ]
13-
then
14-
echo "Etherlime test failed"
15-
exit 255
15+
if ! crytic-compile . --compile-remove-metadata
16+
then echo "Etherlime test failed" && exit 255
17+
else echo "Etherlime test passed" && exit 0
1618
fi
17-

scripts/ci_test_etherscan.sh

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,24 @@
11
#!/usr/bin/env bash
22

3-
### Test etherscan integration
3+
# Test etherscan integration
44

55
DIR=$(mktemp -d)
66
cd "$DIR" || exit 255
77

88
solc-select use 0.4.25 --always-install
99

10-
crytic-compile 0x7F37f78cBD74481E593F9C737776F7113d76B315 --compile-remove-metadata --etherscan-apikey "$GITHUB_ETHERSCAN"
11-
12-
if [ $? -ne 0 ]
13-
then
14-
echo "Etherscan test failed"
15-
exit 255
10+
if ! crytic-compile 0x7F37f78cBD74481E593F9C737776F7113d76B315 --compile-remove-metadata --etherscan-apikey "$GITHUB_ETHERSCAN"
11+
then echo "Etherscan test failed" && exit 255
1612
fi
1713

18-
crytic-compile rinkeby:0xFe05820C5A92D9bc906D4A46F662dbeba794d3b7 --compile-remove-metadata --etherscan-apikey "$GITHUB_ETHERSCAN"
1914

20-
if [ $? -ne 0 ]
21-
then
22-
echo "Etherscan test failed"
23-
exit 255
15+
if ! crytic-compile rinkeby:0xFe05820C5A92D9bc906D4A46F662dbeba794d3b7 --compile-remove-metadata --etherscan-apikey "$GITHUB_ETHERSCAN"
16+
then echo "Etherscan test failed" && exit 255
2417
fi
2518

2619
# From crytic/slither#1154
27-
crytic-compile 0xcfc1E0968CA08aEe88CbF664D4A1f8B881d90f37 --compile-remove-metadata --etherscan-apikey "$GITHUB_ETHERSCAN"
28-
29-
if [ $? -ne 0 ]
30-
then
31-
echo "Etherscan test failed"
32-
exit 255
20+
if ! crytic-compile 0xcfc1E0968CA08aEe88CbF664D4A1f8B881d90f37 --compile-remove-metadata --etherscan-apikey "$GITHUB_ETHERSCAN"
21+
then echo "Etherscan test failed" && exit 255
3322
fi
23+
24+
echo "Etherscan test passed" && exit 0

scripts/ci_test_foundry.sh

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
#!/usr/bin/env bash
22

3-
### Test foundry integration
3+
# Test foundry integration
44

5-
6-
cd /tmp || exit 255
7-
8-
curl -L https://foundry.paradigm.xyz | bash
9-
export PATH=$PATH:/home/runner/.foundry/bin
10-
foundryup
5+
# Setup temp environment
6+
DIR=$(mktemp -d)
7+
cd "$DIR" || exit 255
118

129
# The foundry init process makes a temporary local git repo and needs certain values to be set
1310
git config --global user.email "[email protected]"
1411
git config --global user.name "CI User"
1512

16-
mkdir forge_test
17-
cd forge_test || exit 255
13+
# Install foundry if it's not already present
14+
if [[ -z "$(command -v foundryup)" ]]
15+
then
16+
curl -L https://foundry.paradigm.xyz | bash
17+
export PATH=$PATH:/home/runner/.foundry/bin
18+
fi
19+
20+
foundryup
1821
forge init
1922

20-
crytic-compile .
21-
if [ $? -ne 0 ]
22-
then
23-
echo "foundry test failed"
24-
exit 255
23+
if ! crytic-compile .
24+
then echo "Foundry test failed" && exit 255
25+
else echo "Foundry test passed" && exit 0
2526
fi

scripts/ci_test_hardhat.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ cd tests/hardhat || exit 255
66

77
npm install
88

9-
crytic-compile .
10-
if [ $? -ne 0 ]
11-
then
12-
echo "hardhat test failed"
13-
exit 255
9+
if ! crytic-compile .
10+
then echo "Hardhat test failed" && exit 255
11+
else echo "Hardhat test passed" && exit 0
1412
fi

scripts/ci_test_solc.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
#!/usr/bin/env bash
22

33
DIR=$(mktemp -d)
4-
54
cp tests/contract.sol "$DIR"
65
cd "$DIR" || exit 255
6+
77
crytic-compile contract.sol --compile-remove-metadata --export-format truffle
88

99
cd - || exit 255
1010
DIFF=$(diff "$DIR/crytic-export/C.json" tests/expected/solc-demo.json)
1111
if [ "$?" != "0" ] || [ "$DIFF" != "" ]
12-
then
13-
echo "solc test failed"
14-
echo "$DIFF"
15-
exit 255
12+
then echo -e "solc test failed\n$DIFF" && exit 255
13+
else echo -e "solc test passed" && exit 0
1614
fi
17-
18-

scripts/ci_test_truffle.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@
55
DIR=$(mktemp -d)
66
cd "$DIR" || exit 255
77

8-
npm install -g truffle
8+
# Install truffle if it's not already present
9+
if [[ -z "$(command -v truffle)" ]]
10+
then npm install -g truffle
11+
fi
12+
913
truffle unbox metacoin
10-
crytic-compile . --compile-remove-metadata
1114

12-
if [ $? -ne 0 ]
13-
then
14-
echo "Truffle test failed"
15-
exit 255
15+
if ! crytic-compile . --compile-remove-metadata
16+
then echo "Truffle test failed" && exit 255
17+
else echo "Truffle test passed" && exit 0
1618
fi
19+
1720
# TODO: for some reason truffle output is not deterministc
1821
# The assigned id changes
1922
#cd -

0 commit comments

Comments
 (0)