phink 0.1.5

🐙 Phink, a ink! smart-contract property-based and coverage-guided fuzzer
Documentation
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
    steps:
      - name: Free Disk Space
        run: |
          sudo rm -rf /usr/share/dotnet
          sudo rm -rf /usr/local/lib/android
          sudo rm -rf /opt/ghc
          sudo rm -rf /opt/hostedtoolcache
          df -h

      - uses: actions/checkout@v4
        with:
          fetch-depth: 1

      - name: Cache Cargo components
        uses: actions/cache@v3
        with:
          path: ~/.cargo/registry
          key: cargo-${{ hashFiles('Cargo.lock') }}
          restore-keys: cargo-

      - 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"
          # Cleanup after LLVM installation
          rm -rf llvm.sh
          sudo apt-get clean
          df -h

      - name: Install required tools
        run: |
          cargo install --force ziggy cargo-afl honggfuzz cargo-contract
          # Clean up after installation
          rm -rf ~/.cargo/registry/cache
          df -h

      - 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
          rm afl-system-config.sh

      - name: Run AFL++ configuration
        run: |
          cargo afl config --build --plugins --verbose --force
          # Clean up after AFL configuration
          cargo clean
          df -h

      - name: Build in release mode
        run: |
          cargo build --release --verbose
          # Remove debug symbols to save space
          find target/release -type f -executable -exec strip {} \;
          df -h

      - name: Compile samples in `sample`
        working-directory: ./sample
        run: bash build.sh

      - name: Run all unit and integration tests
        run: cargo test --no-fail-fast -- --test-threads=1 --show-output

      - name: Final cleanup
        if: always()
        run: |
          cargo clean
          sudo apt autoremove -y
          sudo apt clean
          rm -rf ~/.cargo/registry ~/.cargo/git ~/.cargo/index
          rm -rf target