Skip to content

chore(CI): split check-c-format in gwos-scripts workflow #23

chore(CI): split check-c-format in gwos-scripts workflow

chore(CI): split check-c-format in gwos-scripts workflow #23

Workflow file for this run

name: GWOS EVM FuzzTest
on:
push:
paths:
- 'gwos-evm/**'
pull_request:
paths:
- 'gwos-evm/**'
schedule:
- cron: 0 */2 * * *
jobs:
build-and-run-fuzzing:
runs-on: ubuntu-20.04
defaults:
run:
working-directory: gwos-evm
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Cache Rust - Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Install moleculec
run: |
export MOLC_VERSION=$(cat ../gwos/c/Makefile | egrep "MOLC_VERSION :=" | awk '{print $3}')
test "$(moleculec --version)" = "Moleculec $MOLC_VERSION" \
|| CARGO_TARGET_DIR=target/ cargo install moleculec --version $MOLC_VERSION
- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v3
with:
path: ./llvm
key: clang-11
- name: Set the datetime
run: echo "DATETIME=$(date +%F_%H:%M)" >> $GITHUB_ENV
- name: Cache corpus
id: cache-corpus
uses: actions/cache@v3
with:
path: |
gwos-evm/polyjuice-tests/fuzz/corpus-cache
key: corpus-${{ env.DATETIME }}
restore-keys: |
corpus
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "11.0"
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
- name: Set fuzzing duration for 1h
run: echo "MAX_FUZZ_TIME=3600" >> $GITHUB_ENV
- name: Set fuzzing duration for 1m
if: github.event_name == 'pull_request'
run: echo "MAX_FUZZ_TIME=60" >> $GITHUB_ENV
- name: Fuzzing Polyjuice
working-directory: gwos-evm/polyjuice-tests/fuzz
run: |
mkdir -p corpus-cache
mkdir -p corpus
ls corpus-cache
make build/fuzzer && \
LLVM_PROFILE_FILE="build/fuzzer.profraw" ./build/fuzzer corpus corpus-cache \
-max_total_time=$MAX_FUZZ_TIME -timeout=120 \
-max_len=25000 -rss_limit_mb=0
# Max data buffer size: 24KB < 25000 bytes
- name: Cov report
working-directory: gwos-evm/polyjuice-tests/fuzz
run: |
llvm-profdata merge -sparse build/fuzzer.profraw -o build/fuzzer.profdata
llvm-cov report ./build/fuzzer -instr-profile=build/fuzzer.profdata
- name: merge corpus
working-directory: gwos-evm/polyjuice-tests/fuzz
run: |
mkdir -p corpus-new
./build/fuzzer -merge=1 corpus-new corpus-cache corpus
rm -rf corpus-cache
mv corpus-new corpus-cache
- name: Archive inputs that triggered crashes or sanitizer failures
uses: actions/upload-artifact@v3
if: failure()
with:
name: fuzzing-inputs
path: |
polyjuice-tests/fuzz/crash-*
polyjuice-tests/fuzz/leak-*
polyjuice-tests/fuzz/timeout-*
polyjuice-tests/fuzz/oom-*
- name: Archive corpus
uses: actions/upload-artifact@v3
with:
name: corpus
path: |
gwos-evm/polyjuice-tests/fuzz/corpus-cache/*