[ci] Run fuzzing in CI

This commit is contained in:
Mark Spanbroek 2023-01-30 14:35:14 +01:00 committed by markspanbroek
parent 3390e21071
commit 25f52c72b1
2 changed files with 26 additions and 5 deletions

View File

@ -7,12 +7,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: 18 node-version: 18
- run: npm install - run: npm install
- run: npm test - run: npm test
- uses: actions/cache@v3
with:
path: fuzzing/corpus
key: fuzzing
- run: npm run fuzz

View File

@ -1,3 +1,23 @@
#!/bin/bash #!/bin/bash
set -e set -e
echidna-test . --contract FuzzMarketplace --config fuzzing/echidna.yaml
if command -v echidna-test; then
fuzz () {
echidna-test . \
--config fuzzing/echidna.yaml \
--contract $1
}
else
fuzz () {
docker run \
--rm \
-v `pwd`:/src ghcr.io/crytic/echidna/echidna \
bash -c \
"cd /src && echidna-test . \
--config fuzzing/echidna.yaml \
--crytic-args --ignore-compile \
--contract $1"
}
fi
fuzz FuzzMarketplace