FRET-LibAFL/.github/workflows/build_and_test.yml
Andrea Fioraldi 1fde608145
Qemu as lib (#301)
* linking problems

* use shared lib

* ci

* clippy, ci fixegit pushs

* ingoring distclean result

* clippy

* clippy

Co-authored-by: Dominik Maier <domenukk@gmail.com>
2021-09-24 13:22:33 +02:00

201 lines
6.3 KiB
YAML

name: Build and Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
lint:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Add clippy
run: rustup component add clippy
#- name: Run clippy
# uses: actions-rs/cargo@v1
# with:
# command: clippy
# args: --all
ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Install deps
run: sudo apt-get install -y llvm llvm-dev clang ninja-build
- name: get clang version
run: command -v llvm-config && clang -v
- name: Install cargo-hack
run: curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin
- name: Run a normal build
run: cargo build --verbose
# cargo-hack tests/checks each crate in the workspace
- name: Run tests
run: cargo hack test --all-features
# cargo-hack's --feature-powerset would be nice here but libafl has a too many knobs
- name: Check each feature
run: cargo hack check --each-feature
- name: Build examples
run: cargo build --examples --verbose
- uses: actions/checkout@v2
- name: Format
run: cargo fmt -- --check
- uses: actions/checkout@v2
- name: Build Docs
run: cargo doc
- name: Test Docs
run: cargo test --all-features --doc
- name: Run clippy
run: ./scripts/clippy.sh
ubuntu-concolic:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Install smoke test deps
run: sudo ./libafl_concolic/test/smoke_test_ubuntu_deps.sh
- name: Run smoke test
run: ./libafl_concolic/test/smoke_test.sh
ubuntu-fuzzers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Add nightly rustfmt and clippy
run: rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade
- name: Install deps
run: sudo apt-get install -y llvm llvm-dev clang nasm ninja-build
- name: Build and run example fuzzers
run: ./scripts/test_all_fuzzers.sh
nostd-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
- uses: Swatinem/rust-cache@v1
- name: Add nightly rustfmt and clippy
run: rustup toolchain install nightly && rustup target add --toolchain nightly aarch64-unknown-none && rustup component add --toolchain nightly rust-src
- name: Build aarch64-unknown-none
run: cd ./fuzzers/baby_no_std && cargo +nightly build -Zbuild-std=core,alloc --target aarch64-unknown-none -v --release && cd ../..
- name: run x86_64 until panic!
run: cd ./fuzzers/baby_no_std && cargo +nightly run || test $? -eq 1 || exit 1
- name: no_std tests
run: cd ./libafl && cargo test --no-default-features
build-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build docker
run: docker build -t libafl .
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Windows Build
run: cargo build --verbose
- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
macos:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: MacOS Build
run: cargo build --verbose
- name: Run clippy
run: ./scripts/clippy.sh
- name: Increase map sizes
run: ./scripts/shmem_limits_macos.sh
- name: Run Tests
run: cargo test
macos-fuzzers:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Add nightly rustfmt and clippy
run: rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade
- name: YOLO remove ancient libpng for mozjpeg build
run: rm -rf /usr/local/lib/libpng.a
- name: Install deps
run: brew install llvm libpng nasm coreutils && brew link --force llvm
- name: Increase map sizes
run: ./scripts/shmem_limits_macos.sh
- name: Build and run example fuzzers
run: ./scripts/test_all_fuzzers.sh
other_targets:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v1
- uses: nttld/setup-ndk@v1
with:
ndk-version: r21e
- name: install ios
run: rustup target add aarch64-apple-ios
- name: install android
run: rustup target add aarch64-linux-android
- name: install cargo ndk
run: cargo install cargo-ndk
- name: Build iOS
run: cargo build --target aarch64-apple-ios
- name: Build Android
run: cargo ndk -t arm64-v8a build --release
#run: cargo build --target aarch64-linux-android
# TODO: Figure out how to properly build stuff with clang
#- name: Add clang path to $PATH env
# if: runner.os == 'Windows'
# run: echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
#- name: Try if clang works
# run: clang -v
#- name: Windows Test
# run: C:\Rust\.cargo\bin\cargo.exe test --verbose