Skip to content

Commit

Permalink
Refactor CI workflow for building BPF code
Browse files Browse the repository at this point in the history
  • Loading branch information
arloor committed Oct 23, 2024
1 parent 86373f9 commit 0a24e42
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 38 deletions.
File renamed without changes.
18 changes: 13 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: build bpf
- name: build static
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
id: build_bpf
id: build_static
uses: arloor/rust_musl_action@latest
with:
use_musl: false
Expand All @@ -27,6 +27,14 @@ jobs:
apt_mirror: mirrors.mit.edu
rust_flags: -C target-feature=+crt-static
debug: false
- name: ls dir
run: |
ls ${{ steps.build_bpf.outputs.release_dir }}
- name: build vendored
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
id: build_vendored
uses: arloor/rust_musl_action@latest
with:
use_musl: false
extra_deps: cmake clang pkg-config make
args: -p socket_filter -p cgroup_traffic --features vendored -v
apt_mirror: mirrors.mit.edu
rust_flags: -C target-feature=+crt-static
debug: false
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"if_ether.h": "c"
},
"github-actions.workflows.pinned.workflows": [
".github/workflows/auto.yml"
".github/workflows/auto.yml",
".github/workflows/test.yml"
]
}
40 changes: 20 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#inheriting-a-dependency-from-a-workspace
[workspace.dependencies]
libbpf-cargo = "0.24"
libbpf-rs = { version = "0.24", default-features = false } # Cargo plugin to build bpf programs
libbpf-rs = "0.24" # Cargo plugin to build bpf programs
vmlinux = { version = "0.0", git = "https://github.com/libbpf/vmlinux.h.git", rev = "a9c092aa771310bf8b00b5018f7d40a1fdb6ec82" }
log = "0.4"
libc = "0.2"
Expand Down
8 changes: 4 additions & 4 deletions cgroup_traffic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ path = "examples/ex_cgroup_traffic.rs"


[dependencies]
libc.workspace = true # Raw FFI bindings to platform libraries like libc
libbpf-rs = { workspace = true, default-features = false } # libbpf-rs is a safe, idiomatic, and opinionated wrapper around libbpf-sys
plain.workspace = true # A small Rust library that allows users to reinterpret data of certain types safely
libc.workspace = true # Raw FFI bindings to platform libraries like libc
libbpf-rs = { workspace = true } # libbpf-rs is a safe, idiomatic, and opinionated wrapper around libbpf-sys
plain.workspace = true # A small Rust library that allows users to reinterpret data of certain types safely
log.workspace = true
[dev-dependencies]
env_logger = "0.11"
Expand All @@ -31,6 +31,6 @@ env_logger = "0.11"
libbpf-cargo = { workspace = true } # Cargo plugin to build bpf programs

[features]
default = ["libbpf-rs/default"]
default = []
vendored = ["libbpf-rs/vendored"]
static = ["libbpf-rs/static"]
10 changes: 5 additions & 5 deletions socket_filter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ name = "example1"
path = "examples/example1.rs"

[dependencies]
libc.workspace = true # Raw FFI bindings to platform libraries like libc
libbpf-rs = { workspace = true, default-features = false } # libbpf-rs is a safe, idiomatic, and opinionated wrapper around libbpf-sys
plain.workspace = true # A small Rust library that allows users to reinterpret data of certain types safely
pnet = "0.35" # Rust library for low level networking using the pcap library
libc.workspace = true # Raw FFI bindings to platform libraries like libc
libbpf-rs = { workspace = true } # libbpf-rs is a safe, idiomatic, and opinionated wrapper around libbpf-sys
plain.workspace = true # A small Rust library that allows users to reinterpret data of certain types safely
pnet = "0.35" # Rust library for low level networking using the pcap library
log.workspace = true

[build-dependencies]
libbpf-cargo = { workspace = true } # Cargo plugin to build bpf programs

[features]
default = ["libbpf-rs/default"]
default = []
vendored = ["libbpf-rs/vendored"]
static = ["libbpf-rs/static"]
4 changes: 2 additions & 2 deletions trace_conn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
libbpf-rs = { workspace = true, default-features = false }
libbpf-rs = { workspace = true }
plain.workspace = true
libc.workspace = true
object = "0.36"
Expand All @@ -17,7 +17,7 @@ vmlinux = { workspace = true, optional = true }


[features]
default = ["libbpf-rs/default"]
default = []
vendored = ["libbpf-rs/vendored"]
static = ["libbpf-rs/static"]
remote-vmlinux = ["vmlinux"]

0 comments on commit 0a24e42

Please sign in to comment.