-
Notifications
You must be signed in to change notification settings - Fork 8
62 lines (52 loc) · 1.58 KB
/
rust.yml
File metadata and controls
62 lines (52 loc) · 1.58 KB
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
name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
clang \
llvm \
libelf-dev \
linux-tools-common \
linux-tools-generic \
libbpf-dev \
linux-headers-$(uname -r)
- name: Setup bpftool
run: |
# Link bpftool from linux-tools
sudo ln -sf /usr/lib/linux-tools/*/bpftool /usr/local/bin/bpftool || true
bpftool version
- name: Generate vmlinux.h if BTF not available
run: |
# Check if BTF is available on the runner
if [ ! -f /sys/kernel/btf/vmlinux ]; then
echo "BTF not available, downloading pre-generated vmlinux.h..."
mkdir -p src/bpf
# Use vmlinux.h from libbpf-bootstrap (covers common kernel structures)
curl -sL https://raw.githubusercontent.com/libbpf/libbpf-bootstrap/master/vmlinux/vmlinux_608.h -o src/bpf/vmlinux.h
echo "Downloaded vmlinux.h"
else
echo "BTF available at /sys/kernel/btf/vmlinux"
fi
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Build
run: |
# If vmlinux.h was pre-generated, skip btf_dump in build.rs
if [ -f src/bpf/vmlinux.h ]; then
export SKIP_BTF_DUMP=1
fi
cargo build --verbose
- name: Run tests
run: cargo test --verbose