-
Notifications
You must be signed in to change notification settings - Fork 2
99 lines (86 loc) · 2.76 KB
/
rust.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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