refactor: modularize main.rs and cli.rs #100
Workflow file for this run
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: Rust | |
on: | |
push: | |
branches: ["main"] | |
paths: | |
- "**.rs" | |
- "**.toml" | |
pull_request: | |
branches: ["main"] | |
paths: | |
- "**.rs" | |
- "**.toml" | |
env: | |
CARGO_TERM_COLOR: always | |
AFL_PATH: $HOME/.local/bin/afl-fuzz | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Set up tool cache | |
- name: Cache tools | |
id: cache-tools | |
uses: actions/cache@v3 | |
with: | |
path: | | |
/usr/lib/llvm-18 | |
~/.cargo | |
~/.local/bin | |
key: ${{ runner.os }}-tools-llvm18-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-tools-llvm18- | |
# Install tools if not cached | |
- name: Install LLVM tools | |
run: | | |
# Always create the symlinks since they're not cached | |
if [ ! -d "/usr/lib/llvm-18" ]; then | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 18 | |
sudo apt-get update | |
sudo apt-get install -y lcov | |
fi | |
sudo ln -sf /usr/lib/llvm-18/bin/llvm-profdata /usr/local/bin/llvm-profdata | |
sudo ln -sf /usr/lib/llvm-18/bin/llvm-cov /usr/local/bin/llvm-cov | |
# Verify genhtml is available | |
which genhtml || sudo apt-get install -y lcov | |
# Verify all required tools are available | |
for tool in llvm-profdata llvm-cov genhtml lcov; do | |
which $tool | |
done | |
- name: Add fake afl-fuzz into path | |
run: | | |
mkdir -p $HOME/.local/bin | |
cp /bin/ls $HOME/.local/bin/afl-fuzz | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Build | |
run: cargo build --verbose | |
- name: Run tests | |
run: cargo test --verbose |