use new bindings #103
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Crate π¦ Distribution | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.config.os }} | |
| name: Test on ${{ matrix.config.os}} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - { | |
| os: 'ubuntu-latest' | |
| } | |
| - { | |
| os: 'macos-latest' | |
| } | |
| - { | |
| os: 'macos-13' | |
| } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: 'π οΈ Set up Rust' | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: 'π οΈ Set up dependency of AFL++ on Linux' | |
| if: ${{ contains(matrix.config.os, 'ubuntu') }} | |
| run: | | |
| sudo apt update && sudo apt install -y llvm-16-dev clang-16 build-essential \ | |
| libtool libtool-bin libglib2.0-dev python3 make cmake automake meson ninja-build bison flex &&\ | |
| sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 0 && \ | |
| sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 0 | |
| - name: 'π οΈ Set up dependency of AFL++ on macOS' | |
| if: ${{ contains(matrix.config.os, 'macos') }} | |
| run: | | |
| brew install wget git make cmake llvm gdb coreutils | |
| - name: 'π§ Cargo test' | |
| run: | | |
| cargo test | |
| - name: 'π§ Test Building bindings feature' | |
| run: | | |
| cargo build --features env_logger,bindings | |
| - name: 'π§ Build sample' | |
| run: | | |
| cargo build --release --example sample --features env_logger | |
| - name: 'π§ AFLplusplus Checkout' | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: 'AFLplusplus/AFLplusplus' | |
| ref: 'dev' | |
| path: 'AFLplusplus' | |
| - name: 'π οΈ macOS quirks for AFL++' | |
| if: contains(matrix.config.os, 'macos') | |
| run: | | |
| cd AFLplusplus && sudo sh ./afl-system-config | |
| - name: 'π§ AFLplusplus Setup' | |
| run: | | |
| cd AFLplusplus &&\ | |
| make -j4 afl-fuzz | |
| - name: 'π§ Prepare fuzz resources' | |
| run: | | |
| mkdir ./input && echo 'a' > ./input/a | |
| - name: 'π§ Fuzz 4-byte cmplog for 60 seconds' | |
| run: | | |
| ./AFLplusplus/afl-fuzz -i ./input -o ./output-4 -b 1 -g 4 -G 4 -V 60 -c 0 -- ./target/release/examples/sample @@ | |
| env: | |
| AFL_BENCH_UNTIL_CRASH: 1 | |
| AFL_NO_CRASH_README: 1 | |
| AFL_NO_UI: 1 | |
| AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES: 1 | |
| AFL_SKIP_CPUFREQ: 1 | |
| UNICORN_AFL_CMPCOV: 1 | |
| - name: "π§ Check if we find the crash" | |
| run: | | |
| ls ./output-4/default/crashes/ | |
| if [ "$(find ./output-4/default/crashes/ -type f | wc -l)" -eq 0 ]; then | |
| cat ./output-4/default/fuzzer_stats | |
| exit 1; | |
| else | |
| if ! [ "$(grep "stab" ./output-4/default/fuzzer_stats | awk '{print $3}')" = '100.00%' ]; then | |
| cat ./output-4/default/fuzzer_stats | |
| exit 2; | |
| fi | |
| fi | |
| - name: 'π§ Fuzz 8-byte cmplog for 180 seconds' | |
| run: | | |
| ./AFLplusplus/afl-fuzz -i ./input -o ./output-8 -b 1 -g 8 -G 8 -V 180 -c 0 -- ./target/release/examples/sample @@ true | |
| env: | |
| AFL_BENCH_UNTIL_CRASH: 1 | |
| AFL_NO_CRASH_README: 1 | |
| AFL_NO_UI: 1 | |
| AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES: 1 | |
| AFL_SKIP_CPUFREQ: 1 | |
| UNICORN_AFL_CMPCOV: 1 | |
| - name: "π§ Check if we find the crash" | |
| run: | | |
| ls ./output-8/default/crashes/ | |
| if [ "$(find ./output-8/default/crashes/ -type f | wc -l)" -eq 0 ]; then | |
| cat ./output-8/default/fuzzer_stats | |
| exit 1; | |
| else | |
| if ! [ "$(grep "stab" ./output-8/default/fuzzer_stats | awk '{print $3}')" = '100.00%' ]; then | |
| cat ./output-8/default/fuzzer_stats | |
| exit 2; | |
| fi | |
| fi | |
| - name: 'π¦ Cargo Publish' | |
| if: ${{ startsWith(github.ref, 'refs/tags') && contains(matrix.config.os, 'ubuntu') }} | |
| env: | |
| TOKEN: ${{ secrets.CRATES_IO_KEY }} | |
| run: | | |
| cargo login $TOKEN && cargo test && cargo publish | |
| fmt-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cargo fmt | |
| run: cargo fmt --check | |
| fmt-toml-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install taplo | |
| run: cargo install taplo-cli --locked | |
| - uses: actions/checkout@v4 | |
| - name: Run taplo | |
| run: taplo format --check |