Skip to content

Commit 3e5ea1b

Browse files
authored
Windows CI for crytic-compile (#249)
Add Windows to the CI
1 parent 66fe16d commit 3e5ea1b

14 files changed

+88
-67
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: CI
23

34
on:
@@ -8,31 +9,62 @@ on:
89
pull_request:
910
schedule:
1011
# run CI every day even if no PRs/merges occur
11-
- cron: '0 12 * * *'
12+
- cron: '0 12 * * *'
1213

1314
jobs:
1415
tests:
15-
runs-on: ubuntu-latest
16+
runs-on: ${{ matrix.os }}
1617
strategy:
1718
matrix:
18-
type: ["solc", "truffle", "embark", "etherlime", "brownie", "waffle", "buidler", "hardhat"]
19+
os: ["ubuntu-latest", "windows-2022"]
20+
type: ["brownie", "buidler", "dapp", "embark", "etherlime", "hardhat", "solc", "truffle", "waffle"]
1921
exclude:
2022
# Currently broken, tries to pull git:// which is blocked by GH
2123
- type: embark
24+
# Requires nix
25+
- os: windows-2022
26+
type: dapp
2227
steps:
23-
- uses: actions/checkout@v1
28+
- uses: actions/checkout@v3
29+
- name: Set up shell
30+
if: runner.os == 'Windows'
31+
run: |
32+
echo 'C:\msys64\mingw64\bin' >> "$GITHUB_PATH"
33+
echo 'C:\msys64\usr\bin' >> "$GITHUB_PATH"
34+
- name: Choose Node version
35+
id: node
36+
shell: bash
37+
run: |
38+
if [ ${{ matrix.type }} = etherlime ]; then
39+
echo '::set-output name=version::10.17.0'
40+
else
41+
echo '::set-output name=version::lts/*'
42+
fi
43+
- name: Set up Node
44+
uses: actions/setup-node@v2
45+
with:
46+
node-version: ${{ steps.node.outputs.version }}
2447
- name: Set up Python 3.6
25-
uses: actions/setup-python@v1
48+
uses: actions/setup-python@v3
2649
with:
2750
python-version: 3.6
2851
- name: Install dependencies
2952
run: |
30-
sudo wget -O /usr/bin/solc https://github.com/ethereum/solidity/releases/download/v0.5.7/solc-static-linux
31-
sudo chmod +x /usr/bin/solc
53+
pip install "solc-select>=v1.0.0b1"
54+
solc-select use 0.5.7 --always-install
3255
pip install .
56+
- name: Set up nix
57+
if: matrix.type == 'dapp'
58+
uses: cachix/install-nix-action@v16
59+
- name: Set up cachix
60+
if: matrix.type == 'dapp'
61+
uses: cachix/cachix-action@v10
62+
with:
63+
name: dapp
3364
- name: Run Tests
3465
env:
3566
TEST_TYPE: ${{ matrix.type }}
3667
GITHUB_ETHERSCAN: ${{ secrets.GITHUB_ETHERSCAN }}
68+
shell: bash
3769
run: |
3870
bash "scripts/travis_test_${TEST_TYPE}.sh"

.github/workflows/darglint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: Darglint
23

34
on:

.github/workflows/etherscan.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: CI
23

34
on:
@@ -7,28 +8,35 @@ on:
78
- dev
89
schedule:
910
# run CI every day even if no PRs/merges occur
10-
- cron: '0 12 * * *'
11+
- cron: '0 12 * * *'
1112

1213
jobs:
1314
tests:
14-
runs-on: ubuntu-latest
15+
runs-on: ${{ matrix.os }}
1516
strategy:
1617
matrix:
18+
os: ["ubuntu-latest", "windows-2022"]
1719
type: ["etherscan"]
1820
steps:
19-
- uses: actions/checkout@v1
21+
- uses: actions/checkout@v3
22+
- name: Set up shell
23+
if: runner.os == 'Windows'
24+
run: |
25+
echo 'C:\msys64\mingw64\bin' >> "$GITHUB_PATH"
26+
echo 'C:\msys64\usr\bin' >> "$GITHUB_PATH"
2027
- name: Set up Python 3.6
21-
uses: actions/setup-python@v1
28+
uses: actions/setup-python@v3
2229
with:
2330
python-version: 3.6
2431
- name: Install dependencies
2532
run: |
26-
sudo wget -O /usr/bin/solc https://github.com/ethereum/solidity/releases/download/v0.5.7/solc-static-linux
27-
sudo chmod +x /usr/bin/solc
33+
pip install "solc-select>=v1.0.0b1"
34+
solc-select use 0.5.7 --always-install
2835
pip install .
2936
- name: Run Tests
3037
env:
3138
TEST_TYPE: ${{ matrix.type }}
3239
GITHUB_ETHERSCAN: ${{ secrets.GITHUB_ETHERSCAN }}
40+
shell: bash
3341
run: |
3442
bash "scripts/travis_test_${TEST_TYPE}.sh"

.github/workflows/pylint.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,3 @@ jobs:
4444
VALIDATE_PYTHON: true
4545
VALIDATE_PYTHON_PYLINT: true
4646
PYTHON_PYLINT_CONFIG_FILE: pyproject.toml
47-

scripts/travis_test_buidler.sh

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

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

55
cd tests/buidler || exit 255
66

7-
8-
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
9-
source ~/.nvm/nvm.sh
10-
nvm install 10.17.0
11-
nvm use 10.17.0
12-
137
npm install --save-dev @nomiclabs/buidler
148

159
crytic-compile .

scripts/travis_test_dapp.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22

33
### Test dapp integration
44

5+
DIR=$(mktemp -d)
6+
cd "$DIR" || exit 255
7+
58
# The dapp init process makes a temporary local git repo and needs certain values to be set
69
git config --global user.email "[email protected]"
710
git config --global user.name "CI User"
811

9-
curl -L https://nixos.org/nix/install | sh
10-
curl https://dapp.tools/install | sh
12+
which nix-env || exit 255
13+
14+
git clone --recursive https://github.com/dapphub/dapptools "$HOME/.dapp/dapptools"
15+
nix-env -f "$HOME/.dapp/dapptools" -iA dapp seth solc hevm ethsign
1116

1217
dapp init
1318

scripts/travis_test_etherlime.sh

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

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

5-
mkdir /tmp/etherlime
6-
cd /tmp/etherlime || exit 255
7-
8-
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
9-
source ~/.nvm/nvm.sh
10-
nvm install 10.17.0
11-
nvm use 10.17.0
5+
DIR=$(mktemp -d)
6+
cd "$DIR" || exit 255
127

138
npm i -g etherlime
149
etherlime init

scripts/travis_test_etherscan.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@
22

33
### Test etherscan integration
44

5-
mkdir /tmp/etherscan
6-
cd /tmp/etherscan || exit 255
5+
DIR=$(mktemp -d)
6+
cd "$DIR" || exit 255
77

8-
wget -O solc-0.4.25 https://github.com/ethereum/solidity/releases/download/v0.4.25/solc-static-linux
9-
chmod +x solc-0.4.25
8+
solc-select use 0.4.25 --always-install
109

11-
crytic-compile 0x7F37f78cBD74481E593F9C737776F7113d76B315 --compile-remove-metadata --solc "./solc-0.4.25" --etherscan-apikey "$GITHUB_ETHERSCAN"
10+
crytic-compile 0x7F37f78cBD74481E593F9C737776F7113d76B315 --compile-remove-metadata --etherscan-apikey "$GITHUB_ETHERSCAN"
1211

1312
if [ $? -ne 0 ]
1413
then
1514
echo "Etherscan test failed"
1615
exit 255
1716
fi
1817

19-
crytic-compile rinkeby:0xFe05820C5A92D9bc906D4A46F662dbeba794d3b7 --compile-remove-metadata --solc "./solc-0.4.25" --etherscan-apikey "$GITHUB_ETHERSCAN"
18+
crytic-compile rinkeby:0xFe05820C5A92D9bc906D4A46F662dbeba794d3b7 --compile-remove-metadata --etherscan-apikey "$GITHUB_ETHERSCAN"
2019

2120
if [ $? -ne 0 ]
2221
then

scripts/travis_test_hardhat.sh

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

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

55
cd tests/hardhat || exit 255
66

7-
8-
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
9-
source ~/.nvm/nvm.sh
10-
nvm install 10.17.0
11-
nvm use 10.17.0
12-
137
npm install
148

15-
169
crytic-compile .
1710
if [ $? -ne 0 ]
1811
then

scripts/travis_test_solc.sh

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

3-
cp tests/contract.sol /tmp
4-
cd /tmp || exit 255
5-
crytic-compile contract.sol --compile-remove-metadata
3+
DIR=$(mktemp -d)
4+
5+
cp tests/contract.sol "$DIR"
6+
cd "$DIR" || exit 255
7+
crytic-compile contract.sol --compile-remove-metadata --export-format truffle
68

79
cd - || exit 255
8-
DIFF=$(diff /tmp/crytic-export/contracts.json tests/expected/solc-demo.json)
9-
if [ "$DIFF" != "" ]
10+
DIFF=$(diff "$DIR/crytic-export/C.json" tests/expected/solc-demo.json)
11+
if [ "$?" != "0" ] || [ "$DIFF" != "" ]
1012
then
1113
echo "solc test failed"
1214
echo "$DIFF"

0 commit comments

Comments
 (0)