comments #258
This file contains 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: Integration tests | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_TEST_THREADS: "1" | |
AFL_SKIP_CPUFREQ: 1 | |
AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES: 1 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# Added a step to clean up at the end | |
steps: | |
- uses: actions/checkout@v4 | |
# Fetch only the necessary history to reduce space usage | |
with: | |
fetch-depth: 1 | |
- name: Cache Cargo components | |
uses: actions/cache@v3 | |
with: | |
# Reduced paths to cache only the most essential components | |
path: | | |
~/.cargo/registry | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
# - name: Set up LLVM z& Clang | |
# run: | | |
# if ! command -v clang-19 &> /dev/null; then | |
# # Reduced apt-get update to only update the newly added source | |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo -E apt-key add - | |
# echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main" | sudo -E tee -a /etc/apt/sources.list.d/llvm.list | |
# sudo -E apt-get update --only-source | |
# sudo -E apt-get install -y --no-install-recommends llvm-19 clang-19 libclang-19-dev | |
# fi | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly | |
override: true | |
- name: Add rust-src | |
run: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu | |
- name: Install LLVM | |
run: | | |
LLVM_VERSION="$(rustc --version -v | grep '^LLVM version:' | grep -o '[0-9]\+' | head -n 1)" | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo -E ./llvm.sh "$LLVM_VERSION" | |
- name: Install required tools | |
run: | | |
cargo install --force ziggy cargo-afl honggfuzz cargo-contract | |
- name: Run afl-system-config | |
run: | | |
curl -s https://raw.githubusercontent.com/AFLplusplus/AFLplusplus/stable/afl-system-config > afl-system-config.sh | |
chmod +x afl-system-config.sh | |
sudo -E ./afl-system-config.sh | |
- name: Run AFL++ configuration | |
run: | |
cargo afl config --build --plugins --verbose --force | |
- name: Build in release mode | |
run: cargo build --release --verbose | |
- name: Compile samples in `sample` | |
working-directory: ./sample | |
run: bash build.sh | |
- name: Run all unit tests | |
run: cargo test --no-fail-fast -- --test-threads=1 | |
# New step to clean up after the workflow | |
- name: Cleanup | |
run: | | |
sudo apt autoremove -y | |
sudo apt clean -y | |
rm -rf ~/.cargo/registry ~/.cargo/index target | |
rm afl-system-config.sh | |
cd ~ | |
rm -rf /home/runner/work/_temp | |
rm -rf /home/runner/work/_actions |